void emberAfPluginConcentratorPrintSourceRouteTable(void) { uint8_t i; // emberAfAppPrintln("Source Route Table\n"); // emberAfAppPrintln( "index dest closer older"); // for (i = 0; i < sourceRouteTableSize; i++) { // emberAfAppPrintln("%d: 0x%2X %d %d", // i, // sourceRouteTable[i].destination, // sourceRouteTable[i].closerIndex, // sourceRouteTable[i].olderIndex); // } emberAfAppPrintln("Source Routes"); for (i = 0; i < sourceRouteGetCount(); i++) { uint8_t closerIndex = sourceRouteTable[i].closerIndex; emberAfAppPrint("%d: 0x%2X -> ", i, sourceRouteTable[i].destination); while (closerIndex != NULL_INDEX) { emberAfAppPrint("0x%2X -> ", sourceRouteTable[closerIndex].destination); closerIndex = sourceRouteTable[closerIndex].closerIndex; } emberAfAppPrintln("0x%2X (Me)", emberAfGetNodeId()); } emberAfAppPrintln("%d of %d total entries.", sourceRouteGetCount(), sourceRouteTableSize); }
/** @brief Identify Cluster Identify Query Response * * * * @param timeout Ver.: always */ boolean emberAfIdentifyClusterIdentifyQueryResponseCallback(int16u timeout) { // TODO: !!! IMPORTANT !!! add handling for several responses // now the state machine might be broken as we use only one global variable // for storing incoming connection information like Short ID and endpoint // // ignore broadcasts from yourself and from devices that are not // in the identifying state const EmberAfClusterCommand *const current_cmd = emberAfCurrentCommand(); if (emberAfGetNodeId() != current_cmd->source && timeout != 0) { emberAfDebugPrintln("DEBUG: Got ID Query response"); emberAfDebugPrintln("DEBUG: Sender 0x%2X", emberAfCurrentCommand()->source); // Queue is empty, so we can start commissioning process // otherwise we push it in the queue and will process later if (GetQueueSize() == 0) { // ID Query received -> go to the discover state for getting clusters info emberAfDebugPrintln("DEBUG: QUEUE IS EMPTY"); SetNextState(SC_EZ_DISCOVER); SetNextEvent(SC_EZEV_CHECK_CLUSTERS); emberEventControlSetActive(StateMachineEvent); } // Store information about endpoint and short ID of the incoming response // for further processing in the Matching (SC_EZ_MATCH) state SetInConnBaseInfo(current_cmd->source, current_cmd->apsFrame->sourceEndpoint); emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS); } return TRUE; }
// plugin test-harness z3 beacon beacons-config <options:4> void emAfPluginTestHarnessZ3BeaconBeaconsConfigCommand(void) { EmberStatus status = EMBER_INVALID_CALL; #ifndef EZSP_HOST uint32_t options = emAfPluginTestHarnessZ3GetSignificantBit(0); uint8_t packet[32]; uint8_t *finger = packet; EmberMessageBuffer message; EmberNodeType nodeType; EmberNetworkParameters networkParameters; // Currently unused. (void)options; status = emberAfGetNetworkParameters(&nodeType, &networkParameters); if (status != EMBER_SUCCESS) { goto done; } // 802.15.4 header // frame control // beacon, no security, no frame pending // no ack required, no intra pan, no dst addr mode, short src dst addr mode *finger++ = 0x00; *finger++ = 0x80; // sequence (filled in by stack API) *finger++ = 0x00; // source pan id *finger++ = LOW_BYTE(emberAfGetPanId()); *finger++ = HIGH_BYTE(emberAfGetPanId()); // source address *finger++ = LOW_BYTE(emberAfGetNodeId()); *finger++ = HIGH_BYTE(emberAfGetNodeId()); // 802.15.4 beacon // superframe specification // beacon order n/a/, superframe order n/a/ // final CAP slot n/a, no battery ext, yes pan coord, yes permit join *finger++ = 0xFF; *finger++ = 0xCF; // guaranteed time slots n/a/ *finger++ = 0x00; // pending addresses n/a/ *finger++ = 0x00; // zigbee beacon // protocol id zigbee pro *finger++ = 0x00; // zigbee pro version *finger++ = 0x22; // yes router capacity, no depth, yes end device capacity *finger++ = 0x84; // ext pan id MEMMOVE(finger, networkParameters.extendedPanId, EXTENDED_PAN_ID_SIZE); finger += EXTENDED_PAN_ID_SIZE; // tx offset *finger++ = 0xFF; *finger++ = 0xFF; *finger++ = 0xFF; // network update id *finger++ = networkParameters.nwkUpdateId; message = emberFillLinkedBuffers(packet, finger - &packet[0]); status = (message == EMBER_NULL_MESSAGE_BUFFER ? EMBER_NO_BUFFERS : emberSendRawMessage(message)); emberReleaseMessageBuffer(message); #else goto done; // get rid of warnings #endif /* EZSP_HOST */ done: emberAfCorePrintln("%p: %p: 0x%X", TEST_HARNESS_Z3_PRINT_NAME, "Beacon", status); }
void emAfCliInfoCommand(void) { EmberNodeType nodeTypeResult = 0xFF; uint8_t commandLength; EmberEUI64 myEui64; EmberNetworkParameters networkParams; emberStringCommandArgument(-1, &commandLength); printMfgString(); emberAfAppPrintln("AppBuilder MFG Code: 0x%2X", EMBER_AF_MANUFACTURER_CODE); emberAfGetEui64(myEui64); emberAfGetNetworkParameters(&nodeTypeResult, &networkParams); emberAfAppPrint("node ["); emberAfAppDebugExec(emberAfPrintBigEndianEui64(myEui64)); emberAfAppFlush(); emberAfAppPrintln("] chan [%d] pwr [%d]", networkParams.radioChannel, networkParams.radioTxPower); emberAfAppPrint("panID [0x%2x] nodeID [0x%2x] ", networkParams.panId, emberAfGetNodeId()); emberAfAppFlush(); emberAfAppPrint("xpan [0x"); emberAfAppDebugExec(emberAfPrintBigEndianEui64(networkParams.extendedPanId)); emberAfAppPrintln("]"); emberAfAppFlush(); emAfCliVersionCommand(); emberAfAppFlush(); emberAfAppPrint("nodeType ["); if (nodeTypeResult != 0xFF) { emberAfAppPrint("0x%x", nodeTypeResult); } else { emberAfAppPrint("unknown"); } emberAfAppPrintln("]"); emberAfAppFlush(); emberAfAppPrintln("%p level [%x]", "Security", emberAfGetSecurityLevel()); printSmartEnergySecurityInfo(); printSmartEnergySecurityInfo283k1(); emberAfAppPrint("network state [%x] ", emberNetworkState()); printPacketBuffers(); emberAfAppFlush(); // print the endpoint information { uint8_t i, j; emberAfAppPrintln("Ep cnt: %d", emberAfEndpointCount()); // loop for each endpoint for (i = 0; i < emberAfEndpointCount(); i++) { EmberAfEndpointType *et = emAfEndpoints[i].endpointType; emberAfAppPrint("ep %d [endpoint %p, device %p] ", emberAfEndpointFromIndex(i), (emberAfEndpointIndexIsEnabled(i) ? "enabled" : "disabled"), emberAfIsDeviceEnabled(emberAfEndpointFromIndex(i)) ? "enabled" : "disabled"); emberAfAppPrintln("nwk [%d] profile [0x%2x] devId [0x%2x] ver [0x%x]", emberAfNetworkIndexFromEndpointIndex(i), emberAfProfileIdFromIndex(i), emberAfDeviceIdFromIndex(i), emberAfDeviceVersionFromIndex(i)); // loop for the clusters within the endpoint for (j = 0; j < et->clusterCount; j++) { EmberAfCluster *zc = &(et->cluster[j]); emberAfAppPrint(" %p cluster: 0x%2x ", (emberAfClusterIsClient(zc) ? "out(client)" : "in (server)" ), zc->clusterId); emberAfAppDebugExec(emberAfDecodeAndPrintCluster(zc->clusterId)); emberAfAppPrintln(""); emberAfAppFlush(); } emberAfAppFlush(); } } { PGM_P names[] = { EM_AF_GENERATED_NETWORK_STRINGS }; uint8_t i; emberAfAppPrintln("Nwk cnt: %d", EMBER_SUPPORTED_NETWORKS); for (i = 0; i < EMBER_SUPPORTED_NETWORKS; i++) { emberAfPushNetworkIndex(i); emberAfAppPrintln("nwk %d [%p]", i, names[i]); if (emAfProIsCurrentNetwork()) { emberAfAppPrintln(" nodeType [0x%x]", emAfCurrentZigbeeProNetwork->nodeType); emberAfAppPrintln(" securityProfile [0x%x]", emAfCurrentZigbeeProNetwork->securityProfile); } emberAfPopNetworkIndex(); } } }
void printInfo(void) { EmberNodeId nodeThatSentLeave; EmberRejoinReason rejoinReason = emberGetLastRejoinReason(); EmberLeaveReason leaveReason = emberGetLastLeaveReason(&nodeThatSentLeave); uint8_t index; EmberNodeId id = emberAfGetNodeId(); EmberNodeType type = EMBER_UNKNOWN_DEVICE; EmberNetworkParameters parameters; if (!emAfProIsCurrentNetwork()) { return; } emberAfGetNetworkParameters(&type, ¶meters); emberAfAppPrintln("Stack Profile: %d", emberAfGetStackProfile()); emberAfAppPrintln("Configured Node Type (%d): %p", emAfCurrentZigbeeProNetwork->nodeType, nodeTypeStrings[emAfCurrentZigbeeProNetwork->nodeType]); emberAfAppPrintln("Running Node Type (%d): %p\n", type, nodeTypeStrings[type]); emberAfAppPrintln("Channel: %d", parameters.radioChannel); emberAfAppPrintln("Node ID: 0x%2x", id); emberAfAppPrintln("PAN ID: 0x%2X", parameters.panId); emberAfAppPrint( "Extended PAN: "); emberAfPrintBigEndianEui64(parameters.extendedPanId); emberAfAppPrintln("\nNWK Update ID: %d\n", parameters.nwkUpdateId); emberAfAppPrintln("NWK Manager ID: 0x%2X", parameters.nwkManagerId); emberAfAppPrint( "NWK Manager Channels: "); emberAfPrintChannelListFromMask(parameters.channels); emberAfAppPrintln("\n"); emberAfAppPrintln("Send Multicasts to sleepies: %p\n", (emberAfGetSleepyMulticastConfig() ? "yes" : "no")); index = rejoinReason; if (rejoinReason >= EMBER_REJOIN_DUE_TO_APP_EVENT_5) { index = rejoinReason - EMBER_REJOIN_DUE_TO_APP_EVENT_5 + CUSTOM_APP_EVENTS_INDEX; } else if (rejoinReason >= EMBER_AF_REJOIN_FIRST_REASON && rejoinReason <= EMBER_AF_REJOIN_LAST_REASON) { index = rejoinReason - EMBER_AF_REJOIN_FIRST_REASON + APP_FRAMEWORK_REJOIN_REASON_INDEX; } else if (rejoinReason >= EMBER_REJOIN_DUE_TO_ZLL_TOUCHLINK) { index = UNKNOWN_REJOIN_REASON_INDEX; } emberAfAppPrintln("Last Rejoin Reason (%d): %p", rejoinReason, rejoinReasonStrings[index]); index = leaveReason; if (leaveReason == 0xFF) { index = APP_EVENT_1_LEAVE_REASON_INDEX; } else if (leaveReason > EMBER_LEAVE_DUE_TO_ZLL_TOUCHLINK) { index = UNKNOWN_LEAVE_REASON_INDEX; } emberAfAppPrintln("Last Leave Reason (%d): %p", leaveReason, leaveReasonStrings[index]); emberAfAppPrintln("Node that sent leave: 0x%2X", nodeThatSentLeave); }