[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
Mika Leppänen 2020-10-05 13:26:56 +03:00
parent f5633c4a04
commit 26a9079263
2 changed files with 8 additions and 8 deletions

View File

@ -161,6 +161,7 @@ void Nanostack::Interface::network_handler(mesh_connection_status_t status)
} }
} }
bool global_up = false;
if (status == MESH_CONNECTED) { if (status == MESH_CONNECTED) {
uint8_t temp_ipv6_global[16]; 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 if (arm_net_address_get(interface_id, ADDR_IPV6_GP, temp_ipv6_global) == 0
&& (memcmp(temp_ipv6_global, temp_ipv6_local, 16) != 0)) { && (memcmp(temp_ipv6_global, temp_ipv6_local, 16) != 0)) {
_connect_status = NSAPI_STATUS_GLOBAL_UP; _connect_status = NSAPI_STATUS_GLOBAL_UP;
global_up = true;
} }
} else if (status == MESH_CONNECTED_LOCAL) { } else if (status == MESH_CONNECTED_LOCAL) {
_connect_status = NSAPI_STATUS_LOCAL_UP; _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; _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_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); _connection_status_cb(NSAPI_EVENT_CONNECTION_STATUS_CHANGE, _connect_status);
} }
_previous_connection_status = _connect_status; _previous_connection_status = _connect_status;

View File

@ -176,11 +176,9 @@ static void wisun_tasklet_parse_network_event(arm_event_s *event)
switch (status) { switch (status) {
case ARM_NWK_BOOTSTRAP_READY: case ARM_NWK_BOOTSTRAP_READY:
/* Network is ready and node is connected to Access Point */ /* 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");
tr_info("Wi-SUN bootstrap ready"); wisun_tasklet_data_ptr->tasklet_state = TASKLET_STATE_BOOTSTRAP_READY;
wisun_tasklet_data_ptr->tasklet_state = TASKLET_STATE_BOOTSTRAP_READY; wisun_tasklet_network_state_changed(MESH_CONNECTED);
wisun_tasklet_network_state_changed(MESH_CONNECTED);
}
break; break;
case ARM_NWK_NWK_SCAN_FAIL: case ARM_NWK_NWK_SCAN_FAIL:
/* Link Layer Active Scan Fail, Stack is Already at Idle state */ /* Link Layer Active Scan Fail, Stack is Already at Idle state */