public void MapControls(Usb.GameControllers.Microsoft.Sidewinder.StrategicCommander.Joystick swsc) { // Add in the mappings Disposables = new List <IDisposable> { swsc.Where(x => Reactive.ButtonsChanged(x)).Subscribe(x => SwCommanderButtonStateHandler.Process(x, this), ex => Logger.LogError($"Exception : {ex}")), swsc.Subscribe(x => SwCommanderProfileHandler.Process(x, this), ex => Logger.LogError($"Exception : {ex}")), swsc.Subscribe(x => SwCommanderXYZJoystick.Process(x, this), ex => Logger.LogError($"Exception : {ex}")), swsc.Where(x => Reactive.ButtonsChanged(x)).Subscribe(x => SwCommanderProgramIds.Process(x, this), ex => Logger.LogError($"Exception : {ex}")) }; }
public void Initialize(string devicePath) { var joystick = new Usb.GameControllers.Microsoft.Sidewinder.StrategicCommander.Joystick(devicePath, Logger); MapControls(joystick); MapLights(joystick); joystick.Initialize(); joystick.ReadInputReportAsync().Wait(); }
public void MapLights(Usb.GameControllers.Microsoft.Sidewinder.StrategicCommander.Joystick swsc) { // Turn lights on and off SharedState.ModeChanged.Subscribe(x => swsc.SetLights(GetLights(x))); }