Example #1
0
 public void SwitchLight(CobraSlimChannel channel, bool lightSwitch)
 {
     if (!this.IsInitialized)
     {
         return;
     }
     if (channel == CobraSlimChannel.All)
     {
         foreach (var item in this.LightInfoCollection)
         {
             SwitchLight(item.Key, lightSwitch);
         }
     }
     else
     {
         string cmdContent = string.Format("GSS={0}", lightSwitch ? 1 : 0);
         if (SendReceive(cmdContent))
         {
             this.LightInfoCollection[LightChannelTranslate(channel)].Switch = lightSwitch;
         }
         //if (SendReceive(cmdContent) && this.ResponseString == "1")
         //{
         //    this.LightInfoCollection[LightChannelTranslate(channel)].Switch = lightSwitch;
         //}
         //else
         //{
         //    OnErrorRaised(-1, ExceptionHelper.GetFullCurrentMethod(this.ErrorMessage + "(" + DeviceName + ")"));
         //}
     }
 }
Example #2
0
        public void SetLightValue(CobraSlimChannel channel, int lightValue)
        {
            if (!this.IsInitialized)
            {
                return;
            }
            string cmdContent = string.Format("GLI={0}", lightValue);

            if (SendReceive(cmdContent))
            {
                this.LightInfoCollection[LightChannelTranslate(channel)].ActionValue = lightValue;
            }
            //if (SendReceive(cmdContent) && this.ResponseString == "1")
            //{
            //    this.LightInfoCollection[LightChannelTranslate(channel)].ActionValue = lightValue;
            //    //OnLightValueChanged(channel, lightValue);
            //}
            //else
            //{
            //    OnErrorRaised(-1, ExceptionHelper.GetFullCurrentMethod(this.ErrorMessage + "(" + DeviceName + ")"));
            //}
        }
Example #3
0
 private LightChannel LightChannelTranslate(CobraSlimChannel channel)
 {
     return((LightChannel)channel);
 }
Example #4
0
 public int GetLightValue(CobraSlimChannel channel)
 {
     return(this.LightInfoCollection[LightChannelTranslate(channel)].ActionValue);
 }