diff --git a/ft/modbus_tcp_test.robot b/ft/modbus_tcp_test.robot index a700eb66..83d18aa8 100644 --- a/ft/modbus_tcp_test.robot +++ b/ft/modbus_tcp_test.robot @@ -179,7 +179,7 @@ Modbus Test Setup ${state}= Get Node State ${modbus_node} Should Be Equal As Integers ${state}[running] ${NODE_STATE_RUNNING} - Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_CONNECTING} + Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_DISCONNECTED} Modbus Test Teardown Del Node ${modbus_node} diff --git a/ft/node_ctl_test.robot b/ft/node_ctl_test.robot index d29b7cf1..a8aeca0a 100644 --- a/ft/node_ctl_test.robot +++ b/ft/node_ctl_test.robot @@ -37,7 +37,7 @@ Start the configured node, it should return success Node Setting modbus-node ${MODBUS_TCP_CONFIG} ${state} = Get Node State modbus-node Should Be Equal As Integers ${state}[running] ${NODE_STATE_READY} - Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_CONNECTING} + Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_DISCONNECTED} ${res} = Node Ctl modbus-node ${NODE_CTL_START} Check Response Status ${res} 200 @@ -45,7 +45,7 @@ Start the configured node, it should return success #${state} = Get Node State modbus-node #Should Be Equal As Integers ${state}[running] ${NODE_STATE_RUNNING} - #Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_CONNECTING} + #Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_DISCONNECTED} ${res} = Node Ctl modbus-node ${NODE_CTL_STOP} Check Response Status ${res} 200 @@ -53,7 +53,7 @@ Start the configured node, it should return success ${state} = Get Node State modbus-node Should Be Equal As Integers ${state}[running] ${NODE_STATE_STOP} - Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_CONNECTING} + Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_DISCONNECTED} Stop node that is stopped, it should return failure ${res} = Node Ctl modbus-node ${NODE_CTL_STOP} @@ -67,7 +67,7 @@ Start the stopped node, it should return success ${state} = Get Node State modbus-node Should Be Equal As Integers ${state}[running] ${NODE_STATE_RUNNING} - Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_CONNECTING} + Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_DISCONNECTED} Start the running node, it should return failure ${res} = Node Ctl modbus-node ${NODE_CTL_START} @@ -79,7 +79,7 @@ When setting up a READY/RUNNING/STOPED node, the node status will not change ${state} = Get Node State modbus-node Should Be Equal As Integers ${state}[running] ${NODE_STATE_RUNNING} - Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_CONNECTING} + Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_DISCONNECTED} ${res} = Node Ctl modbus-node ${NODE_CTL_STOP} Check Response Status ${res} 200 @@ -89,6 +89,6 @@ When setting up a READY/RUNNING/STOPED node, the node status will not change ${state} = Get Node State modbus-node Should Be Equal As Integers ${state}[running] ${NODE_STATE_STOP} - Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_CONNECTING} + Should Be Equal As Integers ${state}[link] ${NODE_LINK_STATE_DISCONNECTED} [Teardown] Del Node modbus-node \ No newline at end of file diff --git a/ft/resource/api.resource b/ft/resource/api.resource index 23c67e8a..8ff35e9b 100644 --- a/ft/resource/api.resource +++ b/ft/resource/api.resource @@ -17,8 +17,7 @@ ${NODE_STATE_RUNNING} 3 ${NODE_STATE_STOP} 4 ${NODE_LINK_STATE_DISCONNECTED} 0 -${NODE_LINK_STATE_CONNECTING} 1 -${NODE_LINK_STATE_CONNECTED} 2 +${NODE_LINK_STATE_CONNECTED} 1 ${NODE_CTL_START} 0 ${NODE_CTL_STOP} 1 diff --git a/include/neuron/define.h b/include/neuron/define.h index d939b79e..475de606 100644 --- a/include/neuron/define.h +++ b/include/neuron/define.h @@ -47,8 +47,7 @@ typedef enum { typedef enum { NEU_NODE_LINK_STATE_DISCONNECTED = 0, - NEU_NODE_LINK_STATE_CONNECTING = 1, - NEU_NODE_LINK_STATE_CONNECTED = 2, + NEU_NODE_LINK_STATE_CONNECTED = 1, } neu_node_link_state_e; typedef enum { diff --git a/plugins/modbus/modbus_tcp.c b/plugins/modbus/modbus_tcp.c index fbf6e01d..9ffffcd1 100644 --- a/plugins/modbus/modbus_tcp.c +++ b/plugins/modbus/modbus_tcp.c @@ -147,7 +147,7 @@ static int driver_config(neu_plugin_t *plugin, const char *config) plog_info(plugin, "config: host: %s, port: %" PRId64 ", timeout: %" PRId64, host.v.val_str, port.v.val_int, timeout.v.val_int); - plugin->common.link_state = NEU_NODE_LINK_STATE_CONNECTING; + plugin->common.link_state = NEU_NODE_LINK_STATE_DISCONNECTED; if (plugin->conn != NULL) { plugin->conn = neu_conn_reconfig(plugin->conn, ¶m); } else { diff --git a/plugins/mqtt/mqtt_plugin.c b/plugins/mqtt/mqtt_plugin.c index 6c940800..37aa40a9 100644 --- a/plugins/mqtt/mqtt_plugin.c +++ b/plugins/mqtt/mqtt_plugin.c @@ -415,7 +415,7 @@ static int plguin_start_running(neu_plugin_t *plugin) plugin->routine = routine; plugin->running = true; - plugin->common.link_state = NEU_NODE_LINK_STATE_CONNECTING; + plugin->common.link_state = NEU_NODE_LINK_STATE_DISCONNECTED; } return 0;