private void LogCapabilityFiveVoltPacket(ZigBeeCoordinatorContext ctx, ZigBeeDevice device, CapabilityFiveVoltPacket capabilityFiveVoltPacket) { Capability capability = Capability.Finder.FindByIdOrDefault(ctx, capabilityFiveVoltPacket.Capability); if (capability == null) { _log.Error("Could not find capability with id [" + capabilityFiveVoltPacket.Capability + "]"); return; } _log.Info("New capability found [" + capability.Name + "] at address [" + device.DeviceAddressString + "]"); device.Capabilities.Add(capability); }
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) + "]")); } }