Skip to content

Commit

Permalink
[spinel] handle new spinel net role DISABLED (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
Irving-cl authored Jan 9, 2024
1 parent d6b2b9e commit 8b5ce64
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ncp-spinel/SpinelNCPInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5767,6 +5767,7 @@ SpinelNCPInstance::handle_ncp_spinel_value_is(spinel_prop_key_t key, const uint8

if (ncp_state_is_joining_or_joined(get_ncp_state())
&& (value != SPINEL_NET_ROLE_DETACHED)
&& (value != SPINEL_NET_ROLE_DISABLED)
) {
change_ncp_state(ASSOCIATED);
}
Expand All @@ -5784,7 +5785,7 @@ SpinelNCPInstance::handle_ncp_spinel_value_is(spinel_prop_key_t key, const uint8
} else if (value == SPINEL_NET_ROLE_LEADER) {
update_node_type(LEADER);

} else if (value == SPINEL_NET_ROLE_DETACHED) {
} else if (value == SPINEL_NET_ROLE_DETACHED || value == SPINEL_NET_ROLE_DISABLED) {
update_node_type(UNKNOWN);
if (ncp_state_is_associated(get_ncp_state())) {
change_ncp_state(ISOLATED);
Expand Down
2 changes: 2 additions & 0 deletions third_party/openthread/src/ncp/spinel.h
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ typedef enum
SPINEL_NET_ROLE_CHILD = 1,
SPINEL_NET_ROLE_ROUTER = 2,
SPINEL_NET_ROLE_LEADER = 3,
SPINEL_NET_ROLE_DISABLED = 4,
} spinel_net_role_t;

typedef enum
Expand Down Expand Up @@ -2090,6 +2091,7 @@ enum
* SPINEL_NET_ROLE_CHILD = 1,
* SPINEL_NET_ROLE_ROUTER = 2,
* SPINEL_NET_ROLE_LEADER = 3,
* SPINEL_NET_ROLE_DISABLED = 4,
*
*/
SPINEL_PROP_NET_ROLE = SPINEL_PROP_NET__BEGIN + 3,
Expand Down

0 comments on commit 8b5ce64

Please sign in to comment.