Merge pull request #13666 from mikaleppanen/mesh_global_up

[feature-wisun] Mesh interface global up is indicated always on bootstrap ready
pull/13716/head
Martin Kojtal 2020-09-30 11:31:35 +01:00 committed by GitHub
commit c1ed1987b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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) {
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
&& (_previous_connection_status != NSAPI_STATUS_GLOBAL_UP || status != MESH_BOOTSTRAP_STARTED)
&& (_previous_connection_status != NSAPI_STATUS_CONNECTING || status != MESH_BOOTSTRAP_START_FAILED)) {
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)))) {
_connection_status_cb(NSAPI_EVENT_CONNECTION_STATUS_CHANGE, _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) {
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);
}
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 */