Exemplo n.º 1
0
        private bool OpenConnection()
        {
            CloseConnection();

            CoolerMasterSDK.SetControlDevice(_data.DeviceType);

            // Detect if device is connected
            if (!CoolerMasterSDK.IsDevicePlug())
            {
                return(false);
            }

            // Try to enable control of keyboard/mouse
            if (!CoolerMasterSDK.EnableLedControl(true))
            {
                return(false);
            }
            _connected = true;

            // reset the last values. That means that *any* values that come in will be 'new', and be sent out.
            _lastValues   = new Dictionary <int, byte>();
            _nullCommands = new Dictionary <int, int>();
            _setupDataBuffers();

            _timeoutStopwatch.Reset();
            _timeoutStopwatch.Start();

            return(true);
        }
Exemplo n.º 2
0
 private void CloseConnection()
 {
     CoolerMasterSDK.EnableLedControl(false);
     _connected = false;
 }