Beispiel #1
0
        /// <summary>
        /// Start the IR Server plugin.
        /// </summary>
        /// <returns>true if successful, otherwise false.</returns>
        public override void Start()
        {
            _config = new Config();
            ConfigManagement.LoadSettings(ref _config);

            RegisterDeviceNotification();
            StartListener();
        }
Beispiel #2
0
        /// <summary>
        /// Configure the IR Server plugin.
        /// </summary>
        public void Configure(IWin32Window owner)
        {
            _config = new Config();
            ConfigManagement.LoadSettings(ref _config);

            ConfigurationDialog configDialog = new ConfigurationDialog();

            configDialog.LearnTimeout       = _config.LearnTimeout;
            configDialog.DisableMceServices = _config._disableMceServices;

            configDialog.EnableRemote            = _config.EnableRemoteInput;
            configDialog.UseSystemRatesForRemote = _config.UseSystemRatesRemote;
            configDialog.RemoteRepeatDelay       = _config.RemoteFirstRepeat;
            configDialog.RemoteHeldDelay         = _config.RemoteHeldRepeats;
            configDialog.DisableAutomaticButtons = _config._disableAutomaticButtons;

            configDialog.EnableKeyboard            = _config.EnableKeyboardInput;
            configDialog.UseSystemRatesForKeyboard = _config.UseSystemRatesKeyboard;
            configDialog.KeyboardRepeatDelay       = _config.KeyboardFirstRepeat;
            configDialog.KeyboardHeldDelay         = _config.KeyboardHeldRepeats;
            configDialog.HandleKeyboardLocal       = _config.HandleKeyboardLocally;
            configDialog.UseQwertzLayout           = _config.UseQwertzLayout;

            configDialog.EnableMouse      = _config.EnableMouseInput;
            configDialog.HandleMouseLocal = _config.HandleMouseLocally;
            configDialog.MouseSensitivity = _config.MouseSensitivity;

            if (configDialog.ShowDialog(owner) == DialogResult.OK)
            {
                _config.LearnTimeout        = configDialog.LearnTimeout;
                _config._disableMceServices = configDialog.DisableMceServices;

                _config.EnableRemoteInput        = configDialog.EnableRemote;
                _config.UseSystemRatesRemote     = configDialog.UseSystemRatesForRemote;
                _config.RemoteFirstRepeat        = configDialog.RemoteRepeatDelay;
                _config.RemoteHeldRepeats        = configDialog.RemoteHeldDelay;
                _config._disableAutomaticButtons = configDialog.DisableAutomaticButtons;

                _config.EnableKeyboardInput    = configDialog.EnableKeyboard;
                _config.UseSystemRatesKeyboard = configDialog.UseSystemRatesForKeyboard;
                _config.KeyboardFirstRepeat    = configDialog.KeyboardRepeatDelay;
                _config.KeyboardHeldRepeats    = configDialog.KeyboardHeldDelay;
                _config.HandleKeyboardLocally  = configDialog.HandleKeyboardLocal;

                _config.EnableMouseInput   = configDialog.EnableMouse;
                _config.HandleMouseLocally = configDialog.HandleMouseLocal;
                _config.MouseSensitivity   = configDialog.MouseSensitivity;

                ConfigManagement.SaveSettings(_config);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Start the receiver.
        /// </summary>
        private void Start_Receiver()
        {
            Debug.Open("Philips MCE USB IR Receiver- Spinel plus.log");
            Debug.WriteLine("Start_Receiver()");
            _config = new Config();
            ConfigManagement.LoadSettings(ref _config);

            _firstRepeatDelay = _config.FirstRepeatDelay;
            _heldRepeatDelay  = _config.HeldRepeatDelay;

            if (_config.UseSystemRatesDelay)
            {
                _firstRepeatDelay = 250 + (SystemInformation.KeyboardDelay * 250);
                _heldRepeatDelay  = (int)(1000.0 / (2.5 + (SystemInformation.KeyboardSpeed * 0.888)));
            }

            // create receiver Window
            _receiverWindow          = new ReceiverWindow("Philips MCE USB IR Receiver- Spinel plus Receiver");
            _receiverWindow.ProcMsg += ProcMessage;

            // collect devices
            _deviceList = new List <RawInput.RAWINPUTDEVICE>();
            RawInput.RAWINPUTDEVICE _device;

            foreach (Device device in supportedDevices)
            {
                foreach (DeviceDetails details in device.DeviceDetails)
                {
                    _device             = new RawInput.RAWINPUTDEVICE();
                    _device.usUsage     = details.Usage;
                    _device.usUsagePage = details.UsagePage;
                    _device.dwFlags     = RawInput.RawInputDeviceFlags.InputSink;
                    _device.hwndTarget  = _receiverWindow.Handle;
                    _deviceList.Add(_device);
                }
            }

            if (!RegisterForRawInput(_deviceList.ToArray()))
            {
                Debug.WriteLine("ERROR: Failed to register for HID Raw input");
                throw new InvalidOperationException("Failed to register for HID Raw input");
            }

            Debug.WriteLine("Start_Receiver(): completed");
        }
Beispiel #4
0
        /// <summary>
        /// Configure the IR Server plugin.
        /// </summary>
        public void Configure(IWin32Window owner)
        {
            _config = new Config();
            ConfigManagement.LoadSettings(ref _config);

            InitDeviceList();

            ConfigurationDialog configDialog = new ConfigurationDialog(_deviceList);

            configDialog.DeviceGuid = _config.DeviceGUID;
            configDialog.AxisLimit  = _config.AxisLimit;

            if (configDialog.ShowDialog(owner) == DialogResult.OK)
            {
                if (!String.IsNullOrEmpty(configDialog.DeviceGuid))
                {
                    _config.DeviceGUID = configDialog.DeviceGuid;
                    _config.AxisLimit  = configDialog.AxisLimit;

                    ConfigManagement.SaveSettings(_config);
                }
            }
        }
Beispiel #5
0
        /// <summary>
        /// Configure the IR Server plugin.
        /// </summary>
        public void Configure(IWin32Window owner)
        {
            Debug.WriteLine("Configure()");
            _config = new Config();
            ConfigManagement.LoadSettings(ref _config);

            ConfigurationDialog configDialog = new ConfigurationDialog();

            configDialog.DoRepeats           = _config.DoRepeats;
            configDialog.UseSystemRatesDelay = _config.UseSystemRatesDelay;
            configDialog.FirstRepeatDelay    = _config.FirstRepeatDelay;
            configDialog.HeldRepeatDelay     = _config.HeldRepeatDelay;

            if (configDialog.ShowDialog(owner) == DialogResult.OK)
            {
                _config.DoRepeats           = configDialog.DoRepeats;
                _config.UseSystemRatesDelay = configDialog.UseSystemRatesDelay;
                _config.FirstRepeatDelay    = configDialog.FirstRepeatDelay;
                _config.HeldRepeatDelay     = configDialog.HeldRepeatDelay;

                ConfigManagement.SaveSettings(_config);
            }
            Debug.WriteLine("Configure(): Completed");
        }
Beispiel #6
0
        /// <summary>
        /// Start the IR Server plugin.
        /// </summary>
        /// <returns><c>true</c> if successful, otherwise <c>false</c>.</returns>
        public override void Start()
        {
#if TRACE
            Trace.WriteLine("Start MicrosoftMceTransceiver");
#endif

            if (_driver != null)
            {
                throw new InvalidOperationException("MicrosoftMceTransceiver already started");
            }

            _config = new Config();
            ConfigManagement.LoadSettings(ref _config);

            // Put this in a try...catch so that if the registry keys don't exist we don't throw an ugly exception.
            try
            {
                _ignoreAutomaticButtons = CheckAutomaticButtons();
            }
            catch
            {
                _ignoreAutomaticButtons = false;
            }

            if (_config._disableMceServices)
            {
                DisableMceServices();
            }

            Guid   deviceGuid;
            string devicePath;

            Driver newDriver = null;

            if (FindDevice(out deviceGuid, out devicePath))
            {
                if (deviceGuid == MicrosoftGuid)
                {
                    if (Environment.OSVersion.Version.Major >= VistaVersionNumber)
                    {
                        newDriver = new DriverVista(deviceGuid, devicePath, RemoteEvent, KeyboardEvent, MouseEvent);
                    }
                    else
                    {
                        newDriver = new DriverXP(deviceGuid, devicePath, RemoteEvent, KeyboardEvent, MouseEvent);
                    }
                }
                else
                {
                    newDriver = new DriverReplacement(deviceGuid, devicePath, RemoteEvent, KeyboardEvent, MouseEvent);
                }
            }
            else
            {
                throw new InvalidOperationException("Device not found");
            }

            newDriver.Start();

            _driver = newDriver;
        }