Ejemplo n.º 1
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);
                }
            }
        }
Ejemplo n.º 2
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);
                }
            }
        }
Ejemplo n.º 3
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);
     }
 }
Ejemplo 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);
     }
 }