예제 #1
0
        public override bool Initialize()
        {
            if (isInitialized)
            {
                return(true);
            }

            device_key     = GlobalVarRegistry.GetVariable <DeviceKeys>($"{DeviceName}_devicekey");
            enable_generic = GlobalVarRegistry.GetVariable <bool>($"{DeviceName}_enable_generic");
            enable_ryos    = GlobalVarRegistry.GetVariable <bool>($"{DeviceName}_enable_ryos");

            talkFx     = new TalkFxConnection();
            ryosTalkFx = new RyosTalkFXConnection();

            //Will return true even when no Ryos is connected. Check if TalkFx is opened?
            //Is even requierd for 1 color devices with the used sdk version.
            if (!ryosTalkFx.Initialize())
            {
                LogInfo("Could not initialize Ryos Talk Fx");
                return(isInitialized = false);
            }

            //Will return true even when no Ryos is connected. Check if TalkFx is opened?
            //Is even requierd for 1 color devices with the used sdk version.
            if (!ryosTalkFx.EnterSdkMode())
            {
                LogInfo("Could not Enter Ryos SDK Mode");
                return(isInitialized = false);
            }

            return(isInitialized = true);
        }
예제 #2
0
        public override bool UpdateDevice(Dictionary <DeviceKeys, System.Drawing.Color> keyColors, DoWorkEventArgs e, bool forced = false)
        {
            if (!isInitialized)
            {
                return(false);
            }

            try
            {
                foreach (var key in keyColors)
                {
                    if (WootingMapping.KeyMap.TryGetValue(key.Key, out var wootKey))
                    {
                        var clr = CorrectAlpha(key.Value);
                        RGBControl.SetKey(wootKey, (byte)(clr.R * GlobalVarRegistry.GetVariable <int>($"{DeviceName}_scalar_r") / 100),
                                          (byte)(clr.G * GlobalVarRegistry.GetVariable <int>($"{DeviceName}_scalar_g") / 100),
                                          (byte)(clr.B * GlobalVarRegistry.GetVariable <int>($"{DeviceName}_scalar_b") / 100));
                    }
                }

                return(RGBControl.UpdateKeyboard());
            }
            catch (Exception exc)
            {
                LogError("Failed to update device" + exc.ToString());
                return(false);
            }
        }
예제 #3
0
        public override void Shutdown()
        {
            //Shutdown 1 color devices.
            var restoreColor = ToRoccatColor(GlobalVarRegistry.GetVariable <RealColor>($"{DeviceName}_restore_fallback"));

            talkFx?.SetLedRgb(Zone.Event, KeyEffect.On, Speed.Fast, restoreColor); //Workaround because "RestoreLedRgb()" doesn't seam to work.
            talkFx?.RestoreLedRgb();
            talkFx?.Dispose();

            //Shutdown per key keyboards.
            ryosTalkFx?.ExitSdkMode();
            ryosTalkFx?.Dispose();

            isInitialized = false;
        }
예제 #4
0
        public override void Shutdown()
        {
            if (!isInitialized)
            {
                return;
            }

            foreach (var dev in Devices)
            {
                dev.Disconnect(GlobalVarRegistry.GetVariable <bool>($"{DeviceName}_disconnect_when_stop"));
            }

            DS4Devices.stopControllers();
            Devices.Clear();
            isInitialized = false;
        }
예제 #5
0
        public override bool Initialize()
        {
            if (isInitialized)
            {
                return(true);
            }

            key = GlobalVarRegistry.GetVariable <DeviceKeys>($"{DeviceName}_devicekey");
            DS4Devices.findControllers();
            var controllers = DS4Devices.getDS4Controllers();

            foreach (var controller in controllers)
            {
                Devices.Add(new DS4Container(controller));
            }

            return(isInitialized = Devices.Any());
        }
예제 #6
0
        public override bool Initialize()
        {
            if (GlobalVarRegistry.GetVariable <bool>($"{DeviceName}_override"))
            {
                LogitechGSDK.GHUB = GlobalVarRegistry.GetVariable <DLLType>($"{DeviceName}_dlltype") == DLLType.GHUB;
            }
            else
            {
                LogitechGSDK.GHUB = Directory.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "LGHUB"));
            }

            LogInfo("Trying to initialize Logitech using the dll for " + (LogitechGSDK.GHUB ? "GHUB" : "LGS"));

            if (LogitechGSDK.LogiLedInit() && LogitechGSDK.LogiLedSaveCurrentLighting())
            {
                LogitechGSDK.LogiLedSetLighting(GlobalVarRegistry.GetVariable <RealColor>($"{DeviceName}_color").GetDrawingColor());
                return(isInitialized = true);
            }

            return(isInitialized = false);
        }