Exemplo n.º 1
0
 private LightChannel LightChannelTranslate(DP1024FChannel channel)
 {
     if (channel == DP1024FChannel.All)
     {
         return(LightChannel.CHAll);
     }
     else
     {
         return((LightChannel)(channel - 1));
     }
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 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;
     }
 }
Exemplo n.º 4
0
 public int GetLightValue(DP1024FChannel channel)
 {
     //string cmdContent = string.Format("4{0}000", (byte)channel);
     //sendCommand(getCombineCommand(cmdContent));
     return(this.LightInfoCollection[LightChannelTranslate(channel)].ActionValue);
 }