public async Task HandleMessage( string rawMessage, EliteSharedState sharedState, ArduinoCommunication.Arduino arduino) { var message = JsonConvert.DeserializeObject <CommonCommunication.Message>(rawMessage); Logger?.LogDebug($"Message Type received: {message.Type}"); switch (message?.Type) { case "client_ready": await Task.Run(() => Client.CreateConnection(message.Data)).ConfigureAwait(false); break; case "connect_joysticks": await Task.Run(ConnectJoysticks).ConfigureAwait(false); break; case "disconnect_joysticks": await Task.Run(DisconnectJoysticks).ConfigureAwait(false); break; case "connect_arduino": await Task.Run(ConnectArduino).ConfigureAwait(false); break; case "disconnect_arduino": await Task.Run(DisconnectArduino).ConfigureAwait(false); break; case "reconnect_arduino": await Task.Run(ReconnectArduino).ConfigureAwait(false); break; //case "keypress": // await Task.Run(() => KeyPress(message.Data)).ConfigureAwait(false); // break; case "keyboard_output": await ArduinoCommunication.Utils.TypeFullString(arduino, message.Data, Logger).ConfigureAwait(false); break; default: //Unknown message break; } }
public static GhKpController Create(EliteSharedState sharedState, vJoy vjoy, vJoyMapper vJoyMapper) { return(new GhKpController() { Controller = Faz.SideWinderSC.Logic.KeypadController.RetrieveAll()?.First(), SharedState = sharedState, //vJoy = vjoy, vJoyMapper = vJoyMapper, //VisualState = new VisualState { Name = Name } }); }
public static ScController Create( EliteSharedState sharedState, vJoy vjoy, EliteVirtualJoysticks virtualJoysticks, vJoyMapper vJoyMapper) { return(new ScController() { Controller = SwscController.RetrieveAll()?.First(), SharedState = sharedState, //vJoy = vjoy, VirtualJoysticks = virtualJoysticks, vJoyMapper = vJoyMapper, }); }
public static ChPedalsController Create( EliteSharedState sharedState, vJoyInterfaceWrap.vJoy vjoy, EliteVirtualJoysticks virtualJoysticks, vJoyMapper vJoyMapper) { return(new ChPedalsController() { Controller = Faz.SideWinderSC.Logic.CHPedalsController.RetrieveAll()?.First(), SharedState = sharedState, //vJoy = vjoy, VirtualJoysticks = virtualJoysticks, vJoyMapper = vJoyMapper, }); }
public static TmThrottleController Create(EliteSharedState sharedState, vJoy vjoy, EliteVirtualJoysticks virtualJoysticks, vJoyMapper vJoyMapper, ArduinoCommunication.Arduino arduino) { return(new TmThrottleController() { Controller = Faz.SideWinderSC.Logic.TMWartHogThrottleController.RetrieveAll()?.First(), SharedState = sharedState, VirtualJoysticks = virtualJoysticks, vJoyMapper = vJoyMapper, Arduino = arduino }); }
public static SwGvController Create( EliteSharedState sharedState, vJoy vjoy, EliteVirtualJoysticks virtualJoysticks, vJoyMapper vJoyMapper) { return(new SwGvController() { Controller = SwgvController.RetrieveAll()?.First(), SharedState = sharedState, //vJoy = vjoy, VirtualJoysticks = virtualJoysticks, vJoyMapper = vJoyMapper, //VisualState = new VisualState { Name = Name } }); }
public static ChPedalsController Create(EliteSharedState sharedState, vJoyInterfaceWrap.vJoy vjoy, vJoyMapper vJoyMapper) { return(new ChPedalsController() { Controller = Faz.SideWinderSC.Logic.CHPedalsController.RetrieveAll()?.First(), SharedState = sharedState, vJoy = vjoy, vJoyMapper = vJoyMapper, VisualState = new VisualState { Name = Name } }); }
public static ScController Create(EliteSharedState sharedState, vJoy vjoy, vJoyMapper vJoyMapper) { return(new ScController() { Controller = SwscController.RetrieveAll()?.First(), SharedState = sharedState, vJoy = vjoy, vJoyMapper = vJoyMapper, VisualState = new VisualState { Name = Name } }); }
public static TmThrottleController Create(EliteSharedState sharedState, vJoy vjoy, vJoyMapper vJoyMapper, ArduinoCommunication.Arduino arduino) { return(new TmThrottleController() { Controller = Faz.SideWinderSC.Logic.TMWartHogThrottleController.RetrieveAll()?.First(), SharedState = sharedState, vJoy = vjoy, vJoyMapper = vJoyMapper, Arduino = arduino, VisualState = new VisualState { Name = Name } }); }
public static ButtonBoxController Create(EliteSharedState sharedState, vJoy vjoy, vJoyMapper vJoyMapper, ArduinoCommunication.Arduino arduino) { return(new ButtonBoxController() { Controller = BBI32Controller.RetrieveAll()?.First(), SharedState = sharedState, vJoy = vjoy, vJoyMapper = vJoyMapper, Arduino = arduino, VisualState = new VisualState { Name = Name } }); }
public static Swff2Controller Create(EliteSharedState sharedState, vJoy vjoy, EliteVirtualJoysticks virtualJoysticks, vJoyMapper vJoyMapper, ArduinoCommunication.Arduino arduino) { try { return(new Swff2Controller() { Controller = Faz.SideWinderSC.Logic.Swff2Controller.RetrieveAll().First(), SharedState = sharedState, //vJoy = vjoy, VirtualJoysticks = virtualJoysticks, vJoyMapper = vJoyMapper, Arduino = arduino, }); } catch (InvalidOperationException) { } return(null); }
public void TestMethod1() { try { List <Controller> Controllers = new List <Controller>(); EliteVirtualJoysticks eliteVirtualJoysticks = new EliteVirtualJoysticks(); vJoyMapper vJoyMapper = new vJoyMapper(); EliteSharedState SharedState = new EliteSharedState { OrbitLines = true, HeadsUpDisplay = true }; ArduinoCommunication.Arduino arduino = null; Settings settings = Settings.Load(); var ffb2 = new vJoyMapping.Microsoft.Sidewinder.ForceFeedback2.Controller { Arduino = arduino, Name = "Force Feedback 2", SharedState = SharedState, Settings = settings, VirtualJoysticks = eliteVirtualJoysticks }; Controllers.Add(ffb2); var swgv = new vJoyMapping.Microsoft.Sidewinder.GameVoice.Controller { Arduino = arduino, Name = "Game Voice", SharedState = SharedState, Settings = settings, VirtualJoysticks = eliteVirtualJoysticks }; Controllers.Add(swgv); var swsc = new vJoyMapping.Microsoft.Sidewinder.StrategicCommander.Controller { Arduino = arduino, Name = "Strategic Commander", SharedState = SharedState, Settings = settings, VirtualJoysticks = eliteVirtualJoysticks }; Controllers.Add(swsc); var warthog = new vJoyMapping.Thrustmaster.Warthog.Throttle.Controller { Arduino = arduino, Name = "Warthog Throttle", SharedState = SharedState, Settings = settings, VirtualJoysticks = eliteVirtualJoysticks }; Controllers.Add(warthog); var pedals = new vJoyMapping.CHProducts.ProPedals.Controller { Arduino = arduino, Name = "Pro Pedals", SharedState = SharedState, Settings = settings, VirtualJoysticks = eliteVirtualJoysticks }; Controllers.Add(pedals); var bbi32 = new vJoyMapping.LeoBodnar.BBI32.Controller { Arduino = arduino, Name = "BBI32", SharedState = SharedState, Settings = settings, VirtualJoysticks = eliteVirtualJoysticks }; Controllers.Add(bbi32); // State Handlers var subscription = SharedState.GearChanged.Subscribe( x => ffb2.CallActivateButton(vJoyTypes.Virtual, MappedButtons.LandingGearToggle, 200)); while (true) { Thread.Sleep(1000); } } catch (Exception) { ; } }