Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leave network if the device type changed #26

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions MLight/mods/device-nwk-join-control.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,26 @@ void emberAfPluginNetworkSteeringCompleteCallback(EmberStatus status,
*/
EmberNetworkStatus dnjcInit(void)
{
tokTypeStackNodeData networkData;

if ( ! dnjcState.isInitialized ) {
dnjcState.isInitialized = true;

memset(&networkData, 0xFF, sizeof(networkData));
halCommonGetToken(&networkData, TOKEN_STACK_NODE_DATA);
sl_zigbee_app_debug_println(
"Network token node type: 0x%02x, Firmware note type: 0x%02x",
networkData.nodeType,
SLI_ZIGBEE_PRIMARY_NETWORK_DEVICE_TYPE
);
if ( networkData.nodeType && networkData.nodeType
!= SLI_ZIGBEE_PRIMARY_NETWORK_DEVICE_TYPE
&& networkData.nodeType < SLI_ZIGBEE_NETWORK_DEVICE_TYPE_END_DEVICE
&& SLI_ZIGBEE_PRIMARY_NETWORK_DEVICE_TYPE < SLI_ZIGBEE_NETWORK_DEVICE_TYPE_END_DEVICE ) {
// nodeType is set, so it is joined the network.
// Check if we need to leave the network: stay only if SED or ED
_post_indicate_leaving_nwk();
}
sl_zigbee_event_init(&dnjcState.dnjcEvent, _event_handler);
sl_zigbee_event_set_delay_ms(&dnjcState.dnjcEvent, DNJC_STARTUP_STATUS_DELAY_MS);
dnjcState.smPostTransition = _event_state_indicate_startup_nwk;
Expand Down
Loading