/*! State Machine function */ void emberAfPluginSimpleCommissioningInitiatorStateMachineEventHandler(void) { emberEventControlSetInactive(StateMachineEvent); // That might happened that ZigBee state machine changed current network // So, it is important to switch to the proper network before commissioning // state machine might start EmberStatus status = emberAfPushNetworkIndex(dev_comm_session.network_index); if (status != EMBER_SUCCESS) { // TODO: Handle unavailability of switching network } emberAfDebugPrintln("DEBUG: State Machine"); // Get state previously set by some handler CommissioningState_t cur_state = GetNextState(); CommissioningEvent_t cur_event = GetNextEvent(); for (size_t i = 0; i < TRANSIT_TABLE_SIZE(); ++i) { if ((cur_state == sm_transition_table[i].state || SC_EZ_UNKNOWN == sm_transition_table[i].state) && ((cur_event == sm_transition_table[i].event) || SC_EZEV_UNKNOWN == sm_transition_table[i].event)) { // call handler which set the next_state on return and // next_event inside itself SetNextState((sm_transition_table[i].handler)()); break; } } // Don't forget to pop Network Index status = emberAfPopNetworkIndex(); // sanity check that network switched back properly EMBER_TEST_ASSERT(status == EMBER_SUCCESS); }
static void noteFailedDiscovery(const EmberAfDeviceInfo* device) { emberAfPluginDeviceDatabaseSetStatus(device->eui64, EMBER_AF_DEVICE_DISCOVERY_STATUS_FAILED); EMBER_TEST_ASSERT(0 == MEMCOMPARE(device->eui64, currentEui64, EUI64_SIZE)); clearCurrentDevice(); }
static inline void SkipRemoteCluster(const uint16_t pos) { EMBER_TEST_ASSERT(pos < skip_mask->len); // just clean the appropriate bit skip_mask.skip_clusters &= ~(1 << pos); }