private LightChannel LightChannelTranslate(DPA6024Channel channel) { if (channel == DPA6024Channel.All) { return(LightChannel.CHAll); } else { return((LightChannel)(channel - 1)); } }
public void SetLightValue(DPA6024Channel channel, int lightValue) { if (!this.IsInitialized) { return; } string cmdContent = string.Format("3{0}0{1}", (byte)channel, lightValue.ToString("X2"));//.PadLeft(2, '0')); sendCommand(getCombineCommand(cmdContent)); this.LightInfoCollection[LightChannelTranslate(channel)].ActionValue = lightValue; //OnLightValueChanged(channel, lightValue); }
public void SetLightValue(DPA6024Channel channel, int lightValue) { if (!this.IsInitialized) { return; } List <byte> cmdContent = new List <byte>() { 1, (byte)channel, 0, (byte)lightValue }; sendCommand(getCombineCommand(cmdContent)); this.LightInfoCollection[LightChannelTranslate(channel)].ActionValue = lightValue; //OnLightValueChanged(channel, lightValue); }
public void SwitchLight(DPA6024Channel channel, bool lightSwitch) { if (!this.IsInitialized) { return; } if (channel == DPA6024Channel.All) { foreach (var item in this.LightInfoCollection) { SwitchLight(item.Key, lightSwitch); } } else { string cmdContent = string.Format("{0}{1}000", lightSwitch ? 1 : 2, (byte)channel); sendCommand(getCombineCommand(cmdContent)); this.LightInfoCollection[LightChannelTranslate(channel)].Switch = lightSwitch; } }
public void SwitchLight(DPA6024Channel channel, bool lightSwitch) { if (!this.IsInitialized) { return; } if (channel == DPA6024Channel.All) { foreach (var item in this.LightInfoCollection) { SwitchLight(item.Key, lightSwitch); } } else { List <byte> cmdContent = new List <byte>() { 5, (byte)channel, 0, (byte)(lightSwitch ? 1 : 0) }; sendCommand(getCombineCommand(cmdContent)); this.LightInfoCollection[LightChannelTranslate(channel)].Switch = lightSwitch; } }
public int GetLightValue(DPA6024Channel channel) { //string cmdContent = string.Format("4{0}000", (byte)channel); //sendCommand(getCombineCommand(cmdContent)); return(this.LightInfoCollection[LightChannelTranslate(channel)].ActionValue); }