private LightChannel LightChannelTranslate(DP1024FChannel channel) { if (channel == DP1024FChannel.All) { return(LightChannel.CHAll); } else { return((LightChannel)(channel - 1)); } }
public void SetLightValue(DP1024FChannel 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 SwitchLight(DP1024FChannel channel, bool lightSwitch) { if (!this.IsInitialized) { return; } if (channel == DP1024FChannel.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 int GetLightValue(DP1024FChannel channel) { //string cmdContent = string.Format("4{0}000", (byte)channel); //sendCommand(getCombineCommand(cmdContent)); return(this.LightInfoCollection[LightChannelTranslate(channel)].ActionValue); }