From d9448364da4c0db10743532a32197044588b95c4 Mon Sep 17 00:00:00 2001 From: Kari Haapalehto Date: Thu, 7 Mar 2019 10:18:13 +0200 Subject: [PATCH] Correct thread status callback functionality. At the start-up, there was 2 NSAPI_STATUS_CONNECTING callbacks, so extra one removed from ThreadInterface.cpp. At the network lost case, there was NSAPI_STATUS_DISCONNECTED and NSAPI_STATUS_LOCAL_UP callbacks. NSAPI_STATUS_DISCONNECTED has been removed, since the NSAPI_STATUS_LOCAL_UP is enought. --- features/nanostack/mbed-mesh-api/source/ThreadInterface.cpp | 3 --- features/nanostack/mbed-mesh-api/source/thread_tasklet.c | 5 +---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/features/nanostack/mbed-mesh-api/source/ThreadInterface.cpp b/features/nanostack/mbed-mesh-api/source/ThreadInterface.cpp index 9f7bec8239..9495e2f18f 100644 --- a/features/nanostack/mbed-mesh-api/source/ThreadInterface.cpp +++ b/features/nanostack/mbed-mesh-api/source/ThreadInterface.cpp @@ -147,9 +147,6 @@ nsapi_error_t Nanostack::ThreadInterface::bringup(bool dhcp, const char *ip, // -end devices will get connectivity once attached to existing network // -devices without network settings gets connectivity once commissioned and attached to network _connect_status = NSAPI_STATUS_CONNECTING; - if (_connection_status_cb) { - _connection_status_cb(NSAPI_EVENT_CONNECTION_STATUS_CHANGE, NSAPI_STATUS_CONNECTING); - } if (_blocking) { int32_t count = connect_semaphore.wait(osWaitForever); diff --git a/features/nanostack/mbed-mesh-api/source/thread_tasklet.c b/features/nanostack/mbed-mesh-api/source/thread_tasklet.c index 9fe37ab92d..39ac735c07 100644 --- a/features/nanostack/mbed-mesh-api/source/thread_tasklet.c +++ b/features/nanostack/mbed-mesh-api/source/thread_tasklet.c @@ -245,10 +245,7 @@ void thread_tasklet_poll_network_status(void *param) } } } else { - if (thread_tasklet_data_ptr->connection_status != MESH_DISCONNECTED && - thread_tasklet_data_ptr->connection_status != MESH_BOOTSTRAP_STARTED) { - thread_tasklet_network_state_changed(MESH_DISCONNECTED); - } + thread_tasklet_data_ptr->connection_status = MESH_DISCONNECTED; } }