diff --git a/src/connman-plugin/wpan-connman-plugin.c b/src/connman-plugin/wpan-connman-plugin.c index a29c207b..8bdea4cd 100644 --- a/src/connman-plugin/wpan-connman-plugin.c +++ b/src/connman-plugin/wpan-connman-plugin.c @@ -115,7 +115,7 @@ struct lowpan_network_s { static bool -ncp_state_is_initializing(ncp_state_t ncp_state) +ncp_state_is_initializing_or_upgrading(ncp_state_t ncp_state) { switch (ncp_state) { case NCP_STATE_UNINITIALIZED: @@ -1558,7 +1558,7 @@ lowpan_device_handle_state_change( lowpan_device_set_network(device, network); network = device_info->current_network; - if (ncp_state_is_initializing(new_state)) { + if (ncp_state_is_initializing_or_upgrading(new_state)) { return 0; } @@ -1718,7 +1718,7 @@ lowpan_device_signal_handler( goto bail; } - if (ncp_state_is_initializing(device_info->ncp_state)) { + if (ncp_state_is_initializing_or_upgrading(device_info->ncp_state)) { // Make sure that we start up in a powered state. should_change_device_power_state = true; new_device_power_state = true; @@ -1785,7 +1785,7 @@ lowpan_device_signal_handler( DBG("NCP IS %s",enabled?"ENABLED":"DISABLED"); if (enabled != device_power_state) { - if (ncp_state_is_initializing(device_info->ncp_state)) { + if (ncp_state_is_initializing_or_upgrading(device_info->ncp_state)) { // If this connman_device is uninitialized/initializing, then we need to make // sure that the NCP is in our current power state. enabled = !enabled; @@ -1909,7 +1909,7 @@ status_finished_callback( iter = outer_iter; } - if (ncp_state_is_initializing(device_info->ncp_state)) { + if (ncp_state_is_initializing_or_upgrading(device_info->ncp_state)) { // Make sure that we start up in a powered state. should_change_device_power_state = true; new_device_power_state = true; @@ -1996,7 +1996,7 @@ status_finished_callback( DBG("NCP IS %s",enabled?"ENABLED":"DISABLED"); if (enabled != device_power_state) { - if (ncp_state_is_initializing(device_info->ncp_state)) { + if (ncp_state_is_initializing_or_upgrading(device_info->ncp_state)) { // If this connman_device is UNinitialized, then we need to make // sure that the NCP is in our current power state. enabled = !enabled; @@ -2229,7 +2229,7 @@ lowpan_device_scan(enum connman_service_type type, require_action(device_info->ncp_state != NCP_STATE_ASSOCIATING, bail, status = -EBUSY); require_action(device_info->ncp_state != NCP_STATE_COMMISSIONED, bail, status = -EBUSY); - require_action(!ncp_state_is_initializing(device_info->ncp_state), bail, status = -EBUSY); + require_action(!ncp_state_is_initializing_or_upgrading(device_info->ncp_state), bail, status = -EBUSY); asprintf(&dbus_path, "%s/%s", diff --git a/src/ncp-spinel/SpinelNCPInstance-Protothreads.cpp b/src/ncp-spinel/SpinelNCPInstance-Protothreads.cpp index 978a3e1e..101a74c8 100644 --- a/src/ncp-spinel/SpinelNCPInstance-Protothreads.cpp +++ b/src/ncp-spinel/SpinelNCPInstance-Protothreads.cpp @@ -81,7 +81,7 @@ SpinelNCPInstance::vprocess_disabled(int event, va_list args) // If we didn't enter deep sleep then we need to bail early. if ((get_ncp_state() != DEEP_SLEEP) && (get_ncp_state() != FAULT)) { - if (!ncp_state_is_initializing(get_ncp_state())) { + if (!ncp_state_is_initializing_or_upgrading(get_ncp_state())) { get_control_interface().reset(); } EH_EXIT(); @@ -593,7 +593,7 @@ SpinelNCPInstance::vprocess_event(int event, va_list args) // If we are commissioned and autoResume is enabled if (mAutoResume && mEnabled && mIsCommissioned - && !ncp_state_is_joining_or_joined(get_ncp_state()) && !ncp_state_is_initializing(get_ncp_state()) + && !ncp_state_is_joining_or_joined(get_ncp_state()) && !ncp_state_is_initializing_or_upgrading(get_ncp_state()) ) { syslog(LOG_NOTICE, "AutoResume is enabled. Trying to resume."); EH_SPAWN(&mSubPT, vprocess_resume(event, args)); @@ -604,7 +604,7 @@ SpinelNCPInstance::vprocess_event(int event, va_list args) // us from entering any endless loops. EH_SLEEP_FOR(0); - if (ncp_state_is_initializing(get_ncp_state())) { + if (ncp_state_is_initializing_or_upgrading(get_ncp_state())) { EH_RESTART(); } else if (!mEnabled) { diff --git a/src/ncp-spinel/SpinelNCPTaskForm.cpp b/src/ncp-spinel/SpinelNCPTaskForm.cpp index 74e58c1f..6cfe4ab7 100644 --- a/src/ncp-spinel/SpinelNCPTaskForm.cpp +++ b/src/ncp-spinel/SpinelNCPTaskForm.cpp @@ -130,7 +130,7 @@ nl::wpantund::SpinelNCPTaskForm::vprocess_event(int event, va_list args) // Wait for a bit to see if the NCP will enter the right state. EH_REQUIRE_WITHIN( NCP_DEFAULT_COMMAND_RESPONSE_TIMEOUT, - !ncp_state_is_initializing(mInstance->get_ncp_state()), + !ncp_state_is_initializing_or_upgrading(mInstance->get_ncp_state()), on_error ); diff --git a/src/ncp-spinel/SpinelNCPTaskGetMsgBufferCounters.cpp b/src/ncp-spinel/SpinelNCPTaskGetMsgBufferCounters.cpp index 896a6e6b..f127ed9b 100644 --- a/src/ncp-spinel/SpinelNCPTaskGetMsgBufferCounters.cpp +++ b/src/ncp-spinel/SpinelNCPTaskGetMsgBufferCounters.cpp @@ -66,7 +66,7 @@ nl::wpantund::SpinelNCPTaskGetMsgBufferCounters::vprocess_event(int event, va_li // Wait for a bit to see if the NCP will enter the right state. EH_REQUIRE_WITHIN( NCP_DEFAULT_COMMAND_RESPONSE_TIMEOUT, - !ncp_state_is_initializing(mInstance->get_ncp_state()), + !ncp_state_is_initializing_or_upgrading(mInstance->get_ncp_state()), on_error ); diff --git a/src/ncp-spinel/SpinelNCPTaskGetNetworkTopology.cpp b/src/ncp-spinel/SpinelNCPTaskGetNetworkTopology.cpp index 56e3d691..b70f421d 100644 --- a/src/ncp-spinel/SpinelNCPTaskGetNetworkTopology.cpp +++ b/src/ncp-spinel/SpinelNCPTaskGetNetworkTopology.cpp @@ -487,7 +487,7 @@ nl::wpantund::SpinelNCPTaskGetNetworkTopology::vprocess_event(int event, va_list // Wait for a bit to see if the NCP will enter the right state. EH_REQUIRE_WITHIN( NCP_DEFAULT_COMMAND_RESPONSE_TIMEOUT, - !ncp_state_is_initializing(mInstance->get_ncp_state()), + !ncp_state_is_initializing_or_upgrading(mInstance->get_ncp_state()), on_error ); diff --git a/src/ncp-spinel/SpinelNCPTaskHostDidWake.cpp b/src/ncp-spinel/SpinelNCPTaskHostDidWake.cpp index e714cc75..ba29500b 100644 --- a/src/ncp-spinel/SpinelNCPTaskHostDidWake.cpp +++ b/src/ncp-spinel/SpinelNCPTaskHostDidWake.cpp @@ -59,7 +59,7 @@ nl::wpantund::SpinelNCPTaskHostDidWake::vprocess_event(int event, va_list args) // Wait for a bit to see if the NCP will enter the right state. EH_REQUIRE_WITHIN( NCP_DEFAULT_COMMAND_RESPONSE_TIMEOUT, - !ncp_state_is_initializing(mInstance->get_ncp_state()), + !ncp_state_is_initializing_or_upgrading(mInstance->get_ncp_state()), on_error ); diff --git a/src/ncp-spinel/SpinelNCPTaskJoin.cpp b/src/ncp-spinel/SpinelNCPTaskJoin.cpp index 5d5afe2e..6aeb6204 100644 --- a/src/ncp-spinel/SpinelNCPTaskJoin.cpp +++ b/src/ncp-spinel/SpinelNCPTaskJoin.cpp @@ -75,7 +75,7 @@ nl::wpantund::SpinelNCPTaskJoin::vprocess_event(int event, va_list args) // Wait for a bit to see if the NCP will enter the right state. EH_REQUIRE_WITHIN( NCP_DEFAULT_COMMAND_RESPONSE_TIMEOUT, - !ncp_state_is_initializing(mInstance->get_ncp_state()), + !ncp_state_is_initializing_or_upgrading(mInstance->get_ncp_state()), on_error ); diff --git a/src/ncp-spinel/SpinelNCPTaskJoinerCommissioning.cpp b/src/ncp-spinel/SpinelNCPTaskJoinerCommissioning.cpp index ae120dfd..6aed1316 100644 --- a/src/ncp-spinel/SpinelNCPTaskJoinerCommissioning.cpp +++ b/src/ncp-spinel/SpinelNCPTaskJoinerCommissioning.cpp @@ -110,7 +110,7 @@ nl::wpantund::SpinelNCPTaskJoinerCommissioning::vprocess_event(int event, va_lis // Wait for a bit to see if the NCP will enter the right state. EH_REQUIRE_WITHIN( NCP_DEFAULT_COMMAND_RESPONSE_TIMEOUT, - !ncp_state_is_initializing(mInstance->get_ncp_state()), + !ncp_state_is_initializing_or_upgrading(mInstance->get_ncp_state()), on_error ); @@ -295,7 +295,7 @@ nl::wpantund::SpinelNCPTaskJoinerAttach::vprocess_event(int event, va_list args) // Wait for a bit to see if the NCP will enter the right state. EH_REQUIRE_WITHIN( NCP_DEFAULT_COMMAND_RESPONSE_TIMEOUT, - !ncp_state_is_initializing(mInstance->get_ncp_state()), + !ncp_state_is_initializing_or_upgrading(mInstance->get_ncp_state()), on_error ); diff --git a/src/ncp-spinel/SpinelNCPTaskLeave.cpp b/src/ncp-spinel/SpinelNCPTaskLeave.cpp index c168c35c..f367a99e 100644 --- a/src/ncp-spinel/SpinelNCPTaskLeave.cpp +++ b/src/ncp-spinel/SpinelNCPTaskLeave.cpp @@ -60,7 +60,7 @@ nl::wpantund::SpinelNCPTaskLeave::vprocess_event(int event, va_list args) // Wait for a bit to see if the NCP will enter the right state. EH_REQUIRE_WITHIN( NCP_DEFAULT_COMMAND_RESPONSE_TIMEOUT, - !ncp_state_is_initializing(mInstance->get_ncp_state()), + !ncp_state_is_initializing_or_upgrading(mInstance->get_ncp_state()), on_error ); @@ -111,14 +111,14 @@ nl::wpantund::SpinelNCPTaskLeave::vprocess_event(int event, va_list args) // Wait for re-initialization of NCP to start. EH_REQUIRE_WITHIN( NCP_DEFAULT_COMMAND_RESPONSE_TIMEOUT, - ncp_state_is_initializing(mInstance->get_ncp_state()), + ncp_state_is_initializing_or_upgrading(mInstance->get_ncp_state()), on_error ); // Wait for re-initialization to complete. EH_REQUIRE_WITHIN( NCP_DEFAULT_COMMAND_RESPONSE_TIMEOUT, - !ncp_state_is_initializing(mInstance->get_ncp_state()) && + !ncp_state_is_initializing_or_upgrading(mInstance->get_ncp_state()) && (mInstance->mDriverState == SpinelNCPInstance::NORMAL_OPERATION), on_error ); diff --git a/src/ncp-spinel/SpinelNCPTaskPeek.cpp b/src/ncp-spinel/SpinelNCPTaskPeek.cpp index 4e31bca9..dc9cbbab 100644 --- a/src/ncp-spinel/SpinelNCPTaskPeek.cpp +++ b/src/ncp-spinel/SpinelNCPTaskPeek.cpp @@ -62,7 +62,7 @@ nl::wpantund::SpinelNCPTaskPeek::vprocess_event(int event, va_list args) // Wait for a bit to see if the NCP will enter the right state. EH_REQUIRE_WITHIN( NCP_DEFAULT_COMMAND_RESPONSE_TIMEOUT, - !ncp_state_is_initializing(mInstance->get_ncp_state()), + !ncp_state_is_initializing_or_upgrading(mInstance->get_ncp_state()), on_error ); diff --git a/src/ncp-spinel/SpinelNCPTaskScan.cpp b/src/ncp-spinel/SpinelNCPTaskScan.cpp index 68451470..9abbdcff 100644 --- a/src/ncp-spinel/SpinelNCPTaskScan.cpp +++ b/src/ncp-spinel/SpinelNCPTaskScan.cpp @@ -81,7 +81,7 @@ nl::wpantund::SpinelNCPTaskScan::vprocess_event(int event, va_list args) // Wait for a bit to see if the NCP will enter the right state. EH_REQUIRE_WITHIN( NCP_DEFAULT_COMMAND_RESPONSE_TIMEOUT, - !ncp_state_is_initializing(mInstance->get_ncp_state()) + !ncp_state_is_initializing_or_upgrading(mInstance->get_ncp_state()) && (mInstance->get_ncp_state() != ASSOCIATING) && (mInstance->get_ncp_state() != CREDENTIALS_NEEDED), on_error diff --git a/src/ncp-spinel/SpinelNCPTaskWake.cpp b/src/ncp-spinel/SpinelNCPTaskWake.cpp index e9e2befd..86a3d305 100644 --- a/src/ncp-spinel/SpinelNCPTaskWake.cpp +++ b/src/ncp-spinel/SpinelNCPTaskWake.cpp @@ -84,7 +84,7 @@ nl::wpantund::SpinelNCPTaskWake::vprocess_event(int event, va_list args) EH_REQUIRE_WITHIN( NCP_DEFAULT_COMMAND_RESPONSE_TIMEOUT, !ncp_state_is_sleeping(mInstance->get_ncp_state()) - && (!ncp_state_is_initializing(mInstance->get_ncp_state())), + && (!ncp_state_is_initializing_or_upgrading(mInstance->get_ncp_state())), on_error ); diff --git a/src/wpantund/NCPTypes.cpp b/src/wpantund/NCPTypes.cpp index cd35c320..130b6d51 100644 --- a/src/wpantund/NCPTypes.cpp +++ b/src/wpantund/NCPTypes.cpp @@ -104,7 +104,7 @@ nl::wpantund::ncp_state_is_commissioned(NCPState x) } bool -nl::wpantund::ncp_state_is_initializing(NCPState x) +nl::wpantund::ncp_state_is_initializing_or_upgrading(NCPState x) { switch(x) { case UNINITIALIZED: diff --git a/src/wpantund/NCPTypes.h b/src/wpantund/NCPTypes.h index 098c061c..f6c7a656 100644 --- a/src/wpantund/NCPTypes.h +++ b/src/wpantund/NCPTypes.h @@ -89,7 +89,7 @@ bool ncp_state_is_interface_up(NCPState x); bool ncp_state_is_detached_from_ncp(NCPState x); -bool ncp_state_is_initializing(NCPState x); +bool ncp_state_is_initializing_or_upgrading(NCPState x); bool ncp_state_is_associated(NCPState x); diff --git a/src/wpantund/NetworkRetain.cpp b/src/wpantund/NetworkRetain.cpp index 1b50e1d7..85a4368c 100644 --- a/src/wpantund/NetworkRetain.cpp +++ b/src/wpantund/NetworkRetain.cpp @@ -65,7 +65,7 @@ NetworkRetain::handle_ncp_state_change(NCPState new_ncp_state, NCPState old_ncp_ } // Initializing --> Offline - else if (ncp_state_is_initializing(old_ncp_state) && (new_ncp_state == OFFLINE)) { + else if (ncp_state_is_initializing_or_upgrading(old_ncp_state) && (new_ncp_state == OFFLINE)) { recall_network_info(); }