示例#1
0
        public List <ControlDevice> GetDevices()
        {
            for (int i = 0; i < grenade.Length; i++)
            {
                grenade[i] = new ControlDevice.LedUnit()
                {
                    Color = new LEDColor(0, 0, 0),
                    Data  = new ControlDevice.LEDData()
                    {
                        LEDNumber = i
                    },
                    LEDName = i + " LED"
                };
            }

            return(new List <ControlDevice>
            {
                new ControlDevice
                {
                    LEDs = grenade,
                    Name = "Grenade",
                    DeviceType = DeviceTypes.GameIntegration,
                    Driver = this
                }
            });
        }
示例#2
0
        public void Configure(DriverDetails driverDetails)
        {
            client = new OpenRGBClient(name: "RGB Sync Studio", autoconnect: true, timeout: 1000);

            var deviceCount = client.GetControllerCount();
            var devices     = client.GetAllControllerData();

            for (int devId = 0; devId < devices.Length; devId++)
            {
                ORGBControlDevice slsDevice = new ORGBControlDevice();
                slsDevice.id           = devId;
                slsDevice.Driver       = this;
                slsDevice.Name         = devices[devId].Name;
                slsDevice.DeviceType   = DeviceTypeConverter.GetType(devices[devId].Type);
                slsDevice.Has2DSupport = false;
                slsDevice.ProductImage = (Bitmap)Image.FromStream(orgbImage);

                List <ControlDevice.LedUnit> deviceLeds = new List <ControlDevice.LedUnit>();

                int i = 0;
                foreach (Led orgbLed in devices[devId].Leds)
                {
                    ControlDevice.LedUnit slsLed = new ControlDevice.LedUnit();
                    slsLed.LEDName = orgbLed.Name;
                    deviceLeds.Add(slsLed);
                }

                slsDevice.LEDs = deviceLeds.ToArray();

                DeviceAdded?.Invoke(slsDevice, new Events.DeviceChangeEventArgs(slsDevice));
            }
        }
示例#3
0
        public void InterestedUSBChange(int VID, int PID, bool connected)
        {
            if (!connected)
            {
                var dev = devices.First(x => x is HyperXAlloyRgbControlDevice hx && hx.HID == PID);

                devices.Remove(dev);
                DeviceRemoved?.Invoke(this, new Events.DeviceChangeEventArgs(dev));
            }
            else
            {
                var sdevice = supportedDevices.First(x => x.Pid == PID);

                HyperXKeyboardSupport hyperX = new HyperXKeyboardSupport(sdevice.Vid, sdevice.Pid, sdevice.Usb);

                dv = new HyperXAlloyRgbControlDevice
                {
                    Name          = sdevice.Name,
                    DeviceType    = DeviceTypes.Keyboard,
                    Driver        = this,
                    ProductImage  = Assembly.GetExecutingAssembly().GetEmbeddedImage("Driver.HyperXAlloy.RGB." + sdevice.Name + ".png"),
                    HyperXSupport = hyperX,
                    GridHeight    = 6,
                    GridWidth     = 23,
                    Has2DSupport  = true,
                    HID           = sdevice.Pid
                };

                KeyboardHelper.AddKeyboardWatcher(sdevice.Vid, sdevice.Pid, dv.HandleInput);

                List <ControlDevice.LedUnit> leds = new List <ControlDevice.LedUnit>();
                int ctt  = 0;
                var tled = new ControlDevice.LedUnit[106];
                int ct   = 0;

                foreach (var tp in hyperX.humm)
                {
                    var ld = new ControlDevice.LedUnit
                    {
                        LEDName = HyperXKeyboardSupport.KeyNames[tp.Order],
                        Data    = new ControlDevice.PositionalLEDData
                        {
                            LEDNumber = Array.IndexOf(hyperX.humm, tp),
                            X         = tp.X,
                            Y         = tp.Y
                        },
                    };

                    leds.Add(ld);
                }

                dv.LEDs = leds.OrderBy(p => ((ControlDevice.PositionalLEDData)p.Data).X + ((ControlDevice.PositionalLEDData)p.Data).Y).ToArray();

                devices.Add(dv);
                DeviceAdded?.Invoke(this, new Events.DeviceChangeEventArgs(dv));
            }
        }
示例#4
0
        public void Configure(DriverDetails driverDetails)
        {
            IT8297Config config = new IT8297Config();

            //todo read from config

            leds1 = new ControlDevice.LedUnit[config.Fan1LedCount];
            leds2 = new ControlDevice.LedUnit[config.Fan2LedCount];

            for (int i = 0; i < leds1.Length; i++)
            {
                leds1[i] = new ControlDevice.LedUnit
                {
                    Color = new LEDColor(0, 0, 0),
                    Data  = new ControlDevice.LEDData
                    {
                        LEDNumber = i
                    },
                    LEDName = "ARGB 1 LED " + (i + 1)
                };
            }


            for (int i = 0; i < leds2.Length; i++)
            {
                leds2[i] = new ControlDevice.LedUnit
                {
                    Color = new LEDColor(0, 0, 0),
                    Data  = new ControlDevice.LEDData
                    {
                        LEDNumber = i
                    },
                    LEDName = "ARGB 2 LED " + (i + 1)
                };
            }

            vrmLeds[0] = new ControlDevice.LedUnit
            {
                Data = new ControlDevice.LEDData
                {
                    LEDNumber = 0
                },
                LEDName = "VRM Block"
            };

            pciLeds[0] = new ControlDevice.LedUnit
            {
                Data = new ControlDevice.LEDData
                {
                    LEDNumber = 0
                },
                LEDName = "PCI Area"
            };
        }
示例#5
0
        public List <ControlDevice> GetDevices()
        {
            //this is faked to hell till i update the arduino code - this should be read from device via serial driver.

            var results = new List <ControlDevice>();

            foreach (var madLedSerialDriver in serialDrivers)
            {
                string stuff = madLedSerialDriver.GetConfig();

                if (!string.IsNullOrWhiteSpace(stuff))
                {
                    var lines = stuff.Split('~');
                    foreach (var line in lines)
                    {
                        string name     = line.Split(':')[0];
                        int    bank     = int.Parse(line.Split(':')[1]);
                        int    ledCount = int.Parse(line.Split(':')[2]);

                        MadLedDevice dvc = new MadLedDevice
                        {
                            Bank         = bank,
                            Name         = name,
                            Pin          = bank,
                            Driver       = this,
                            SerialDriver = madLedSerialDriver,
                            DeviceType   = DeviceTypes.Fan
                        };

                        ControlDevice.LedUnit[] leds = new ControlDevice.LedUnit[ledCount];
                        for (int i = 0; i < ledCount; i++)
                        {
                            leds[i] = new ControlDevice.LedUnit
                            {
                                LEDName = "LED " + i, Data = new MadLedData {
                                    LEDNumber = i
                                }
                            };
                        }

                        dvc.LEDs = leds;

                        results.Add(dvc);
                    }
                }
            }

            return(results);
        }
示例#6
0
        public void SetDeviceOverride(ControlDevice controlDevice, CustomDeviceSpecification deviceSpec)
        {
            WLEDControlDevice csd = controlDevice as WLEDControlDevice;

            List <ControlDevice.LedUnit> leds = new List <ControlDevice.LedUnit>();

            for (int i = 0; i < deviceSpec.LedCount; i++)
            {
                ControlDevice.LedUnit newLed = new ControlDevice.LedUnit();
                newLed.Data           = new ControlDevice.LEDData();
                newLed.Data.LEDNumber = i;
                leds.Add(newLed);
            }

            controlDevice.LEDs = leds.ToArray();
        }
示例#7
0
        public FanClockDriver()
        {
            for (int i = 0; i < LEDCount; i++)
            {
                leds[i] = new ControlDevice.LedUnit
                {
                    LEDName = "LED " + i,
                    Data    = new ControlDevice.LEDData
                    {
                        LEDNumber = i,
                    },
                };
            }

            timer = new Timer(TimerCallback, null, 0, 1000);
        }
示例#8
0
        public void Configure(DriverDetails driverDetails)
        {
            cmrgb = new CMRGBController();
            Debug.WriteLine(cmrgb.getVersion());

            var ring_leds = new LedChannel[15];

            for (int r = 0; r < 5; r++)
            {
                for (int x = 0; x < 15; x++)
                {
                    ring_leds[x] = AMDWraith.LedChannel.R_RAINBOW;
                }

                Debug.WriteLine(cmrgb
                                .assign_leds_to_channels(AMDWraith.LedChannel.OFF, AMDWraith.LedChannel.OFF, ring_leds)
                                .PrettyBytes());

                Thread.Sleep(500);

                for (int x = 0; x < 15; x++)
                {
                    ring_leds[x] = AMDWraith.LedChannel.OFF;
                }

                Debug.WriteLine(cmrgb.assign_leds_to_channels(AMDWraith.LedChannel.OFF, AMDWraith.LedChannel.OFF, ring_leds).PrettyBytes());
                Thread.Sleep(500);
            }

            leds = new ControlDevice.LedUnit[15];
            for (int i = 0; i < 15; i++)
            {
                leds[i] = new ControlDevice.LedUnit
                {
                    Color   = new LEDColor(0, 0, 0),
                    LEDName = "Ring " + (i + 1)
                };
            }

            pushRequested = true;
            new Thread(() =>
            {
                Thread.CurrentThread.IsBackground = true;
                ManagePOV();
            }).Start();
        }
示例#9
0
        public void AddController(WLEDConfigModel.WLEDController controller)
        {
            WLEDControlDevice wled = new WLEDControlDevice();

            wled.Name            = controller.Name;
            wled.DeviceType      = DeviceTypes.LedStrip;
            wled.Driver          = this;
            wled.Has2DSupport    = false;
            wled.LedCount        = controller.LedCount;
            wled.ConnectedTo     = controller.ControllerType.ToUpper();
            wled.OverrideSupport = OverrideSupport.Self;
            if (wled.ConnectedTo == "ESP32")
            {
                wled.ProductImage = (Bitmap)System.Drawing.Image.FromStream(Esp32Stream);
            }
            else if (wled.ConnectedTo == "ESP8266")
            {
                wled.ProductImage = (Bitmap)System.Drawing.Image.FromStream(Esp8266Stream);
            }
            else
            {
                wled.ProductImage = (Bitmap)System.Drawing.Image.FromStream(GenericStream);
            }
            wled.Endpoint = new IPEndPoint(IPAddress.Parse(controller.IP), Int32.Parse(controller.Port));

            List <ControlDevice.LedUnit> deviceLeds = new List <ControlDevice.LedUnit>();

            for (int i = 0; i < controller.LedCount; i++)
            {
                ControlDevice.LedUnit newLed = new ControlDevice.LedUnit();
                newLed.Data           = new ControlDevice.LEDData();
                newLed.Data.LEDNumber = i;
                deviceLeds.Add(newLed);
            }

            wled.LEDs = deviceLeds.ToArray();
            DeviceAdded?.Invoke(wled, new Events.DeviceChangeEventArgs(wled));
            deviceList.Add(wled);
            var helloWorld = new List <byte>()
            {
                0x02, 0xFF, 0x00, 0xFF, 0x00
            };

            wled.Socket.SendTo(helloWorld.ToArray(), wled.Endpoint);
        }
        public void Configure(DriverDetails driverDetails)
        {
            Remappy();

            for (int i = 0; i < fullLeds.Length; i++)
            {
                fullLeds[i] = new ControlDevice.LedUnit
                {
                    Color   = new LEDColor(0, 0, 0),
                    LEDName = "Pixel " + i,
                    Data    = new ControlDevice.LEDData
                    {
                        LEDNumber = i
                    }
                };
            }

            for (int i = 0; i < ringLeds.Length; i++)
            {
                ringLeds[i] = new ControlDevice.LedUnit
                {
                    Color   = new LEDColor(0, 0, 0),
                    LEDName = "Pixel " + i,
                    Data    = new ControlDevice.LEDData
                    {
                        LEDNumber = i
                    }
                };
            }

            oneLeds[0] = new ControlDevice.LedUnit
            {
                Color   = new LEDColor(0, 0, 0),
                LEDName = "Pixel " + 0,
                Data    = new ControlDevice.LEDData
                {
                    LEDNumber = 0
                }
            };

            timer = new Timer(TimerCallback, null, 0, 33);
        }
        public SimpleRGBCycleDriver()
        {
            for (int i = 0; i < LEDCount; i++)
            {
                leds[i] = new ControlDevice.LedUnit
                {
                    LEDName = "LED " + i,
                    Data    = new SimpleRGBCycleLEDData
                    {
                        LEDNumber = i,
                        R         = i * 0.01f,
                        G         = i * 0.004f,
                        B         = i * .003f
                    },
                };

                fanLeds[i] = new ControlDevice.LedUnit
                {
                    LEDName = "LED " + i,
                    Data    = new SimpleRGBCycleLEDData
                    {
                        LEDNumber = i,
                        R         = i * 0.01f,
                        G         = i * 0.004f,
                        B         = i * .003f
                    },
                };

                fanLeds2[i] = new ControlDevice.LedUnit
                {
                    LEDName = "LED " + i,
                    Data    = new SimpleRGBCycleLEDData
                    {
                        LEDNumber = i,
                    },
                };
            }

            timer = new Timer(TimerCallback, null, 0, 33);
        }
示例#12
0
        public MousepadDevice(string url, ISimpleLed driver)
        {
            baseUrl      = url;
            Driver       = driver;
            DeviceType   = DeviceTypes.MousePad;
            Name         = "Mousepad";
            ProductImage = RazerDriver.GetImage("Mousepad");
            Has2DSupport = false;
            LEDs         = new ControlDevice.LedUnit[15];

            for (int i = 0; i < 15; i++)
            {
                LEDs[i] = new ControlDevice.LedUnit
                {
                    LEDName = "LED " + i.ToString(),
                    Data    = new ControlDevice.LEDData
                    {
                        LEDNumber = i
                    }
                };
            }
        }
示例#13
0
        public void Configure(DriverDetails driverDetails)
        {
            int ct = 0;

            for (int y = 0; y < 12; y++)
            {
                for (int x = 0; x < 60; x++)
                {
                    leds[ct] = new ControlDevice.LedUnit
                    {
                        Color   = new LEDColor(0, 0, 0),
                        LEDName = x + "," + y,
                        Data    = new ControlDevice.PositionalLEDData
                        {
                            LEDNumber = ct,
                            X         = x,
                            Y         = y
                        }
                    };
                    ct++;
                }
            }
        }
示例#14
0
        public MouseDevice(string url, ISimpleLed driver)
        {
            baseUrl      = url;
            Driver       = driver;
            DeviceType   = DeviceTypes.Mouse;
            Name         = "Mouse";
            ProductImage = RazerDriver.GetImage("Mouse");
            Has2DSupport = true;
            GridHeight   = 9;
            GridWidth    = 7;
            LEDs         = new ControlDevice.LedUnit[63];

            int xPos = 0;
            int yPos = 0;

            for (int i = 0; i < 63; i++)
            {
                if (xPos > 6)
                {
                    xPos = 0;
                    yPos++;
                }
                LEDs[i] = new ControlDevice.LedUnit
                {
                    LEDName = "LED " + i.ToString(),
                    Data    = new ControlDevice.PositionalLEDData()
                    {
                        X         = xPos,
                        Y         = yPos,
                        LEDNumber = i
                    }
                };

                xPos++;
            }
        }
示例#15
0
        public KeypadDevice(string url, ISimpleLed driver)
        {
            baseUrl      = url;
            Driver       = driver;
            DeviceType   = DeviceTypes.Keypad;
            Name         = "Keypad";
            ProductImage = RazerDriver.GetImage("Keypad");
            Has2DSupport = true;
            GridHeight   = 4;
            GridWidth    = 5;
            LEDs         = new ControlDevice.LedUnit[20];

            int xPos = 0;
            int yPos = 0;

            for (int i = 0; i < 20; i++)
            {
                if (xPos > 4)
                {
                    xPos = 0;
                    yPos++;
                }

                LEDs[i] = new ControlDevice.LedUnit
                {
                    LEDName = "LED " + i.ToString(),
                    Data    = new ControlDevice.PositionalLEDData()
                    {
                        X         = xPos,
                        Y         = yPos,
                        LEDNumber = i
                    }
                };
                xPos++;
            }
        }