Skip to content

Commit

Permalink
Rename method to ncp_state_is_initializing_or_upgrading
Browse files Browse the repository at this point in the history
This commit updates the method name to include `or_upgrading()`.
  • Loading branch information
abtink committed Jul 17, 2019
1 parent c21f305 commit 01dbd89
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 26 deletions.
14 changes: 7 additions & 7 deletions src/connman-plugin/wpan-connman-plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions src/ncp-spinel/SpinelNCPInstance-Protothreads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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));
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/ncp-spinel/SpinelNCPTaskForm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

Expand Down
2 changes: 1 addition & 1 deletion src/ncp-spinel/SpinelNCPTaskGetMsgBufferCounters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

Expand Down
2 changes: 1 addition & 1 deletion src/ncp-spinel/SpinelNCPTaskGetNetworkTopology.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

Expand Down
2 changes: 1 addition & 1 deletion src/ncp-spinel/SpinelNCPTaskHostDidWake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

Expand Down
2 changes: 1 addition & 1 deletion src/ncp-spinel/SpinelNCPTaskJoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

Expand Down
4 changes: 2 additions & 2 deletions src/ncp-spinel/SpinelNCPTaskJoinerCommissioning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

Expand Down Expand Up @@ -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
);

Expand Down
6 changes: 3 additions & 3 deletions src/ncp-spinel/SpinelNCPTaskLeave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

Expand Down Expand Up @@ -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
);
Expand Down
2 changes: 1 addition & 1 deletion src/ncp-spinel/SpinelNCPTaskPeek.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

Expand Down
2 changes: 1 addition & 1 deletion src/ncp-spinel/SpinelNCPTaskScan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/ncp-spinel/SpinelNCPTaskWake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

Expand Down
2 changes: 1 addition & 1 deletion src/wpantund/NCPTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/wpantund/NCPTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion src/wpantund/NetworkRetain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 01dbd89

Please sign in to comment.