static void Main(string[] args)
 {
     while (true)
     {
         Thread.Sleep(2000);
         LogitechGSDK.LogiSteeringInitialize(true);
         for (int i = 0; i < 1000000; i++)
         {
             //All the test functions are called on the first device plugged in(index = 0)
             LogitechGSDK.LogiSteeringInitialize(true);
             if (LogitechGSDK.LogiUpdate() && LogitechGSDK.LogiIsConnected(0))
             {
                 if (LogitechGSDK.LogiIsPlaying(0, LogitechGSDK.LOGI_FORCE_SPRING))
                 {
                     LogitechGSDK.LogiStopSpringForce(0);
                 }
                 else
                 {
                     LogitechGSDK.LogiPlaySpringForce(0, 50, 50, 50);
                 }
             }
             else
             {
                 LogitechGSDK.LogiPlayDirtRoadEffect(0, 100);
             }
         }
         Console.WriteLine("The program it's going to stop! ");
         LogitechGSDK.LogiSteeringShutdown();
     }
 }
        private void BacklightOff()
        {
#if !UI_DESIGN
            Chroma.Instance.Mouse.SetAll(ColoreColor.Black);
            LogitechGSDK.LogiLedSetLighting(0, 0, 0);
#endif
        }
示例#3
0
        public void LogiLedSetLighting(Color color)
        {
            int red, green, blue;

            ColorToPercentagesTuple(color, out red, out green, out blue);
            LogitechGSDK.LogiLedSetLighting(red, green, blue);
        }
示例#4
0
        // init stuff
        static public void InitDevice()
        {
            // init aPP
            Boolean init = LogitechGSDK.LogiLcdInit(appletName, LogitechGSDK.LOGI_LCD_TYPE_COLOR);

            WriteDebugMessage("Initial status: " + init);

            // check for connection
            if (init == false)
            {
                Console.WriteLine("No device found, please check connection");
                Console.WriteLine();
                Console.WriteLine("Press any key to exit...");
                Console.ReadKey();
                Environment.Exit(0);
            }

            // hide console if no debug
            var handle = GetConsoleWindow();

            if (debugOn)
            {
                WriteDebugMessage("Connect status: " + LogitechGSDK.LogiLcdIsConnected(LogitechGSDK.LOGI_LCD_TYPE_COLOR));
            }
            else
            {
                ShowWindow(handle, SW_HIDE);
            }

            // set background
            SetBackground();
        }
示例#5
0
        // Methods
        public string StartUp(MainWindow mainWindow)//Canvas artCanvas)
        {
            string LGSresult = "";

            if (LogitechGSDK.LogiLedInitWithName("Wave RGB"))
            {                                       //if no error...
                System.Threading.Thread.Sleep(250); //wait for LGS to wake up
                int[] version = GetLGSversion();
                if (version[0] == -1)
                {
                    LGSresult = "Successfully connected to LogiLED but version unknown.";
                }
                else
                {
                    LGSresult = string.Format($"Successfully connected to LogiLED version {version[0]}.{version[1]}.{version[2]}.");
                }
            }
            else
            {
                LGSresult = "Failed to connect to LogiLED.";
            }
            settingsWindow = new SettingsWindow(this);
            settingsWindow.SetupBackgroundsMenu(KeyboardBackgroundImageNames);
            settingsWindow.SetupPresetsMenu(presetNames);
            LoadPreferences();
            KeyListener.StartKeyListener(this);
            this.mainWindow = mainWindow;
            SetupTrayIcon();

            paintPeripheralsOnce = true;

            return(LGSresult);
        }
示例#6
0
        private void Run()
        {
            if (!LogitechGSDK.LogiLedInit())
            {
                Console.Error.WriteLine("Failed to start LogiTech SDK. Plug in a keyboard or something.");
                return;
            }

            LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_ALL);

            GetAppSettings();
            SetKeyState();

            const int pollTime = 60; // milliseconds
            var       timer    = new Timer(pollTime)
            {
                Enabled = true
            };

            timer.Elapsed += (sender, eventArgs) => { SetKeyState(); };

            Console.WriteLine("Press \"ENTER\" to close.");
            Console.ReadLine();

            LogitechGSDK.LogiLedShutdown();
        }
示例#7
0
    // Update is called once per frame
    void Update()
    {
        print("And did I update once ?");

        LogitechGSDK.LogiLedSetLighting(red, green, blue);
        print("And did I update a second time ?");

        if (Input.GetKey(KeyCode.R))
        {
            curr_color = colors.R;
        }
        else if (Input.GetKey(KeyCode.G))
        {
            curr_color = colors.G;
        }
        else if (Input.GetKey(KeyCode.B))
        {
            curr_color = colors.B;
        }
        else if (Input.GetKey(KeyCode.KeypadPlus))
        {
            switch (curr_color)
            {
            case colors.R:
                goal_r = Mathf.Min((float)(goal_r + 0.02f), 1.0f);
                red    = (int)Mathf.Min((float)(red + 2), 100.0f);
                break;

            case colors.G:
                goal_g = Mathf.Min((float)(goal_g + 0.02f), 1.0f);
                green  = (int)Mathf.Min((float)(green + 2), 100.0f);
                break;

            case colors.B:
                goal_b = Mathf.Min((float)(goal_b + 0.02f), 1.0f);
                blue   = (int)Mathf.Min((float)(blue + 2), 100.0f);
                break;
            }
        }
        else if (Input.GetKey(KeyCode.KeypadMinus))
        {
            switch (curr_color)
            {
            case colors.R:
                goal_r = Mathf.Max((float)(goal_r - 0.02f), 0.0f);
                red    = (int)Mathf.Max((float)(red - 2), 0.0f);
                break;

            case colors.G:
                goal_g = Mathf.Max((float)(goal_g - 0.02f), 0.0f);
                green  = (int)Mathf.Max((float)(green - 2), 0.0f);
                break;

            case colors.B:
                goal_b = Mathf.Max((float)(goal_b - 0.02f), 0.0f);
                blue   = (int)Mathf.Max((float)(blue - 2), 0.0f);
                break;
            }
        }
    }
示例#8
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (IsActive)
            {
                globalKeyboardHook.KeyDown -= GlobalHook_KeyDown;
                globalKeyboardHook.Dispose();

                LogitechGSDK.LogiLedStopEffects();
                LogitechGSDK.LogiLedRestoreLighting();

                (sender as Button).Text = "Start";
                IsActive = false;
            }
            else
            {
                globalKeyboardHook          = Hook.GlobalEvents();
                globalKeyboardHook.KeyDown += GlobalHook_KeyDown;

                (sender as Button).Text = "Stop";

                LogitechGSDK.LogiLedInit();
                Thread.Sleep(100); //init needs some time... this shouldn't block the UI-thread, but it's the best solution for now...
                LogitechGSDK.LogiLedSaveCurrentLighting();

                ActivateKey();
                IsActive = true;
            }
        }
        public static bool SetLighting(LedSdk sdk, int red, int green, int blue)
        {
            bool set = false;

            CheckRgbValues(red, green, blue);

            if (sdk == LedSdk.Logitech)
            {
                LogitechGSDK.LogiLedStopEffects();
                set = LogitechGSDK.LogiLedSetLighting(red, green, blue);
            }

            else if (sdk == LedSdk.Corsair)
            {
                CueSDK.HeadsetSDK.Brush.Effects.Clear();
                byte[] rgb = ConvertPercentagesToRgbValues(red, green, blue);
                CueSDK.HeadsetSDK.Brush = new SolidColorBrush(new CorsairColor(rgb[0], rgb[1], rgb[2]));
                set = true;
            }
            if (set)
            {
                Debug.WriteLine($"Lighting set to {red}, {green}, {blue} for {sdk}!");
            }
            return(set);
        }
        public static bool FlashLighting(LedSdk sdk, int red, int green, int blue, int duration, int interval)
        {
            bool set = false;

            CheckRgbValues(red, green, blue);

            if (sdk == LedSdk.Logitech)
            {
                set = LogitechGSDK.LogiLedFlashLighting(red, green, blue, duration, interval);
            }

            else if (sdk == LedSdk.Corsair)
            {
                CueSDK.HeadsetSDK.Brush.Effects.Clear();
                byte[]          rgb = ConvertPercentagesToRgbValues(red, green, blue);
                SolidColorBrush b   = new SolidColorBrush(new CorsairColor(rgb[0], rgb[1], rgb[2]));
                b.AddEffect(new FlashEffect()
                {
                    Attack      = 0f,
                    Sustain     = (float)interval / 2f,
                    Release     = 0f,
                    Interval    = (float)interval / 2f,
                    Repetitions = duration / interval
                });
                CueSDK.HeadsetSDK.Brush = b;
                b.UpdateEffects();
                set = true;
            }
            if (set)
            {
                Debug.WriteLine($"Lights flashing {red}, {green}, {blue} for {sdk}!");
            }
            return(set);
        }
示例#11
0
    // Update is called once per frame
    void Update()
    {
        if (!usingCallback)
        {
            for (int index = 6; index <= LogitechGSDK.LOGITECH_MAX_MOUSE_BUTTONS; index++)
            {
                if (LogitechGSDK.LogiGkeyIsMouseButtonPressed(index) == 1)
                {
                    //These functions are not going to work if you didn't initialize the LCD SDK and calling LogiLcdUpdate every frame
                    LogitechGSDK.LogiLcdColorSetText(0, "MOUSE", 255, 0, 0);
                    LogitechGSDK.LogiLcdColorSetText(1, "Button : " + index, 255, 0, 0);
                }
            }

            for (int index = 1; index <= LogitechGSDK.LOGITECH_MAX_GKEYS; index++)
            {
                for (int mKeyIndex = 1; mKeyIndex <= LogitechGSDK.LOGITECH_MAX_M_STATES; mKeyIndex++)
                {
                    if (LogitechGSDK.LogiGkeyIsKeyboardGkeyPressed(index, mKeyIndex) == 1)
                    {
                        //These functions are not going to work if you didn't initialize the LCD SDK and calling LogiLcdUpdate every frame
                        LogitechGSDK.LogiLcdColorSetText(0, "KEYBOARD/HEADSET", 255, 0, 0);
                        LogitechGSDK.LogiLcdColorSetText(1, "Button : " + index, 255, 0, 0);
                    }
                }
            }
        }
    }
示例#12
0
        private void SetEffect(LedEffect effect)
        {
            var color    = LedScoutColors.InitialColor;
            var interval = 0;

            switch (effect)
            {
            case LedEffect.None: break;

            case LedEffect.DroppingFast:
                interval = 100;
                color    = LedScoutColors.StateColors[BloodSugarState.VeryLow]; break;

            case LedEffect.Dropping:
                interval = 250;
                color    = LedScoutColors.StateColors[BloodSugarState.Low]; break;

            case LedEffect.Rising:
                interval = 250;
                color    = LedScoutColors.StateColors[BloodSugarState.High]; break;

            case LedEffect.RisingFast:
                interval = 100;
                color    = LedScoutColors.StateColors[BloodSugarState.VeryHigh]; break;
            }

            if (interval > 0)
            {
                LogitechGSDK.LogiLedFlashLighting(
                    color.Red.ToPct(), color.Green.ToPct(), color.Blue.ToPct(),
                    3000, interval);
                Thread.Sleep(3100);
            }
        }
示例#13
0
        private void SendColorToPeripheral(Color color, bool forced = false)
        {
            if (!previous_peripheral_Color.Equals(color) || forced)
            {
                LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_RGB);

                if (Global.Configuration.allow_peripheral_devices)
                {
                    double alpha_amt = (color.A / 255.0);
                    int    red_amt   = (int)(((color.R * alpha_amt) / 255.0) * 100.0);
                    int    green_amt = (int)(((color.G * alpha_amt) / 255.0) * 100.0);
                    int    blue_amt  = (int)(((color.B * alpha_amt) / 255.0) * 100.0);

                    //System.Diagnostics.Debug.WriteLine("R: " + red_amt + " G: " + green_amt + " B: " + blue_amt);

                    LogitechGSDK.LogiLedSetLighting(red_amt, green_amt, blue_amt);
                    previous_peripheral_Color = color;
                    peripheral_updated        = true;
                }
                else
                {
                    if (peripheral_updated)
                    {
                        LogitechGSDK.LogiLedRestoreLighting();
                        peripheral_updated = false;
                    }
                }
            }
        }
示例#14
0
        public void FadeInIfHigher(MainModel mainModel)
        {
            if (mainModel.BoostAmount <= mainModel.PreviousBoost)
            {
                return;
            }
            const int amountOfSteps = 6;

            var difference         = mainModel.BoostAmount - mainModel.PreviousBoost;
            var differenceStep     = difference / amountOfSteps;
            var differenceStepRest = difference % amountOfSteps;

            mainModel.BoostAmount = mainModel.PreviousBoost;

            for (var i = 0; i < amountOfSteps; i++)
            {
                if (differenceStepRest > 0)
                {
                    differenceStepRest    -= 1;
                    mainModel.BoostAmount += 1;
                }
                mainModel.BoostAmount += differenceStep;

                var bitmap = CreateBoostBitmap(mainModel);
                LogitechGSDK.LogiLedSetLightingFromBitmap(OrionController.BitmapToByteArray(bitmap));
                Thread.Sleep(50);
            }
        }
示例#15
0
        public override bool CanEnable()
        {
            // Just to be sure, restore the Logitech DLL registry key
            DllManager.RestoreLogitechDll();

            int majorNum = 0, minorNum = 0, buildNum = 0;

            LogitechGSDK.LogiLedInit();
            LogitechGSDK.LogiLedGetSdkVersion(ref majorNum, ref minorNum, ref buildNum);
            LogitechGSDK.LogiLedShutdown();

            CantEnableText = "Couldn't connect to your Logitech keyboard.\n" +
                             "Please check your cables and updating the Logitech Gaming Software\n" +
                             $"A minimum version of 9.0.42 is required (detected {majorNum}.{minorNum}.{buildNum}).\n\n" +
                             "If the detected version differs from the version LGS is reporting, reinstall LGS or see the FAQ.\n\n" +
                             "If needed, you can select a different keyboard in Artemis under settings.";

            // Anything below 9 is a no go
            if (majorNum < 9)
            {
                return(false);
            }
            // If on 9.0 require 9.0.42 or higher
            if (majorNum == 9 && minorNum == 0)
            {
                return(buildNum >= 42);
            }
            // If higher then 9.0 just wing it ¯\_(ツ)_/¯
            return(true);
        }
示例#16
0
        private static async Task LightAsync(KeyboardNames key, LightDirection direction, int steps, int stepDelay = 50)
        {
            int value = 0;

            for (int i = 0; i < steps; i++)
            {
                int step = direction == LightDirection.Up ? i : steps - i;
                value = (int)((double)step / steps * 100);

                LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(key, value, 0, 0);
                await Task.Delay(stepDelay, cancellationToken);
            }

            int?last = null;

            if (direction == LightDirection.Up)
            {
                if (value != 100)
                {
                    last = 100;
                }
            }
            else
            {
                if (value != 0)
                {
                    last = 0;
                }
            }

            if (last != null)
            {
                LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(key, last.Value, 0, 0);
            }
        }
示例#17
0
    // Use this for initialization
    void Start()
    {
        LogitechGSDK.LogiSteeringInitialize(true);

        properties            = new LogitechGSDK.LogiControllerPropertiesData();
        properties.wheelRange = 900;

        LogitechGSDK.LogiSetPreferredControllerProperties(properties);

        wheelValue     = 0.0f;
        valveCurrState = IsWheelValveClosed = true;
        for (int i = 0; i < 10; i++)
        {
            if (LogitechGSDK.LogiIsConnected(i))
            {
                wheelIndex = i;
            }
        }

        joynames = new List <string>(Input.GetJoystickNames());
        if (joynames[0].Contains("G27"))
        {
            axesName = "Joystick" + 0;
        }
        else
        {
            axesName = "Joystick" + 1;
        }
    }
示例#18
0
        public bool SetGreen()
        {
            if (LogitechGSDK.LogiLedInit())
            {
                var m_targetDevice = LogitechGSDK.LOGI_DEVICETYPE_ALL;

                if (LogitechGSDK.LogiLedSetTargetDevice(m_targetDevice))
                {
                    LogitechGSDK.LogiLedSetLighting(0, 100, 0);

                    //LogitechGSDK.LogiLedSaveCurrentLighting();
                    //LogitechGSDK.LogiLedSetLighting(10, 10, 100);
                    //LogitechGSDK.LogiLedRestoreLighting();
                    //        LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(KeyboardNames.NUM_ZERO, 10, 100, 10);

                    //        LogitechGSDK.LogiLedSaveLightingForKey(KeyboardNames.NUM_ZERO);

                    //                LogitechGSDK.LogiLedFlashSingleKey(KeyboardNames.NUM_ZERO, 0, 100, 0, 5000, 500);
                    //        LogitechGSDK.LogiLedPulseSingleKey(KeyboardNames.NUM_ZERO, 0, 10, 0, 0, 100, 0, 2000, false);
                }


                LogitechGSDK.LogiLedShutdown();
                return(true);
            }

            return(false);
        }
示例#19
0
        public override bool CanEnable()
        {
            // Check to see if VC++ 2012 x64 is installed.
            if (Registry.LocalMachine.OpenSubKey(
                    @"SOFTWARE\Classes\Installer\Dependencies\{ca67548a-5ebe-413a-b50c-4b9ceb6d66c6}") == null)
            {
                CantEnableText = "Couldn't connect to your Logitech keyboard.\n" +
                                 "The Visual C 2012 Redistributable could not be found, which is required.\n" +
                                 "Please download it by going to the following URL:\n\n" +
                                 "https://www.microsoft.com/download/confirmation.aspx?id=30679";

                return(false);
            }

            if (DllManager.RestoreLogitechDll())
            {
                RestoreDll();
            }
            int majorNum = 0, minorNum = 0, buildNum = 0;

            LogitechGSDK.LogiLedInit();
            LogitechGSDK.LogiLedGetSdkVersion(ref majorNum, ref minorNum, ref buildNum);
            LogitechGSDK.LogiLedShutdown();

            // Turn it into one long number...
            var version = int.Parse($"{majorNum}{minorNum}{buildNum}");

            CantEnableText = "Couldn't connect to your Logitech G910.\n" +
                             "Please check your cables and updating the Logitech Gaming Software\n" +
                             $"A minimum version of 8.81.15 is required (detected {majorNum}.{minorNum}.{buildNum}).\n\n" +
                             "If the detected version differs from the version LGS is reporting, reinstall LGS or see the FAQ.\n\n" +
                             "If needed, you can select a different keyboard in Artemis under settings.";

            return(version >= 88115);
        }
示例#20
0
 public void SetKeyLighting(int keyCode, int red, int green, int blue)
 {
     if (!LogitechGSDK.LogiLedSetLightingForKeyWithScanCode(keyCode, red, green, blue))
     {
         throw new LogitechGSDKException("LogiLedSetLightingForKeyWithScanCode returned an Error Code.");
     }
 }
示例#21
0
        /// Global hotkeys hook
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == 0x0312)
            {
                int id = m.WParam.ToInt32();


                switch (id)
                {
                /// Main action: switch color on/off
                case 1:
                    changeNumLockState();
                    break;

                /// Exit program
                case 2:
                    changeNumLockState();
                    LogitechGSDK.LogiLedShutdown();
                    Application.Exit();
                    break;

                /// Show form
                case 3:
                    changeNumLockState();
                    this.Show();
                    this.WindowState = FormWindowState.Normal;
                    break;
                }
            }
            base.WndProc(ref m);
        }
示例#22
0
文件: G810.cs 项目: rakosi2/Artemis
        /// <summary>
        ///     The G910 also updates the G-logo, G-badge and G-keys
        /// </summary>
        /// <param name="bitmap"></param>
        public override void DrawBitmap(Bitmap bitmap)
        {
            using (var croppedBitmap = new Bitmap(21 * 4, 6 * 4))
            {
                // Deal with non-standard DPI
                croppedBitmap.SetResolution(96, 96);
                // Don't forget that the image is upscaled 4 times
                using (var g = Graphics.FromImage(croppedBitmap))
                {
                    g.DrawImage(bitmap, new Rectangle(0, 0, 84, 24), new Rectangle(4, 4, 84, 24), GraphicsUnit.Pixel);
                }

                LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_PERKEY_RGB);
                // TODO: Remapping
                LogitechGSDK.LogiLedSetLightingFromBitmap(OrionUtilities.BitmapToByteArray(bitmap));
            }

            using (var resized = OrionUtilities.ResizeImage(bitmap, 21, 7))
            {
                // Color G-logo, lets also try some other values to see what happens
                SetLogitechColorFromCoordinates(resized, KeyboardNames.G_LOGO, 0, 0);
                SetLogitechColorFromCoordinates(resized, KeyboardNames.G_BADGE, 0, 0);
                SetLogitechColorFromCoordinates(resized, KeyboardNames.G_1, 0, 0);
                SetLogitechColorFromCoordinates(resized, KeyboardNames.G_2, 0, 0);
                SetLogitechColorFromCoordinates(resized, KeyboardNames.G_3, 0, 0);
                SetLogitechColorFromCoordinates(resized, KeyboardNames.G_4, 0, 0);
                SetLogitechColorFromCoordinates(resized, KeyboardNames.G_5, 0, 0);
                SetLogitechColorFromCoordinates(resized, KeyboardNames.G_6, 0, 0);
                SetLogitechColorFromCoordinates(resized, KeyboardNames.G_7, 0, 0);
                SetLogitechColorFromCoordinates(resized, KeyboardNames.G_8, 0, 0);
                SetLogitechColorFromCoordinates(resized, KeyboardNames.G_9, 0, 0);
            }
        }
示例#23
0
 // Use this for initialization
 void Start()
 {
     activeForces         = "";
     propertiesEdit       = "";
     actualState          = "";
     buttonStatus         = "";
     forcesLabel          = "Press the following keys to activate forces and effects on the steering wheel / gaming controller \n";
     forcesLabel         += "Spring force : S\n";
     forcesLabel         += "Constant force : C\n";
     forcesLabel         += "Damper force : D\n";
     forcesLabel         += "Side collision : Left or Right Arrow\n";
     forcesLabel         += "Front collision : Up arrow\n";
     forcesLabel         += "Dirt road effect : I\n";
     forcesLabel         += "Bumpy road effect : B\n";
     forcesLabel         += "Slippery road effect : L\n";
     forcesLabel         += "Surface effect : U\n";
     forcesLabel         += "Car Airborne effect : A\n";
     forcesLabel         += "Soft Stop Force : O\n";
     forcesLabel         += "Set example controller properties : PageUp\n";
     forcesLabel         += "Play Leds : P\n";
     activeForceAndEffect = new string[9];
     LogitechGSDK.LogiSteeringInitialize(false);
     properties.wheelRange = 540;
     LogitechGSDK.LogiSetPreferredControllerProperties(properties);
 }
示例#24
0
        public void LogiLedSetLightingForKeyWithKeyName(keyboardNames keyCode, Color color)
        {
            int red, green, blue;

            ColorToPercentagesTuple(color, out red, out green, out blue);
            LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(keyCode, red, green, blue);
        }
示例#25
0
 public void Shifting(ref int tempGearParam)
 {
     if (Gear.id < GearBox.Length - 1)
     {
         if (LogitechGSDK.LogiButtonTriggered(0, 4)) //  Gear shift up triggered
         {
             tempGearParam = Gear.id;
             Gear          = GearBox[1];
         }
         if (LogitechGSDK.LogiButtonReleased(0, 4)) // Gear shift up released
         {
             Gear          = GearBox[tempGearParam + 1];
             tempGearParam = Gear.id;
             gearText.text = Gear.shift.ToString();
         }
     }
     if (Gear.id > 0)
     {
         if (LogitechGSDK.LogiButtonTriggered(0, 5)) //  Gear shift down triggered
         {
             tempGearParam = Gear.id;
             Gear          = GearBox[1];
         }
         if (LogitechGSDK.LogiButtonReleased(0, 5)) //   Gear shift down released
         {
             Gear          = GearBox[tempGearParam - 1];
             tempGearParam = Gear.id;
             gearText.text = Gear.shift.ToString();
         }
     }
 }
示例#26
0
 // remove entries method
 public static void RemoveEntries()
 {
     for (int i = 0; i < 8; i++)
     {
         LogitechGSDK.LogiLcdColorSetText(i, "", 255, 255, 255);
     }
 }
示例#27
0
        //Apply Constant Force
        void UpdateSteeringWheelRotation(float steer)
        {
            //steeringWheel.transform.localRotation = Quaternion.Euler (0, 0, -Input.GetAxis ("Horizontal")*90);
            //if (Input.GetKeyDown (KeyCode.F12))
            //debugGUI = !debugGUI;
            float steer_copy = steer;
            int   force      = (int)Mathf.Round(Mathf.Abs(steer_copy) * Mathf.Sign(steer_copy) * m_Car.GetComponent <Rigidbody>().velocity.magnitude * 7);

            //Debug.Log(force);
            //Debug.Log(force);


            if (force > 0)
            {
                LogitechGSDK.LogiPlayConstantForce(0, force);
            }
            else if (force < 0)
            {
                LogitechGSDK.LogiPlayConstantForce(0, force);
            }
            else
            {
                if (LogitechGSDK.LogiIsPlaying(0, LogitechGSDK.LOGI_FORCE_CONSTANT))
                {
                    LogitechGSDK.LogiStopConstantForce(0);
                }
            }
        }
        private void WaitForLEDSDKInit()
        {
            new Thread(() =>
            {
                while (true)
                {
                    foreach (Process clsProcess in Process.GetProcesses())
                    {
                        if (clsProcess.ProcessName == "LCore")
                        {
                            logiSDKStarted = true;
                            break;
                        }
                    }

                    if (logiSDKStarted)
                    {
                        break;
                    }

                    Thread.Sleep(100);
                }
#if !DEBUG
                Thread.Sleep(5000);
#endif
                Chroma.Instance.Initialize();
                LogitechGSDK.LogiLedInit();
                LogitechGSDK.LogiLedSetTargetDevice(LogitechGSDK.LOGI_DEVICETYPE_PERKEY_RGB);
                BacklightOn();

                Dispatcher.Invoke(() => CreateTaskbarIcon());
            }).Start();
        }
 static void Main(string[] args)
 {
     LogitechGSDK.LogiLedInit();
     _ = new LightsyncBrowserService();
     Application.Run();
     Application.ApplicationExit += Application_ApplicationExit;
 }
示例#30
0
        //public static void ListenForMouseEvents()
        //{
        //    Console.WriteLine("Listening to mouse clicks.");

        //    //When a mouse button is pressed
        //    Hook.GlobalEvents().MouseDown += async (sender, e) =>
        //    {
        //        Console.WriteLine($"Mouse {e.Button} Down");
        //    };
        //    //When a double click is made
        //    Hook.GlobalEvents().MouseDoubleClick += async (sender, e) =>
        //    {
        //        Console.WriteLine($"Mouse {e.Button} button double clicked.");
        //    };
        //}

        static void ExitConsole(object sender, ConsoleCancelEventArgs e)
        {
            Console.WriteLine("Beenden");
            e.Cancel        = true;
            cancelRequested = true;
            LogitechGSDK.LogiLedShutdown();
        }
 void GkeySDKCallback(LogitechGSDK.GkeyCode gKeyCode, String gKeyOrButtonString, IntPtr context)
 {
     if(gKeyCode.keyDown == 0){
             if(gKeyCode.mouse == 1){
                 //These functions are not going to work if you didn't initialize the LCD SDK and calling LogiLcdUpdate every frame
                 LogitechGSDK.LogiLcdColorSetText(0, "MOUSE "+gKeyOrButtonString,255,0,0);
                 LogitechGSDK.LogiLcdColorSetText(2, LogitechGSDK.LogiGkeyGetMouseButtonStr(gKeyCode.keyIdx),255,0,0);
                 LogitechGSDK.LogiLcdMonoSetText(2, "MOUSE "+gKeyOrButtonString);
                 LogitechGSDK.LogiLcdMonoSetText(3, LogitechGSDK.LogiGkeyGetMouseButtonStr(gKeyCode.keyIdx));
             }
             else{
                 //These functions are not going to work if you didn't initialize the LCD SDK and calling LogiLcdUpdate every frame
                 LogitechGSDK.LogiLcdColorSetText(0, "KEYBOARD/HEADSET "+gKeyOrButtonString,255,0,0);
                 LogitechGSDK.LogiLcdColorSetText(2, LogitechGSDK.LogiGkeyGetKeyboardGkeyStr(gKeyCode.keyIdx, gKeyCode.mState),255,0,0);
                 LogitechGSDK.LogiLcdMonoSetText(2, "KEYBOARD/HEADSET "+gKeyOrButtonString);
                 LogitechGSDK.LogiLcdMonoSetText(3, LogitechGSDK.LogiGkeyGetKeyboardGkeyStr(gKeyCode.keyIdx, gKeyCode.mState));
             }
             //These functions are not going to work if you didn't initialize the LCD SDK and calling LogiLcdUpdate every frame
             LogitechGSDK.LogiLcdColorSetText(1, " Released button :"+gKeyCode.keyIdx+" mode :"+gKeyCode.mState,255,0,0);
             LogitechGSDK.LogiLcdMonoSetText(3, " Released button :"+gKeyCode.keyIdx+" mode :"+gKeyCode.mState);
         }
         else{
             if(gKeyCode.mouse == 1){
                 //These functions are not going to work if you didn't initialize the LCD SDK and calling LogiLcdUpdate every frame
                 LogitechGSDK.LogiLcdColorSetText(0, "MOUSE "+gKeyOrButtonString,255,0,0);
                 LogitechGSDK.LogiLcdColorSetText(2, LogitechGSDK.LogiGkeyGetMouseButtonStr(gKeyCode.keyIdx),255,0,0);
                 LogitechGSDK.LogiLcdMonoSetText(2, "MOUSE "+gKeyOrButtonString);
                 LogitechGSDK.LogiLcdMonoSetText(3, LogitechGSDK.LogiGkeyGetMouseButtonStr(gKeyCode.keyIdx));
             }
             else{
                 //These functions are not going to work if you didn't initialize the LCD SDK and calling LogiLcdUpdate every frame
                 LogitechGSDK.LogiLcdColorSetText(0, "KEYBOARD/HEADSET "+gKeyOrButtonString,255,0,0);
                 LogitechGSDK.LogiLcdColorSetText(2, LogitechGSDK.LogiGkeyGetKeyboardGkeyStr(gKeyCode.keyIdx, gKeyCode.mState),255,0,0);
                 LogitechGSDK.LogiLcdMonoSetText(2, "KEYBOARD/HEADSET "+gKeyOrButtonString);
                 LogitechGSDK.LogiLcdMonoSetText(3, LogitechGSDK.LogiGkeyGetKeyboardGkeyStr(gKeyCode.keyIdx, gKeyCode.mState));
             }
             //These functions are not going to work if you didn't initialize the LCD SDK and calling LogiLcdUpdate every frame
             LogitechGSDK.LogiLcdColorSetText(1, " Pressed button :"+gKeyCode.keyIdx+" mode :"+gKeyCode.mState,255,0,0);
             LogitechGSDK.LogiLcdMonoSetText(3, " Pressed button :"+gKeyCode.keyIdx+" mode :"+gKeyCode.mState);
         }
 }