public void testReceive() { ZToolPacket data = GetPacket("FE 07 45 83 00 00 00 00 00 10 C1 10"); ZigBeeApsFrame apsFrame = ZdoPowerDescriptor.Create(data); Assert.Equal(0x0000, apsFrame.SourceAddress); Assert.Equal(0, apsFrame.Profile); Assert.Equal(0, apsFrame.DestinationEndpoint); Assert.Equal(GetPacketData("00 00 00 00 10 C1"), apsFrame.Payload); }
public void ReceivedAsynchronousCommand(ZToolPacket packet) { switch (packet.Subsystem) { case ZToolPacket.CommandSubsystem.AF: return; case ZToolPacket.CommandSubsystem.ZDO: break; default: break; } ZigBeeApsFrame apsFrame = null; switch ((ZToolCMD)packet.CMD.Value) { case ZToolCMD.ZDO_MSG_CB_INCOMING: apsFrame = ZdoCallbackIncoming.Create(packet); break; case ZToolCMD.ZDO_IEEE_ADDR_RSP: apsFrame = ZdoIeeeAddress.Create(packet); break; case ZToolCMD.ZDO_END_DEVICE_ANNCE_IND: apsFrame = ZdoEndDeviceAnnounce.Create(packet); break; case ZToolCMD.ZDO_NODE_DESC_RSP: apsFrame = ZdoNodeDescriptor.Create(packet); break; case ZToolCMD.ZDO_POWER_DESC_RSP: apsFrame = ZdoPowerDescriptor.Create(packet); break; case ZToolCMD.ZDO_ACTIVE_EP_RSP: apsFrame = ZdoActiveEndpoint.Create(packet); break; case ZToolCMD.ZDO_SIMPLE_DESC_RSP: apsFrame = ZdoSimpleDescriptor.Create(packet); break; case ZToolCMD.ZDO_MGMT_LQI_RSP: apsFrame = ZdoManagementLqi.Create(packet); break; case ZToolCMD.ZDO_MGMT_RTG_RSP: apsFrame = ZdoManagementRouting.Create(packet); break; case ZToolCMD.ZDO_MGMT_LEAVE_RSP: apsFrame = ZdoManagementLeave.Create(packet); break; default: _logger.Debug($"Unhandled SerialPacket type {packet.CMD}"); break; } if (apsFrame != null) { _ZigBeeNetworkReceive.ReceiveCommand(apsFrame); return; } }