mirror of
https://github.com/emqx/neuron.git
synced 2026-10-24 10:46:39 +08:00
@@ -80,14 +80,12 @@ typedef uint32_t neu_node_id_t;
|
||||
typedef struct neu_reqresp_read {
|
||||
neu_taggrp_config_t *grp_config;
|
||||
neu_node_id_t dst_node_id;
|
||||
void * context;
|
||||
} neu_reqresp_read_t;
|
||||
|
||||
/* NEU_REQRESP_READ_RESP */
|
||||
typedef struct neu_reqresp_read_resp {
|
||||
neu_taggrp_config_t *grp_config;
|
||||
neu_data_val_t * data_val; ///< data values of reading
|
||||
void * context;
|
||||
} neu_reqresp_read_resp_t;
|
||||
|
||||
/* NEU_REQRESP_WRITE_DATA */
|
||||
@@ -95,14 +93,12 @@ typedef struct neu_reqresp_write {
|
||||
neu_taggrp_config_t *grp_config;
|
||||
neu_node_id_t dst_node_id;
|
||||
neu_data_val_t * data_val;
|
||||
void * context;
|
||||
} neu_reqresp_write_t;
|
||||
|
||||
/* NEU_REQRESP_WRITE_RESP */
|
||||
typedef struct neu_reqresp_write_resp {
|
||||
neu_taggrp_config_t *grp_config;
|
||||
neu_data_val_t * data_val; ///< result status of writing
|
||||
void * context;
|
||||
} neu_reqresp_write_resp_t;
|
||||
|
||||
/* NEU_REQRESP_SUBSCRIBE_NODE */
|
||||
|
||||
@@ -104,10 +104,10 @@ uint32_t neu_plugin_send_subscribe_cmd(neu_plugin_t * plugin,
|
||||
neu_node_id_t node_id,
|
||||
neu_taggrp_config_t *grp_config);
|
||||
uint32_t neu_plugin_send_read_cmd(neu_plugin_t *plugin, neu_node_id_t node_id,
|
||||
neu_taggrp_config_t *grp_configs, void *ctx);
|
||||
neu_taggrp_config_t *grp_configs);
|
||||
uint32_t neu_plugin_send_write_cmd(neu_plugin_t *plugin, neu_node_id_t node_id,
|
||||
neu_taggrp_config_t *grp_configs,
|
||||
neu_data_val_t *data, void *ctx);
|
||||
neu_data_val_t * data);
|
||||
void neu_plugin_response_trans_data(neu_plugin_t * plugin,
|
||||
neu_taggrp_config_t *grp_config,
|
||||
neu_data_val_t *data, uint32_t event_id);
|
||||
|
||||
@@ -563,7 +563,6 @@ static int modbus_tcp_request(neu_plugin_t *plugin, neu_request_t *req)
|
||||
neu_dvalue_init_move_array(array_resp, NEU_DTYPE_INT_VAL, array);
|
||||
data_resp.data_val = array_resp;
|
||||
}
|
||||
data_resp.context = read_req->context;
|
||||
data_resp.grp_config = read_req->grp_config;
|
||||
resp.req_id = 1;
|
||||
resp.resp_type = NEU_REQRESP_READ_RESP;
|
||||
|
||||
@@ -40,8 +40,7 @@ void command_read_once_request(neu_plugin_t *plugin, neu_parse_mqtt_t *mqtt,
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t req_id =
|
||||
neu_plugin_send_read_cmd(plugin, req->node_id, config, NULL);
|
||||
uint32_t req_id = neu_plugin_send_read_cmd(plugin, req->node_id, config);
|
||||
UNUSED(req_id);
|
||||
}
|
||||
|
||||
@@ -289,8 +288,8 @@ static int write_command(neu_plugin_t *plugin, uint32_t dest_node_id,
|
||||
return -2;
|
||||
}
|
||||
|
||||
uint32_t req_id = neu_plugin_send_write_cmd(plugin, dest_node_id, config,
|
||||
write_val, NULL);
|
||||
uint32_t req_id =
|
||||
neu_plugin_send_write_cmd(plugin, dest_node_id, config, write_val);
|
||||
|
||||
return req_id;
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ static int dashb_plugin_request(neu_plugin_t *plugin, neu_request_t *req)
|
||||
case NEU_REQRESP_READ_RESP: {
|
||||
neu_reqresp_read_resp_t *read_resp =
|
||||
(neu_reqresp_read_resp_t *) req->buf;
|
||||
http_not_found(read_resp->context, "{\"error\" : 1}");
|
||||
// http_not_found(read_resp->context, "{\"error\" : 1}");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -18,7 +18,7 @@ void handle_read(nng_aio *aio)
|
||||
aio, neu_parse_read_req_t, neu_parse_decode_read, {
|
||||
neu_taggrp_config_t *config = neu_system_find_group_config(
|
||||
plugin, req->node_id, req->group_config_name);
|
||||
neu_plugin_send_read_cmd(plugin, req->node_id, config, aio);
|
||||
neu_plugin_send_read_cmd(plugin, req->node_id, config);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -273,14 +273,13 @@ uint32_t neu_plugin_send_unsubscribe_cmd(neu_plugin_t * plugin,
|
||||
}
|
||||
|
||||
uint32_t neu_plugin_send_read_cmd(neu_plugin_t *plugin, neu_node_id_t node_id,
|
||||
neu_taggrp_config_t *grp_configs, void *ctx)
|
||||
neu_taggrp_config_t *grp_configs)
|
||||
{
|
||||
uint32_t event_id = 0;
|
||||
neu_reqresp_read_t read_req = { 0 };
|
||||
|
||||
read_req.grp_config = grp_configs;
|
||||
read_req.dst_node_id = node_id;
|
||||
read_req.context = ctx;
|
||||
|
||||
PLUGIN_SEND_CMD(plugin, NEU_REQRESP_READ_DATA, read_req, event_id)
|
||||
|
||||
@@ -289,7 +288,7 @@ uint32_t neu_plugin_send_read_cmd(neu_plugin_t *plugin, neu_node_id_t node_id,
|
||||
|
||||
uint32_t neu_plugin_send_write_cmd(neu_plugin_t *plugin, neu_node_id_t node_id,
|
||||
neu_taggrp_config_t *grp_configs,
|
||||
neu_data_val_t *data, void *ctx)
|
||||
neu_data_val_t * data)
|
||||
{
|
||||
uint32_t event_id = 0;
|
||||
neu_reqresp_write_t write_req = { 0 };
|
||||
@@ -297,7 +296,6 @@ uint32_t neu_plugin_send_write_cmd(neu_plugin_t *plugin, neu_node_id_t node_id,
|
||||
write_req.grp_config = grp_configs;
|
||||
write_req.dst_node_id = node_id;
|
||||
write_req.data_val = data;
|
||||
write_req.context = ctx;
|
||||
|
||||
PLUGIN_SEND_CMD(plugin, NEU_REQRESP_WRITE_DATA, write_req, event_id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user