Example #1
0
        public static LifxRequest Create(ILifxHub hub, LifxPacket packet)
        {
            switch (packet.Info.PacketType)
            {
                case LifxPacketType.GetStateService:
                    return new LifxServiceStateRequest(packet);

                case LifxPacketType.GetWiFiFirmwareState:
                    return new LifxWiFiFirmwareRequest(packet);

                case LifxPacketType.GetMeshFirmwareState:
                    return new LifxMeshFirmwareRequest(packet);

                case LifxPacketType.GetVersion:
                    return new LifxVersionRequest(packet);

                case LifxPacketType.GetLightState:
                    return new LifxLightStateRequest(packet);

                case LifxPacketType.SetLightState:

                    return new LifxLightStateRequest(packet);

                default:
                    return null;
                // throw new ArgumentOutOfRangeException("Protocol");
            }
        }
Example #2
0
 public static LifxRequest Create(ILifxHub hub, byte[] data)
 {
     return Create(hub, LifxPacket.Parse(data));
 }