static CommissioningState_t CheckClusters(void) { emberAfDebugPrintln("DEBUG: Check Clusters handler"); // ask a responded device for providing with info about clusters and call // the callback MatchDescriptorReq_t *in_dev = GetTopInDeviceDescriptor(); assert(in_dev != NULL); emberAfDebugPrintln("DEBUG: short ID 0x%2X", in_dev->source); emberAfDebugPrintln("DEBUG: ep 0x%X", in_dev->source_ep); EmberStatus status = emberAfFindClustersByDeviceAndEndpoint( in_dev->source, in_dev->source_ep, ProcessServiceDiscovery); // Nothing to do here with states as the next event will become clear // during the ProcessServiceDiscovery callback call SetNextEvent(SC_EZEV_UNKNOWN); return (status != EMBER_SUCCESS) ? SC_EZ_UNKNOWN : SC_EZ_DISCOVER; }
static void sendSimpleDescriptorRequest(const EmberAfDeviceInfo* device) { uint8_t endpoint = emberAfPluginDeviceDatabaseGetDeviceEndpointFromIndex(device->eui64, currentEndpointIndex); if (endpoint == 0xFF) { emberAfCorePrintln("%p All endpoints discovered for 0x%2X", PLUGIN_NAME, currentNodeId); emberAfPluginDeviceDatabaseSetStatus(device->eui64, EMBER_AF_DEVICE_DISCOVERY_STATUS_DONE); scheduleEvent(WITH_DELAY); clearCurrentDevice(); return; } debugPrintln("%p initiating simple descriptor request for: 0x%2X EP %d", PLUGIN_NAME, currentNodeId, endpoint); EmberStatus status = emberAfFindClustersByDeviceAndEndpoint(currentNodeId, endpoint, serviceDiscoveryCallback); if (status != EMBER_SUCCESS) { noteFailedDiscovery(device); scheduleEvent(WITH_DELAY); return; } // Don't schedule event, since service discovery returns the results via callback. }