mirror of https://github.com/ARMmbed/mbed-os.git
[mbed-os-5.15] Mesh interface global up is indicated always on bootstrap ready
This indicates e.g. to client that IP address has changed or connection to network has been established.pull/13715/head
parent
f5633c4a04
commit
26a9079263
|
@ -161,6 +161,7 @@ void Nanostack::Interface::network_handler(mesh_connection_status_t status)
|
|||
}
|
||||
}
|
||||
|
||||
bool global_up = false;
|
||||
|
||||
if (status == MESH_CONNECTED) {
|
||||
uint8_t temp_ipv6_global[16];
|
||||
|
@ -171,6 +172,7 @@ void Nanostack::Interface::network_handler(mesh_connection_status_t status)
|
|||
if (arm_net_address_get(interface_id, ADDR_IPV6_GP, temp_ipv6_global) == 0
|
||||
&& (memcmp(temp_ipv6_global, temp_ipv6_local, 16) != 0)) {
|
||||
_connect_status = NSAPI_STATUS_GLOBAL_UP;
|
||||
global_up = true;
|
||||
}
|
||||
} else if (status == MESH_CONNECTED_LOCAL) {
|
||||
_connect_status = NSAPI_STATUS_LOCAL_UP;
|
||||
|
@ -182,9 +184,9 @@ void Nanostack::Interface::network_handler(mesh_connection_status_t status)
|
|||
_connect_status = NSAPI_STATUS_DISCONNECTED;
|
||||
}
|
||||
|
||||
if (_connection_status_cb && _previous_connection_status != _connect_status
|
||||
if (_connection_status_cb && (global_up || (_previous_connection_status != _connect_status
|
||||
&& (_previous_connection_status != NSAPI_STATUS_GLOBAL_UP || status != MESH_BOOTSTRAP_STARTED)
|
||||
&& (_previous_connection_status != NSAPI_STATUS_CONNECTING || status != MESH_BOOTSTRAP_START_FAILED)) {
|
||||
&& (_previous_connection_status != NSAPI_STATUS_CONNECTING || status != MESH_BOOTSTRAP_START_FAILED)))) {
|
||||
_connection_status_cb(NSAPI_EVENT_CONNECTION_STATUS_CHANGE, _connect_status);
|
||||
}
|
||||
_previous_connection_status = _connect_status;
|
||||
|
|
|
@ -176,11 +176,9 @@ static void wisun_tasklet_parse_network_event(arm_event_s *event)
|
|||
switch (status) {
|
||||
case ARM_NWK_BOOTSTRAP_READY:
|
||||
/* Network is ready and node is connected to Access Point */
|
||||
if (wisun_tasklet_data_ptr->tasklet_state != TASKLET_STATE_BOOTSTRAP_READY) {
|
||||
tr_info("Wi-SUN bootstrap ready");
|
||||
wisun_tasklet_data_ptr->tasklet_state = TASKLET_STATE_BOOTSTRAP_READY;
|
||||
wisun_tasklet_network_state_changed(MESH_CONNECTED);
|
||||
}
|
||||
break;
|
||||
case ARM_NWK_NWK_SCAN_FAIL:
|
||||
/* Link Layer Active Scan Fail, Stack is Already at Idle state */
|
||||
|
|
Loading…
Reference in New Issue