Esempio n. 1
0
        public KeyboardDevice(string url, ISimpleLed driver)
        {
            baseUrl      = url;
            Driver       = driver;
            DeviceType   = DeviceTypes.Keyboard;
            Name         = "Keyboard";
            ProductImage = RazerDriver.GetImage("Keyboard");
            Has2DSupport = true;
            GridHeight   = 6;
            GridWidth    = 22;
            LEDs         = new LedUnit[132];

            int xPos = 0;
            int yPos = 0;

            for (int i = 0; i < 132; i++)
            {
                if (xPos > 21)
                {
                    xPos = 0;
                    yPos++;
                }
                LEDs[i] = new LedUnit
                {
                    LEDName = "LED " + i.ToString(),
                    Data    = new PositionalLEDData()
                    {
                        X         = xPos,
                        Y         = yPos,
                        LEDNumber = i
                    }
                };
                xPos++;
            }
        }
Esempio n. 2
0
        public List <Type> GetMappers(ISimpleLed driver)
        {
            List <Type> result = new List <Type>();

            result.Add(typeof(LMatrix));
            result.Add(typeof(SMatrix));

            //TODO fix STA stuff
            //var props = driver.GetProperties();
            //if (props?.GetMappers != null)
            //{
            //    result.AddRange(props.GetMappers());
            //}

            return(result);
        }
Esempio n. 3
0
        public HeadSetDevice(string url, ISimpleLed driver)
        {
            baseUrl      = url;
            Driver       = driver;
            DeviceType   = DeviceTypes.Headset;
            Name         = "Headset";
            ProductImage = RazerDriver.GetImage("Headset");
            Has2DSupport = false;
            LEDs         = new LedUnit[5];

            for (int i = 0; i < 5; i++)
            {
                LEDs[i] = new LedUnit
                {
                    LEDName = "LED " + i.ToString(),
                    Data    = new LEDData
                    {
                        LEDNumber = i
                    }
                };
            }
        }
Esempio n. 4
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
                    }
                };
            }
        }
Esempio n. 5
0
        public static Dictionary <string, Type> GetMapperLookup(ISimpleLed driver)
        {
            List <Type> result = new List <Type>();

            result.Add(typeof(LMatrix));
            result.Add(typeof(SMatrix));

            var props = driver.GetProperties();

            if (props?.GetMappers != null)
            {
                result.AddRange(props.GetMappers());
            }

            Dictionary <string, Type> r = new Dictionary <string, Type>();

            foreach (Type type in result)
            {
                Mapper t = (Mapper)Activator.CreateInstance(type);
                r.Add(t.GetName(), type);
            }

            return(r);
        }
Esempio n. 6
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++;
            }
        }
Esempio n. 7
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++;
            }
        }
Esempio n. 8
0
 private void DeviceRescanRequired(ISimpleLed drv)
 {
     RescanRequired?.Invoke(this, new EventArgs());
 }