예제 #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);
                }
            }
        }
예제 #2
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);
                }
            }
        }