Nanostack network handle does not always call status cb for BOOTSTRAP events

UBLOX_EVK_ODIN_W2 advertises more events than we expect.
1) When disconnecting first network connectivity is lost and then an
actual disconnection event arrives. The first one is unexpected.
2) When reconnecting MESH_BOOTSTRAP_START_FAILED shows up, but the board
eventually manages to connect
pull/10434/head
Michal Paszta 2019-04-17 18:58:02 +03:00
parent 0b7d9af4dd
commit 8d1edc7db8
1 changed files with 3 additions and 2 deletions

View File

@ -149,8 +149,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 && _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;