public void SwitchLight(PD3Channel channel, bool lightSwitch) { if (!this.IsInitialized) { return; } string cmdContent = string.Format("{0:X}L{1}", channel, lightSwitch ? 1 : 0); sendCommand(getCombineCommand(cmdContent)); if (channel == PD3Channel.All) { foreach (var item in this.LightInfoCollection) { item.Value.Switch = lightSwitch; } } else { this.LightInfoCollection[LightChannelTranslate(channel)].Switch = lightSwitch; } }
public void SetLightValue(PD3Channel channel, int lightValue) { if (!this.IsInitialized) { return; } string cmdContent = string.Format("{0:X}F{1:D3}", channel, lightValue); sendCommand(getCombineCommand(cmdContent)); if (channel == PD3Channel.All) { foreach (var item in this.LightInfoCollection) { item.Value.ActionValue = lightValue; } } else { this.LightInfoCollection[LightChannelTranslate(channel)].ActionValue = lightValue; } //OnLightValueChanged(channel, lightValue); }
public void CheckStatus(PD3Channel channel) { string cmdContent = string.Format("{0:X}M00", channel); sendCommand(getCombineCommand(cmdContent)); }
public int GetLightValue(PD3Channel channel) { return(this.LightInfoCollection[LightChannelTranslate(channel)].ActionValue); }
private LightChannel LightChannelTranslate(PD3Channel channel) { return((LightChannel)channel); }