Esempio n. 1
0
        public void SendLedCommand(int ledCommand, int channel, int levelR = 0, int levelG = 0, int levelB = 0)
        {
            //Debugger.Launch();

            lock (pcLock)
            {
                try
                {
                    using (var adapter = new PC11XXAdapter())
                    {
                        if (adapter.OpenDevice())
                        {
                            var pc11XxLedCommand = (PC11XXLedCommand)ledCommand;
                            adapter.SendLedCommand(pc11XxLedCommand, (byte)channel, (byte)levelR, (byte)levelG, (byte)levelB);
                            Logger.Info("send command {0}: levelR {1} levelG {2} levelB{3} in channel {4}", pc11XxLedCommand, levelR, levelG, levelB, channel);
                        }
                        else
                        {
                            Logger.Error("Can not connect to the device");
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.ErrorException(ex.Message, ex);
                }
            }
        }
Esempio n. 2
0
 public void SendCommand(int command, int channel, int level = 0)
 {
     lock (pcLock)
     {
         try
         {
             using (var adapter = new PC11XXAdapter())
             {
                 if (adapter.OpenDevice())
                 {
                     var pc11XxCommand = (PC11XXCommand)command;
                     adapter.SendCommand(pc11XxCommand, (byte)channel, (byte)level);
                     Logger.Info("send command {0}: level {1} in channel {2}", pc11XxCommand, level, channel);
                 }
                 else
                 {
                     Logger.Error("Can not connect to the device");
                 }
             }
         }
         catch (Exception ex)
         {
             Logger.ErrorException(ex.Message, ex);
         }
     }
 }
Esempio n. 3
0
        public void SendCommand(int command, int channel, int level)
        {
            //Debugger.Launch();

            lock (pcLock)
            {
                try
                {
                    using (var adapter = new PC11XXAdapter())
                    {
                        if (adapter.OpenDevice())
                        {
                            var pc11XxCommand = (PC11XXCommand)command;
                            adapter.SendCommand(pc11XxCommand, (byte)channel, (byte)level);
                            Logger.Info("send command {0}: level {1} in channel {2}", pc11XxCommand, level, channel);
                        }
                        else
                        {
                            Logger.Error("Can not connect to the device");
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.ErrorException(ex.Message, ex);
                }
            }
        }
Esempio n. 4
0
 public void SetLevel(byte channel, byte level)
 {
     try
     {
         using (var adapter = new PC11XXAdapter())
         {
             if (adapter.OpenDevice())
             {
                 adapter.SendCommand(PC11XXCommand.SetLevel, channel, level);
                 Logger.Info("set level {0} in channel {1}", level, channel);
             }
             else
             {
                 Logger.Error("Can not connect to the device");
             }
         }
     }
     catch (Exception ex)
     {
         Logger.ErrorException(ex.Message, ex);
     }
 }
Esempio n. 5
0
 public void SetLevel(byte channel, byte level)
 {
     try
     {
         using (var adapter = new PC11XXAdapter())
         {
             if (adapter.OpenDevice())
             {
                 adapter.SendCommand(PC11XXCommand.SetLevel, channel, level);
                 Logger.Info("set level {0} in channel {1}", level, channel);
             }
             else
             {
                 Logger.Error("Can not connect to the device");
             }
         }
     }
     catch (Exception ex)
     {
         Logger.ErrorException(ex.Message, ex);
     }
 }
Esempio n. 6
0
 public void SendLedCommand(int ledCommand, int channel, int levelR = 0, int levelG = 0, int levelB = 0)
 {
     lock (pcLock)
     {
         try
         {
             using (var adapter = new PC11XXAdapter())
             {
                 if (adapter.OpenDevice())
                 {
                     var pc11XxLedCommand = (PC11XXLedCommand)ledCommand;
                     adapter.SendLedCommand(pc11XxLedCommand, (byte)channel, (byte)levelR, (byte)levelG, (byte)levelB);
                     Logger.Info("send command {0}: levelR {1} levelG {2} levelB {3} in channel {4}", pc11XxLedCommand, levelR, levelG, levelB, channel);
                 }
                 else
                 {
                     Logger.Error("Can not connect to the device");
                 }
             }
         }
         catch (Exception ex)
         {
             Logger.ErrorException(ex.Message, ex);
         }
     }
 }