Comments (7)
Please provide the log from neuron.log
with the timestamp matches the problem you specified.
For example, around timestamp 2023-09-07 19:00:00
.
Also, the version latest
is not informative, please run neuron --version
to provide this information.
from neuron.
Can you provide an email address? I will email the log to you
version:Neuron 2.6.0-dev (d4e9e63)
from neuron.
Can you provide an email address? I will email the log to you version:Neuron 2.6.0-dev (d4e9e63)
Did you modify the code ? If so, I hardly can draw any conclusion without information about your changes.
from neuron.
Oh yes, your question inspired me!
I have modified one thing, that is, the response format of the read request. The modified response format is consistent with the actively reported attribute format. But I'm not sure what's wrong with what I modified, can you help me?
I referred to the generate_upload_json
function. The modified content is as follows:
In the neu_json_mqtt.h
: the following structure is added:
typedef struct {
char* group;
char* node;
uint64_t timestamp;
char * uuid;
} json_mqtt_unify_format_t;
In the neu_json_mqtt.c
: the following function is added:
int json_encode_mqtt_unify_format_resp(void *json_object, void *param)
{
int ret = 0;
json_mqtt_unify_format_t *resp = (json_mqtt_unify_format_t *) param;
neu_json_elem_t resp_elems[] = { {
.name = "node",
.t = NEU_JSON_STR,
.v.val_str = resp->node,
},
{
.name = "group",
.t = NEU_JSON_STR,
.v.val_str = resp->group,
},
{
.name = "timestamp",
.t = NEU_JSON_INT,
.v.val_int = resp->timestamp,
},
{
.name = "uuid",
.t = NEU_JSON_STR,
.v.val_str = resp->uuid,
} };
ret = neu_json_encode_field(json_object, resp_elems,NEU_JSON_ELEM_SIZE(resp_elems));
return ret;
}
In the mqtt_handle.c
: the generate_read_resp_json
function has been modified:
static char *generate_read_resp_json(neu_plugin_t * plugin,
neu_json_mqtt_t * mqtt,
neu_resp_read_group_t *data)
{
neu_resp_tag_value_meta_t *tags = data->tags;
uint16_t len = data->n_tag;
char * json_str = NULL;
// ------the following has been added ------
json_mqtt_unify_format_t header = {
.group = (char *) data->group,
.node = (char *) data->driver,
.timestamp = global_timestamp,
.uuid = (char *) mqtt->uuid};
// -----------------end-----------------
neu_json_read_resp_t json = { 0 };
if (0 != tag_values_to_json(tags, len, &json)) {
plog_error(plugin, "tag_values_to_json fail");
return NULL;
}
// ----------- the following has been modified -----------
// neu_json_encode_with_mqtt(&json, neu_json_encode_read_resp, mqtt,
// neu_json_encode_mqtt_resp, &json_str);
neu_json_encode_with_mqtt(&json, neu_json_encode_read_resp1, &header,
json_encode_mqtt_unify_format_resp,
&json_str);
for (int i = 0; i < json.n_tag; i++) {
if (json.tags[i].n_meta > 0) {
free(json.tags[i].metas);
}
}
// ----------------------end-------------------
if (json.tags) {
free(json.tags);
}
return json_str;
}
from neuron.
I think as long as your code does not segfault, it does not relate to the problem reported.
If you modify the code in neuron core, then probably it is not the mqtt plugin causing the problem.
from neuron.
I only modified this part of the code, the core code was not updated. So I still think that this issue has nothing to do with the content I modified.
from neuron.
I only modified this part of the code, the core code was not updated. So I still think that this issue has nothing to do with the content I modified.
I suggest use the official version to test this problem : )
from neuron.
Related Issues (20)
- deployed in k8s, when the pod is rebuilt, the hardware identification will change HOT 1
- How to subscribe to MQTT data with southbound plugin?(南向插件如何实现订阅MQTT数据的功能) HOT 6
- It is necessary for neuron to support rebot OS.(Neuron是否有必要支持系统重启) HOT 2
- Function codes 0x06 and 0x0F not supported HOT 5
- can add the Port Forwarding function? HOT 3
- file plugin read error HOT 3
- 【Main】【modbus rtu】串口模式下没有将连接模式 connection_mode字段成功隐藏 HOT 1
- 从北向mqtt做南向的反控支持吗?/neuron/mqttzf/write/req 里面该怎么传参呢?哪里有技术交流群? HOT 2
- 【Main】【modbus】调试报文显示不全面 HOT 1
- Boldly reviewing Neuron HOT 1
- Neuron 源码交叉编译时,报”configuration files were considered but not accepted“
- 【DashBoard】neuron 是否可以支持修改网关硬件IP HOT 1
- Whether the tag can be added Unit Attribute HOT 4
- 通道配置与节点配置可否分开独立配置 HOT 1
- Memory overflow issue
- Can't run this program HOT 2
- Licensing question, 30 tags limit on Modbus TCP HOT 5
- No driver and group fields in NEU_RESP_GET_TAG message HOT 1
- Neuron crashes when I create number of nodes (160 ~ 200). HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neuron.