Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
CameraError
If the request fails. The error contains the reason for the failure.
"""
request = camera_pb2.SetSettingRequest()
setting.translate_to_rpc(request.setting)
response = await self._stub.SetSetting(request)
result = self._extract_result(response)
if result.result is not CameraResult.Result.SUCCESS:
raise CameraError(result, "set_setting()", setting)
Take one photo.
Raises
------
CameraError
If the request fails. The error contains the reason for the failure.
"""
request = camera_pb2.TakePhotoRequest()
response = await self._stub.TakePhoto(request)
result = self._extract_result(response)
if result.result is not CameraResult.Result.SUCCESS:
raise CameraError(result, "take_photo()")
Start video streaming.
Raises
------
CameraError
If the request fails. The error contains the reason for the failure.
"""
request = camera_pb2.StartVideoStreamingRequest()
response = await self._stub.StartVideoStreaming(request)
result = self._extract_result(response)
if result.result is not CameraResult.Result.SUCCESS:
raise CameraError(result, "start_video_streaming()")
Raises
------
CameraError
If the request fails. The error contains the reason for the failure.
"""
request = camera_pb2.StartPhotoIntervalRequest()
request.interval_s = interval_s
response = await self._stub.StartPhotoInterval(request)
result = self._extract_result(response)
if result.result is not CameraResult.Result.SUCCESS:
raise CameraError(result, "start_photo_interval()", interval_s)
Start a video recording.
Raises
------
CameraError
If the request fails. The error contains the reason for the failure.
"""
request = camera_pb2.StartVideoRequest()
response = await self._stub.StartVideo(request)
result = self._extract_result(response)
if result.result is not CameraResult.Result.SUCCESS:
raise CameraError(result, "start_video()")
CameraError
If the request fails. The error contains the reason for the failure.
"""
request = camera_pb2.SetModeRequest()
camera_mode.translate_to_rpc(request.camera_mode)
response = await self._stub.SetMode(request)
result = self._extract_result(response)
if result.result is not CameraResult.Result.SUCCESS:
raise CameraError(result, "set_mode()", camera_mode)
Stop current video streaming.
Raises
------
CameraError
If the request fails. The error contains the reason for the failure.
"""
request = camera_pb2.StopVideoStreamingRequest()
response = await self._stub.StopVideoStreaming(request)
result = self._extract_result(response)
if result.result is not CameraResult.Result.SUCCESS:
raise CameraError(result, "stop_video_streaming()")
Stop a running photo timelapse.
Raises
------
CameraError
If the request fails. The error contains the reason for the failure.
"""
request = camera_pb2.StopPhotoIntervalRequest()
response = await self._stub.StopPhotoInterval(request)
result = self._extract_result(response)
if result.result is not CameraResult.Result.SUCCESS:
raise CameraError(result, "stop_photo_interval()")
Stop a running video recording.
Raises
------
CameraError
If the request fails. The error contains the reason for the failure.
"""
request = camera_pb2.StopVideoRequest()
response = await self._stub.StopVideo(request)
result = self._extract_result(response)
if result.result is not CameraResult.Result.SUCCESS:
raise CameraError(result, "stop_video()")