Exemplo n.º 1
0
        public async void BlinkLight(IAuraSyncDevice device, int lightId)
        {
            if (tokenSource != null && !tokenSource.Token.IsCancellationRequested)
            {
                tokenSource.Cancel();
            }

            tokenSource = new CancellationTokenSource();
            for (int i = 0; i < BlinkCount; i++)
            {
                if (tokenSource.IsCancellationRequested || device == null)
                {
                    return;
                }

                // set everything to black
                foreach (IAuraRgbLight light in device.Lights)
                {
                    light.Color = 0;
                }

                // set this one key to white
                if (i % 2 == 1)
                {
                    device.Lights[lightId].Red   = 255;
                    device.Lights[lightId].Green = 255;
                    device.Lights[lightId].Blue  = 255;
                }

                device.Apply();
                await Task.Delay(200); // ms
            }
        }
Exemplo n.º 2
0
 public AsusConfigDevice(IAuraSyncDevice device)
 {
     Name      = device.Name;
     Enabled   = true;
     Type      = device.Type;
     KeyCount  = device.Lights.Count;
     KeyMapper = new Dictionary <int, DeviceKeys>();
 }
Exemplo n.º 3
0
        /// <summary>
        /// Internal constructor of managed <see cref="AsusRGBDeviceInfo"/>.
        /// </summary>
        /// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param>
        /// <param name="device">The <see cref="IAuraSyncDevice"/> backing this RGB.NET device.</param>
        /// <param name="manufacturer">The manufacturer-name of the <see cref="IRGBDevice"/>.</param>
        /// <param name="model">The model-name of the <see cref="IRGBDevice"/>.</param>
        internal AsusRGBDeviceInfo(RGBDeviceType deviceType, IAuraSyncDevice device, string model = null, string manufacturer = "Asus")
        {
            this.DeviceType   = deviceType;
            this.Device       = device;
            this.Model        = model ?? device.Name;
            this.Manufacturer = manufacturer;

            DeviceName = $"{Manufacturer} {Model}";
        }
Exemplo n.º 4
0
        public AsusSdkAdapter()
        {
            var sdk = (IAuraSdk2) new AuraSdk();

            sdk.SwitchMode();
            var devices = sdk.Enumerate(528384);

            this._sdk = sdk;
            this._notebookKeyboard = devices.Count > 0 ? devices[0] : null;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates an Asus device
        /// </summary>
        /// <param name="device">The device</param>
        /// <param name="logger">The logger</param>
        internal AsusDevice(IAuraSyncDevice device, ILogger <AsusDeviceProvider> logger)
        {
            _device = device;
            _lights = new List <AsusDeviceLight>();
            _logger = logger;

            foreach (IAuraRgbLight light in _device.Lights)
            {
                _lights.Add(new AsusDeviceLight(light));
            }
        }
 /// <summary>
 /// Constructor for ASUS Rog Strix G15 (2021) laptop adapter.
 /// </summary>
 public AsusRogStrix_G15_2021_Adapter()
 {
     try
     {
         var sdk = (IAuraSdk2) new AuraSdk();
         sdk.SwitchMode();
         var devices = sdk.Enumerate(528384);
         this._sdk = sdk;
         this._notebookKeyboard = devices.Count > 0 ? devices[0] : throw new Exception("No Asus device attached.");
         this.Initialized       = true;
     }
     catch (Exception)
     {
         this.Initialized = false;
     }
 }
Exemplo n.º 7
0
 public AuraSyncRgbLed(IAuraSyncDevice dev, int lightIdx)
 {
     this.dev = dev;
     light    = dev.Lights[(int)lightIdx];
 }
Exemplo n.º 8
0
 /// <inheritdoc />
 public AsusSyncConfiguredDevice(AsusHandler asusHandler, IAuraSyncDevice device, AsusConfig.AsusConfigDevice config, int frameRate = 30) : base(asusHandler, device, frameRate)
 {
     this.config = config;
     allConfigDevices.Add(this);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Initializes the queue.
 /// </summary>
 /// <param name="device">The device to be updated.</param>
 public void Initialize(IAuraSyncDevice device)
 {
     Device = device;
 }
Exemplo n.º 10
0
 /// <inheritdoc />
 /// <summary>
 /// Internal constructor of managed <see cref="T:RGB.NET.Devices.Asus.AsusKeyboardRGBDeviceInfo" />.
 /// </summary>
 /// <param name="device">The <see cref="IAuraSyncDevice"/> backing this RGB.NET device.</param>
 /// <param name="culture">The <see cref="T:System.Globalization.CultureInfo" /> of the layout this keyboard is using.</param>
 internal AsusKeyboardRGBDeviceInfo(IAuraSyncDevice device, CultureInfo culture)
     : base(RGBDeviceType.Keyboard, device, "Claymore")
 {
     SetLayouts(culture.KeyboardLayoutId);
 }
Exemplo n.º 11
0
 public AuraSyncDevice(AsusHandler asusHandler, IAuraSyncDevice device, int frameRate = 30)
 {
     this.asusHandler = asusHandler;
     this.device      = device;
     frameRateMillis  = (int)((1f / frameRate) * 1000f);
 }
Exemplo n.º 12
0
 public AuraDevice(IAuraSyncDevice device)
 {
     RawDevice      = device;
     UpdateRequired = true;
 }
Exemplo n.º 13
0
 /// <inheritdoc />
 public AsusSyncClaymoreDevice(AsusHandler asusHandler, IAuraSyncDevice device, int frameRate = 30) : base(
     asusHandler, device, frameRate) { }
Exemplo n.º 14
0
 public WrappedDevice(IAuraSyncDevice thisDevice)
 {
     device = thisDevice;
     name   = thisDevice.Name;
 }