public static void SetCommand(double value, FlightCommand commandType) { Mutex mutex = new Mutex(); mutex.WaitOne(); switch (commandType) { case FlightCommand.Rudder: ServerConnectionManager.SetCommandInServer(ViewConstants.control_command_rudder, value); break; case FlightCommand.Elevator: ServerConnectionManager.SetCommandInServer(ViewConstants.control_command_elevator, value); break; case FlightCommand.Throttle: ServerConnectionManager.SetCommandInServer(ViewConstants.control_command_throttle, value); break; case FlightCommand.Aileron: ServerConnectionManager.SetCommandInServer(ViewConstants.control_command_aileron, value); break; } mutex.ReleaseMutex(); }
public IActionResult SendCommand([FromBody] FlightCommand flightCommand) { if (_simulatorConnector.SendCommand(flightCommand)) { return(Ok(new Response("Success"))); } return(BadRequest(new Response("Could not send command."))); }