The following steps show you how to intercept ZDO leave request in EmberZnet.
1. Enable Packet Handoff plugin.
2. Use emberAfIncomingPacketFilterCallback in project callbacks.
3. Add the following code to intercept ZDO leave request.
uint8_t* cmd;
EmberPacketAction emberAfIncomingPacketFilterCallback(EmberZigbeePacketType packetType, uint8_t* packetData, uint8_t* size_p, void* data)
{
if(packetType == EMBER_ZIGBEE_PACKET_TYPE_ZDO){
emberAfZdoPrintln("Receive EMBER_ZIGBEE_PACKET_TYPE_ZDO");
emberAfZdoPrintBuffer(data,sizeof(data), true);
cmd=(uint8_t*)data;
if((cmd[2])==0x34 && (cmd[3])==0x00)
emberAfZdoPrintln("-----------Receive ZDO Leave Request------------------------");
}
return EMBER_ACCEPT_PACKET;
}
No comments:
Post a Comment