static void Main(string[] args) { IAuraSdk sdk = new AuraSdk(); sdk.SwitchMode(); foreach (IAuraSyncDevice dev in sdk.Enumerate(0)) { wrappedDevices.Add(new WrappedDevice(dev)); } TimerCallback tmCallback = runUpdate; Timer timer = new Timer(tmCallback, "", 0, 33); Thread.Sleep(30000); timer.Dispose(); }
public bool Start() { if (AuraSdk == null) { return(false); } lock (deviceLock) { try { AuraSdk.SwitchMode(); var config = AsusConfig.LoadConfig(); var allDevices = AuraSdk.Enumerate((uint)AsusDeviceType.All); foreach (IAuraSyncDevice device in allDevices) { AsusDeviceType deviceType; if (Enum.IsDefined(typeof(AsusDeviceType), device.Type)) { deviceType = (AsusDeviceType)device.Type; } else { deviceType = AsusDeviceType.Unknown; Log($"Could not read device type {device.Type} marking as Unknown"); } Log($"Added device {device.Name} of type {deviceType} it has {device.Lights.Count} lights"); var configIndex = config.Devices.IndexOf(new AsusConfig.AsusConfigDevice(device)); if (configIndex >= 0) { var configDevice = config.Devices[configIndex]; if (configDevice.Enabled) { devices.Add(new AsusSyncConfiguredDevice(this, device, config.Devices[configIndex])); continue; } } // Claymore Keyboard is not a IAuraSyncKeyboard, so a custom class has been made for it if (device.Name == "Armoury" && deviceType == AsusDeviceType.Keyboard) { devices.Add(new AsusSyncClaymoreDevice(this, device)); continue; } switch (deviceType) { case AsusDeviceType.Keyboard: case AsusDeviceType.NotebookKeyboard: case AsusDeviceType.NotebookKeyboard4ZoneType: try { devices.Add(new AuraSyncKeyboardDevice(this, (IAuraSyncKeyboard)device)); } catch (Exception e) { Log($"Something went wrong with reading your device as a keyboard {device} using as generic aura sync device\r\n{e}"); devices.Add(new AuraSyncDevice(this, device)); } break; // ignore whatever this is case AsusDeviceType.All: // ignore terminal for now, there are 270 lights :0 case AsusDeviceType.Terminal: break; default: devices.Add(new AuraSyncDevice(this, device)); break; } } foreach (AuraSyncDevice device in devices) { device.Start(); } } catch (Exception e) { Log($"ERROR: Are you using \"Lighting_Control_1.07.71\"? \r\n{e}"); return(false); } } return(true); }