Exemplo n.º 1
0
        private void LogCapabilityDataFiveVoltPacket(ZigBeeCoordinatorContext ctx, ZigBeeDevice device, CapabilityDataFiveVoltPacket packet)
        {
            Capability capability = Capability.Finder.FindByIdOrDefault(ctx, packet.Capability);
            if (capability == null)
            {
                _log.Error("Could not find capability with id [" + packet.Capability + "]");
                return;
            }

            capability.ProcessData(ctx, device, packet.Data);
        }
Exemplo n.º 2
0
        public static FiveVoltPacket Decode(byte[] packetData)
        {
            if (packetData.Length < PacketTypeLength)
            {
                return(new InvalidFileVoltPacket("Invalid packet length. Expected at least [" + PacketTypeLength + "] found [" + packetData.Length + "]"));
            }

            switch (packetData[0])
            {
            case (byte)PacketType.Capability:
                return(CapabilityFiveVoltPacket.Decode(packetData));

            case (byte)PacketType.CapabilityData:
                return(CapabilityDataFiveVoltPacket.Decode(packetData));

            case (byte)PacketType.Message:
                return(MessageFiveVoltPacket.Decode(packetData));

            default:
                return(new InvalidFileVoltPacket("Unhandled packet type [" + Convert.ToString(packetData[0], 16) + "]"));
            }
        }