public void Post([FromBody] RobotCommand value) { if (value == null) { Response.StatusCode = 400; _logger.LogError("can't resolve argument"); return; } switch (value.Operation) { case RobotOperation.StopMotors: _robot.DisableMotors(); break; case RobotOperation.StartMotors: _robot.StartRobot(); break; case RobotOperation.StopVideo: _videoService.StopStream(); break; case RobotOperation.StartVideo: _videoService.EnsureStreamOn(); break; default: throw new ArgumentOutOfRangeException(); } }
public async Task OnGetAsync() { await _videoService.EnsureStreamOn(); }