コード例 #1
0
 /// <summary>
 /// Stop the IR Server plugin.
 /// </summary>
 public override void Stop()
 {
     if (_server != null)
     {
         _server.CommandEvent -= CommandHandler;
         _server = null;
     }
 }
コード例 #2
0
        /// <summary>
        /// Start the IR Server plugin.
        /// </summary>
        public override void Start()
        {
            LoadSettings();

            if (_startServer && !WinLircServer.StartServer(_serverPath))
            {
                throw new InvalidOperationException("Failed to start server");
            }

            _server = new WinLircServer(_serverIP, _serverPort, TimeSpan.FromMilliseconds(_buttonReleaseTime), _repeatDelay);
            _server.CommandEvent += CommandHandler;
        }
コード例 #3
0
        /// <summary>
        /// Detect the presence of this device.
        /// </summary>
        public override DetectionResult Detect()
        {
            try
            {
                if (WinLircServer.IsServerRunning())
                {
                    return(DetectionResult.DevicePresent);
                }
            }
            catch (Exception ex)
            {
                IrssLog.Error("{0,15}: exception {1}", Name, ex.Message);
                return(DetectionResult.DeviceException);
            }

            return(DetectionResult.DeviceNotFound);
        }