public ActionResult AddBigMotor(string id, int offset) { var found = inputDeviceManager.ChangeInputConfiguration(id, config => { config.BigMotors.Add(offset); }); if (!found) { return(NotFound("Device not found")); } return(NoContent()); }
public ActionResult SetDeadzone(string id, InputDeviceMethod method, int offset, [FromBody] double deadzone) { var device = inputDeviceManager.FindInputDevice(id); if (device == null) { return(NotFound("Device not found")); } var inputDevice = device.FindInput(method); if (inputDevice == null) { return(NotFound("Input device method not found")); } var source = inputDevice.FindSource(offset); if (source == null) { return(NotFound("ForceFeedback target not found")); } inputDeviceManager.ChangeInputConfiguration(id, method, (inputDevice) => { var config = inputDevice.InputConfiguration.Sources.FirstOrDefault(s => s.Offset == offset); if (config == null) { config = new InputSourceConfig { Offset = offset, }; inputDevice.InputConfiguration.Sources.Add(config); } config.Deadzone = deadzone; }); return(NoContent()); }