Ejemplo n.º 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");
            }
        }
Ejemplo n.º 2
0
        public static LifxPacket Parse(byte[] data)
        {
            var result = new LifxPacket();

            if (result.TryParse(data))
            {
                return result;
            }

            return null;
        }
Ejemplo n.º 3
0
 protected LifxRequest(LifxPacket packet)
 {
     this.Packet = packet;
 }
Ejemplo n.º 4
0
 public LifxPowerStateRequest(LifxPacket packet)
     : base(packet)
 {
     this.power = BitHelper.ReadUInt16(this.Packet.Payload, 0);
 }
Ejemplo n.º 5
0
 public LifxMeshFirmwareRequest(LifxPacket packet)
     : base(packet)
 {
 }
Ejemplo n.º 6
0
 public LifxLightStateRequest(LifxPacket packet)
     : base(packet)
 {
     this.color = LifxHsbkColor.FromBytes(this.Packet.Payload, 1);
     this.Duration = BitHelper.ReadUInt16(this.Packet.Payload, 1 + LifxHsbkColor.Size);
 }
Ejemplo n.º 7
0
 public LifxVersionRequest(LifxPacket packet)
     : base(packet)
 {
 }
Ejemplo n.º 8
0
 public LifxServiceStateRequest(LifxPacket packet)
     : base(packet)
 {
 }