示例#1
0
        public static void TemporarySwitchOn(this MTRFXXAdapter adapter, byte channel, UInt16 interval)
        {
            byte b1     = (byte)interval;
            byte b2     = (byte)(interval >> 8);
            var  format = b2 == 0
                ? MTRFXXDataFormat.TemporarySwitchOnOneByte
                : MTRFXXDataFormat.TemporarySwitchOnTwoBytes;

            SendData(adapter, MTRFXXCommand.TemporarySwitchOn, false, channel, null, format, b1, b2);
        }
示例#2
0
 public static void BindStart(this MTRFXXAdapter adapter, byte channel)
 {
     adapter.SendCommand(MTRFXXMode.RX, MTRFXXAction.StartBinding, channel, MTRFXXCommand.None);
 }
示例#3
0
        private static void SendData(MTRFXXAdapter adapter, MTRFXXCommand command, bool useFMode, byte channel, UInt32?deviceId, MTRFXXDataFormat format, params byte[] data)
        {
            var ma = GetModeAndAction(useFMode, deviceId);

            adapter.SendCommand(ma.Item1, ma.Item2, channel, command, MTRFXXRepeatCount.NoRepeat, format, data, deviceId ?? 0);
        }
示例#4
0
 public static void SetBrightnessF(this MTRFXXAdapter adapter, byte channel, byte brightness, UInt32?deviceId = null)
 {
     SendData(adapter, MTRFXXCommand.SetBrightness, true, channel, deviceId, MTRFXXDataFormat.OneByteData, brightness);
 }
示例#5
0
 public static void SwitchF(this MTRFXXAdapter adapter, byte channel, UInt32?deviceId = null)
 {
     Send(adapter, MTRFXXCommand.Switch, true, channel, deviceId);
 }
示例#6
0
 public static void Off(this MTRFXXAdapter adapter, byte channel)
 {
     Send(adapter, MTRFXXCommand.Off, false, channel);
 }
示例#7
0
 public static void ReadState(this MTRFXXAdapter adapter, byte channel)
 {
     throw new NotSupportedException("Not supported in basic mode.");
 }
示例#8
0
 public static void ClearAllChannels(this MTRFXXAdapter adapter)
 {
     adapter.SendCommand(MTRFXXMode.RX, MTRFXXAction.ClearAllChannels, 0, MTRFXXCommand.None,
                         MTRFXXRepeatCount.NoRepeat, MTRFXXDataFormat.NoData, new byte[] { 170, 85, 170, 85 });
 }
示例#9
0
 public static void SwitchColorChangingF(this MTRFXXAdapter adapter, byte channel, UInt32?deviceId = null)
 {
     SendData(adapter, MTRFXXCommand.SwitchColorChanging, true, channel, deviceId, MTRFXXDataFormat.LED);
 }
示例#10
0
 public static void SwitchColorChanging(this MTRFXXAdapter adapter, byte channel)
 {
     SendData(adapter, MTRFXXCommand.SwitchColorChanging, false, channel, null, MTRFXXDataFormat.LED);
 }
示例#11
0
 public static void SetLedColorF(this MTRFXXAdapter adapter, byte channel, byte valueR, byte valueG, byte valueB, UInt32?deviceId = null)
 {
     SendData(adapter, MTRFXXCommand.SetBrightness, true, channel, deviceId, MTRFXXDataFormat.FourByteData, valueR, valueG, valueB);
 }
示例#12
0
 public static void SetLedColor(this MTRFXXAdapter adapter, byte channel, byte valueR, byte valueG, byte valueB)
 {
     SendData(adapter, MTRFXXCommand.SetBrightness, false, channel, null, MTRFXXDataFormat.FourByteData, valueR, valueG, valueB);
 }
示例#13
0
 public static void LoadPresetF(this MTRFXXAdapter adapter, byte channel, UInt32?deviceId = null)
 {
     Send(adapter, MTRFXXCommand.LoadPreset, true, channel, deviceId);
 }
示例#14
0
 public static void LoadPreset(this MTRFXXAdapter adapter, byte channel)
 {
     Send(adapter, MTRFXXCommand.LoadPreset, false, channel);
 }
示例#15
0
 public static void BindStop(this MTRFXXAdapter adapter)
 {
     adapter.SendCommand(MTRFXXMode.RX, MTRFXXAction.StopBinding, 0, MTRFXXCommand.None);
 }
示例#16
0
 public static void ClearChannel(this MTRFXXAdapter adapter, byte channel)
 {
     adapter.SendCommand(MTRFXXMode.RX, MTRFXXAction.ClearChannel, channel, MTRFXXCommand.None);
 }
示例#17
0
        private static void Send(MTRFXXAdapter adapter, MTRFXXCommand command, bool useFMode, byte channel = 0, UInt32?deviceId = null)
        {
            var ma = GetModeAndAction(useFMode, deviceId);

            adapter.SendCommand(ma.Item1, ma.Item2, channel, command, target: deviceId ?? 0);
        }
示例#18
0
 public static void ExitServiceMode(this MTRFXXAdapter adapter)
 {
     adapter.SendCommand(MTRFXXMode.Service, MTRFXXAction.SendCommand, 0, MTRFXXCommand.None);
 }
示例#19
0
 public static void ChangeLedColorSpeed(this MTRFXXAdapter adapter, byte channel)
 {
     SendData(adapter, MTRFXXCommand.ChangeColorSpeed, false, channel, null, MTRFXXDataFormat.LED);
 }
示例#20
0
 public static void ReadStateF(this MTRFXXAdapter adapter, byte channel, UInt32?deviceId = null)
 {
     SendReadState(adapter, channel);
 }
示例#21
0
 public static void ChangeLedColorSpeedF(this MTRFXXAdapter adapter, byte channel, UInt32?deviceId = null)
 {
     SendData(adapter, MTRFXXCommand.ChangeColorSpeed, true, channel, deviceId, MTRFXXDataFormat.LED);
 }
示例#22
0
 public static void Switch(this MTRFXXAdapter adapter, byte channel)
 {
     Send(adapter, MTRFXXCommand.Switch, false, channel);
 }
示例#23
0
 public static void UnbindF(this MTRFXXAdapter adapter, byte channel)
 {
     Send(adapter, MTRFXXCommand.Unbind, true, channel);
 }
示例#24
0
 private static void SendReadState(this MTRFXXAdapter adapter, byte channel)
 {
     adapter.SendCommand(MTRFXXMode.TXF, MTRFXXAction.SendCommand, channel, MTRFXXCommand.ReadState);
 }
示例#25
0
 public static void SetBrightness(this MTRFXXAdapter adapter, byte channel, byte brightness)
 {
     SendData(adapter, MTRFXXCommand.SetBrightness, false, channel, null, MTRFXXDataFormat.OneByteData, brightness);
 }