/// <inheritdoc /> protected override void Update(Dictionary <object, Color> dataSet) { try { if ((Device.Type == (uint)AsusDeviceType.KEYBOARD_RGB) || (Device.Type == (uint)AsusDeviceType.NB_KB_RGB)) { foreach (KeyValuePair <object, Color> data in dataSet) { AsusLedId index = (AsusLedId)data.Key; IAuraSyncKeyboard keyboard = (IAuraSyncKeyboard)Device; if (keyboard != null) { IAuraRgbLight light = index switch { //UK keyboard Layout AsusLedId.KEY_OEM_102 => keyboard.Lights[(int)((3 * keyboard.Width) + 13)], AsusLedId.UNDOCUMENTED_1 => keyboard.Lights[(int)((4 * keyboard.Width) + 1)], _ => keyboard.Key[(ushort)index] }; // Asus Strix Scope if (keyboard.Name == "Charm") { light = index switch { AsusLedId.KEY_LWIN => keyboard.Lights[(int)((5 * keyboard.Width) + 2)], AsusLedId.KEY_LMENU => keyboard.Lights[(int)((5 * keyboard.Width) + 3)], _ => light } } ; (_, byte r, byte g, byte b) = data.Value.GetRGBBytes(); light.Red = r; light.Green = g; light.Blue = b; } } } else { foreach (KeyValuePair <object, Color> data in dataSet) { int index = (int)data.Key; IAuraRgbLight light = Device.Lights[index]; (_, byte r, byte g, byte b) = data.Value.GetRGBBytes(); light.Red = r; light.Green = g; light.Blue = b; } } Device.Apply(); } catch { /* "The server threw an exception." seems to be a thing here ... */ } }
public static void PrintDeviceInfo() { AuraDevelopment.AURARequireToken(0); PrintLine("DEVICES"); PrintLine("Retrieving..."); var allDevices = AuraDevelopment.GetAllDevices(); foreach (IAuraDevice auraDevice in allDevices) { var foundType = IsValidEnum(typeof(AsusDeviceType), (int)auraDevice.Type); PrintLine($@"------- Name: {auraDevice.Name} Hardware: {(foundType ? ((AsusDeviceType)auraDevice.Type).ToString() : "UNKNOWN" )} Model: {auraDevice.Manufacture} Manufacture: {auraDevice.Model} Light Count: {auraDevice.LightCount} Light Count Variable: {auraDevice.LightCountVariable} Default Light Count: {auraDevice.DefaultLightCount} Width: {auraDevice.Width} Height: {auraDevice.Height} "); if (auraDevice.Lights.Count > 0) { PrintLine("Lights"); for (var i = 0; i < auraDevice.Lights.Count; i++) { IAuraRgbLight light = auraDevice.Lights[i]; PrintLine($" {i:D3}:{light.Name}"); } } if (auraDevice.Effects.Count > 0) { PrintLine("Effects"); foreach (IAuraEffect auraDeviceEffect in auraDevice.Effects) { PrintLine($" {auraDeviceEffect.Name}"); } } if (auraDevice.StandbyEffects.Count > 0) { PrintLine("Standby Effects"); foreach (IAuraEffect auraDeviceEffect in auraDevice.StandbyEffects) { PrintLine($" {auraDeviceEffect.Name}"); } } } PrintLine("-------"); }
/// <inheritdoc /> protected override void Update(Dictionary <object, Color> dataSet) { try { foreach (KeyValuePair <object, Color> data in dataSet) { int index = (int)data.Key; IAuraRgbLight light = Device.Lights[index]; (_, byte r, byte g, byte b) = data.Value.GetRGBBytes(); light.Red = r; light.Green = g; light.Blue = b; } Device.Apply(); } catch (Exception ex) { /* "The server threw an exception." seems to be a thing here ... */ } }
public AuraSyncRgbLed(IAuraSyncDevice dev, int lightIdx) { this.dev = dev; light = dev.Lights[(int)lightIdx]; }
//0x00BBGGRR protected void SetRgbLight(IAuraRgbLight rgbLight, Color color) { rgbLight.Color = (uint)(color.R | color.G << 8 | color.B << 16); }