From 8d1edc7db8dfc58f2cd35d3fe12b9acc36e871f9 Mon Sep 17 00:00:00 2001 From: Michal Paszta Date: Wed, 17 Apr 2019 18:58:02 +0300 Subject: [PATCH] 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 --- .../mbed-mesh-api/source/MeshInterfaceNanostack.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/features/nanostack/mbed-mesh-api/source/MeshInterfaceNanostack.cpp b/features/nanostack/mbed-mesh-api/source/MeshInterfaceNanostack.cpp index a89d9c8b93..d4e0c55bae 100644 --- a/features/nanostack/mbed-mesh-api/source/MeshInterfaceNanostack.cpp +++ b/features/nanostack/mbed-mesh-api/source/MeshInterfaceNanostack.cpp @@ -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;