Example #1
0
        public bool UniversalSwitch(int switchId, Channel.State switchState)
        {
            if (switchId == 0)
            {
                throw new InvalidOperationException("SwitchId not set");
            }
            if (switchId < 1 || switchId > 255)
            {
                throw new InvalidOperationException($"Invalid SwitchId {switchId}");
            }

            var additionalContent = new byte[2];

            additionalContent[0] = (byte)switchId;
            additionalContent[1] = (byte)switchState;

            OperationCode = OperationCode.UniversalSwitchControl;

            var data = new Command
            {
                AdditionalContent = additionalContent,
                OperationCode     = OperationCode.UniversalSwitchControl,
                SourceAddress     = Controller.SourceAddress,
                SourceDeviceType  = Controller.SourceDeviceType,
                TargetAddress     = DeviceAddress
            };

            var result = Controller.WriteBus(data);

            return(result);
        }
Example #2
0
        public bool SingleChannelControl(int channel, Channel.State channelState)
        {
            var intensity = 0;

            if (channelState == Enums.Channel.State.On)
            {
                intensity = 100;
            }
            return(SingleChannelControl(channel, intensity, 0));
        }
Example #3
0
 public bool SingleChannelControl(Channel.State channelState)
 {
     return(SingleChannelControl(Channel, channelState));
 }