From c267f319ffed6f6aefaa6fb834cd9ae2767797c0 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Fri, 26 Mar 2021 10:32:24 +0100 Subject: [PATCH] Update to MAVSDK v0.38.2 --- MAVSDK_SERVER_VERSION | 2 +- mavsdk/camera.py | 88 ++++++- mavsdk/camera_pb2.py | 53 +++- mavsdk/log_files.py | 13 +- mavsdk/log_files_pb2.py | 35 +-- mavsdk/server_utility.py | 291 ++++++++++++++++++++++ mavsdk/server_utility_pb2.py | 304 +++++++++++++++++++++++ mavsdk/server_utility_pb2_grpc.py | 73 ++++++ mavsdk/source/plugins/index.rst | 1 + mavsdk/source/plugins/server_utility.rst | 8 + proto | 2 +- 11 files changed, 833 insertions(+), 37 deletions(-) create mode 100644 mavsdk/server_utility.py create mode 100644 mavsdk/server_utility_pb2.py create mode 100644 mavsdk/server_utility_pb2_grpc.py create mode 100644 mavsdk/source/plugins/server_utility.rst diff --git a/MAVSDK_SERVER_VERSION b/MAVSDK_SERVER_VERSION index c4041f14..671b10c4 100644 --- a/MAVSDK_SERVER_VERSION +++ b/MAVSDK_SERVER_VERSION @@ -1,4 +1,4 @@ -v0.36.0 +v0.38.2 diff --git a/mavsdk/camera.py b/mavsdk/camera.py index 23b27112..37d73816 100644 --- a/mavsdk/camera.py +++ b/mavsdk/camera.py @@ -1563,6 +1563,21 @@ class Information: model_name : std::string Name of the camera model + focal_length_mm : float + Focal length + + horizontal_sensor_size_mm : float + Horizontal sensor size + + vertical_sensor_size_mm : float + Vertical sensor size + + horizontal_resolution_px : uint32_t + Horizontal image resolution in pixels + + vertical_resolution_px : uint32_t + Vertical image resolution in pixels + """ @@ -1570,10 +1585,20 @@ class Information: def __init__( self, vendor_name, - model_name): + model_name, + focal_length_mm, + horizontal_sensor_size_mm, + vertical_sensor_size_mm, + horizontal_resolution_px, + vertical_resolution_px): """ Initializes the Information object """ self.vendor_name = vendor_name self.model_name = model_name + self.focal_length_mm = focal_length_mm + self.horizontal_sensor_size_mm = horizontal_sensor_size_mm + self.vertical_sensor_size_mm = vertical_sensor_size_mm + self.horizontal_resolution_px = horizontal_resolution_px + self.vertical_resolution_px = vertical_resolution_px def __equals__(self, to_compare): """ Checks if two Information are the same """ @@ -1582,7 +1607,12 @@ def __equals__(self, to_compare): # Information object return \ (self.vendor_name == to_compare.vendor_name) and \ - (self.model_name == to_compare.model_name) + (self.model_name == to_compare.model_name) and \ + (self.focal_length_mm == to_compare.focal_length_mm) and \ + (self.horizontal_sensor_size_mm == to_compare.horizontal_sensor_size_mm) and \ + (self.vertical_sensor_size_mm == to_compare.vertical_sensor_size_mm) and \ + (self.horizontal_resolution_px == to_compare.horizontal_resolution_px) and \ + (self.vertical_resolution_px == to_compare.vertical_resolution_px) except AttributeError: return False @@ -1591,7 +1621,12 @@ def __str__(self): """ Information in string representation """ struct_repr = ", ".join([ "vendor_name: " + str(self.vendor_name), - "model_name: " + str(self.model_name) + "model_name: " + str(self.model_name), + "focal_length_mm: " + str(self.focal_length_mm), + "horizontal_sensor_size_mm: " + str(self.horizontal_sensor_size_mm), + "vertical_sensor_size_mm: " + str(self.vertical_sensor_size_mm), + "horizontal_resolution_px: " + str(self.horizontal_resolution_px), + "vertical_resolution_px: " + str(self.vertical_resolution_px) ]) return f"Information: [{struct_repr}]" @@ -1604,7 +1639,22 @@ def translate_from_rpc(rpcInformation): rpcInformation.vendor_name, - rpcInformation.model_name + rpcInformation.model_name, + + + rpcInformation.focal_length_mm, + + + rpcInformation.horizontal_sensor_size_mm, + + + rpcInformation.vertical_sensor_size_mm, + + + rpcInformation.horizontal_resolution_px, + + + rpcInformation.vertical_resolution_px ) def translate_to_rpc(self, rpcInformation): @@ -1623,6 +1673,36 @@ def translate_to_rpc(self, rpcInformation): + + + rpcInformation.focal_length_mm = self.focal_length_mm + + + + + + rpcInformation.horizontal_sensor_size_mm = self.horizontal_sensor_size_mm + + + + + + rpcInformation.vertical_sensor_size_mm = self.vertical_sensor_size_mm + + + + + + rpcInformation.horizontal_resolution_px = self.horizontal_resolution_px + + + + + + rpcInformation.vertical_resolution_px = self.vertical_resolution_px + + + diff --git a/mavsdk/camera_pb2.py b/mavsdk/camera_pb2.py index 8f598692..b5805305 100644 --- a/mavsdk/camera_pb2.py +++ b/mavsdk/camera_pb2.py @@ -21,7 +21,7 @@ syntax='proto3', serialized_options=b'\n\020io.mavsdk.cameraB\013CameraProto', create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\x13\x63\x61mera/camera.proto\x12\x11mavsdk.rpc.camera\x1a\x14mavsdk_options.proto\"\x12\n\x10TakePhotoRequest\"K\n\x11TakePhotoResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\"/\n\x19StartPhotoIntervalRequest\x12\x12\n\ninterval_s\x18\x01 \x01(\x02\"T\n\x1aStartPhotoIntervalResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\"\x1a\n\x18StopPhotoIntervalRequest\"S\n\x19StopPhotoIntervalResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\"\x13\n\x11StartVideoRequest\"L\n\x12StartVideoResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\"\x12\n\x10StopVideoRequest\"K\n\x11StopVideoResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\"\x1c\n\x1aStartVideoStreamingRequest\"U\n\x1bStartVideoStreamingResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\"\x1b\n\x19StopVideoStreamingRequest\"T\n\x1aStopVideoStreamingResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\"7\n\x0eSetModeRequest\x12%\n\x04mode\x18\x01 \x01(\x0e\x32\x17.mavsdk.rpc.camera.Mode\"I\n\x0fSetModeResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\"I\n\x11ListPhotosRequest\x12\x34\n\x0cphotos_range\x18\x01 \x01(\x0e\x32\x1e.mavsdk.rpc.camera.PhotosRange\"\x83\x01\n\x12ListPhotosResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\x12\x35\n\rcapture_infos\x18\x02 \x03(\x0b\x32\x1e.mavsdk.rpc.camera.CaptureInfo\"\x1d\n\x1bSubscribeInformationRequest\"J\n\x13InformationResponse\x12\x33\n\x0binformation\x18\x01 \x01(\x0b\x32\x1e.mavsdk.rpc.camera.Information\"\x16\n\x14SubscribeModeRequest\"5\n\x0cModeResponse\x12%\n\x04mode\x18\x01 \x01(\x0e\x32\x17.mavsdk.rpc.camera.Mode\"!\n\x1fSubscribeVideoStreamInfoRequest\"X\n\x17VideoStreamInfoResponse\x12=\n\x11video_stream_info\x18\x01 \x01(\x0b\x32\".mavsdk.rpc.camera.VideoStreamInfo\"\x1d\n\x1bSubscribeCaptureInfoRequest\"K\n\x13\x43\x61ptureInfoResponse\x12\x34\n\x0c\x63\x61pture_info\x18\x01 \x01(\x0b\x32\x1e.mavsdk.rpc.camera.CaptureInfo\"\x18\n\x16SubscribeStatusRequest\"B\n\x0eStatusResponse\x12\x30\n\rcamera_status\x18\x01 \x01(\x0b\x32\x19.mavsdk.rpc.camera.Status\"!\n\x1fSubscribeCurrentSettingsRequest\"O\n\x17\x43urrentSettingsResponse\x12\x34\n\x10\x63urrent_settings\x18\x01 \x03(\x0b\x32\x1a.mavsdk.rpc.camera.Setting\"(\n&SubscribePossibleSettingOptionsRequest\"\\\n\x1ePossibleSettingOptionsResponse\x12:\n\x0fsetting_options\x18\x01 \x03(\x0b\x32!.mavsdk.rpc.camera.SettingOptions\"@\n\x11SetSettingRequest\x12+\n\x07setting\x18\x01 \x01(\x0b\x32\x1a.mavsdk.rpc.camera.Setting\"L\n\x12SetSettingResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\"@\n\x11GetSettingRequest\x12+\n\x07setting\x18\x01 \x01(\x0b\x32\x1a.mavsdk.rpc.camera.Setting\"y\n\x12GetSettingResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\x12+\n\x07setting\x18\x02 \x01(\x0b\x32\x1a.mavsdk.rpc.camera.Setting\"\x16\n\x14\x46ormatStorageRequest\"O\n\x15\x46ormatStorageResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\"\x8a\x02\n\x0c\x43\x61meraResult\x12\x36\n\x06result\x18\x01 \x01(\x0e\x32&.mavsdk.rpc.camera.CameraResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t\"\xad\x01\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x16\n\x12RESULT_IN_PROGRESS\x10\x02\x12\x0f\n\x0bRESULT_BUSY\x10\x03\x12\x11\n\rRESULT_DENIED\x10\x04\x12\x10\n\x0cRESULT_ERROR\x10\x05\x12\x12\n\x0eRESULT_TIMEOUT\x10\x06\x12\x19\n\x15RESULT_WRONG_ARGUMENT\x10\x07\"q\n\x08Position\x12\x14\n\x0clatitude_deg\x18\x01 \x01(\x01\x12\x15\n\rlongitude_deg\x18\x02 \x01(\x01\x12\x1b\n\x13\x61\x62solute_altitude_m\x18\x03 \x01(\x02\x12\x1b\n\x13relative_altitude_m\x18\x04 \x01(\x02\"8\n\nQuaternion\x12\t\n\x01w\x18\x01 \x01(\x02\x12\t\n\x01x\x18\x02 \x01(\x02\x12\t\n\x01y\x18\x03 \x01(\x02\x12\t\n\x01z\x18\x04 \x01(\x02\"B\n\nEulerAngle\x12\x10\n\x08roll_deg\x18\x01 \x01(\x02\x12\x11\n\tpitch_deg\x18\x02 \x01(\x02\x12\x0f\n\x07yaw_deg\x18\x03 \x01(\x02\"\xff\x01\n\x0b\x43\x61ptureInfo\x12-\n\x08position\x18\x01 \x01(\x0b\x32\x1b.mavsdk.rpc.camera.Position\x12:\n\x13\x61ttitude_quaternion\x18\x02 \x01(\x0b\x32\x1d.mavsdk.rpc.camera.Quaternion\x12;\n\x14\x61ttitude_euler_angle\x18\x03 \x01(\x0b\x32\x1d.mavsdk.rpc.camera.EulerAngle\x12\x13\n\x0btime_utc_us\x18\x04 \x01(\x04\x12\x12\n\nis_success\x18\x05 \x01(\x08\x12\r\n\x05index\x18\x06 \x01(\x05\x12\x10\n\x08\x66ile_url\x18\x07 \x01(\t\"\xc5\x01\n\x13VideoStreamSettings\x12\x15\n\rframe_rate_hz\x18\x01 \x01(\x02\x12!\n\x19horizontal_resolution_pix\x18\x02 \x01(\r\x12\x1f\n\x17vertical_resolution_pix\x18\x03 \x01(\r\x12\x14\n\x0c\x62it_rate_b_s\x18\x04 \x01(\r\x12\x14\n\x0crotation_deg\x18\x05 \x01(\r\x12\x0b\n\x03uri\x18\x06 \x01(\t\x12\x1a\n\x12horizontal_fov_deg\x18\x07 \x01(\x02\"\xc2\x03\n\x0fVideoStreamInfo\x12\x38\n\x08settings\x18\x01 \x01(\x0b\x32&.mavsdk.rpc.camera.VideoStreamSettings\x12\x44\n\x06status\x18\x02 \x01(\x0e\x32\x34.mavsdk.rpc.camera.VideoStreamInfo.VideoStreamStatus\x12H\n\x08spectrum\x18\x03 \x01(\x0e\x32\x36.mavsdk.rpc.camera.VideoStreamInfo.VideoStreamSpectrum\"]\n\x11VideoStreamStatus\x12#\n\x1fVIDEO_STREAM_STATUS_NOT_RUNNING\x10\x00\x12#\n\x1fVIDEO_STREAM_STATUS_IN_PROGRESS\x10\x01\"\x85\x01\n\x13VideoStreamSpectrum\x12!\n\x1dVIDEO_STREAM_SPECTRUM_UNKNOWN\x10\x00\x12\'\n#VIDEO_STREAM_SPECTRUM_VISIBLE_LIGHT\x10\x01\x12\"\n\x1eVIDEO_STREAM_SPECTRUM_INFRARED\x10\x02\"\x93\x03\n\x06Status\x12\x10\n\x08video_on\x18\x01 \x01(\x08\x12\x19\n\x11photo_interval_on\x18\x02 \x01(\x08\x12\x18\n\x10used_storage_mib\x18\x03 \x01(\x02\x12\x1d\n\x15\x61vailable_storage_mib\x18\x04 \x01(\x02\x12\x19\n\x11total_storage_mib\x18\x05 \x01(\x02\x12\x18\n\x10recording_time_s\x18\x06 \x01(\x02\x12\x19\n\x11media_folder_name\x18\x07 \x01(\t\x12?\n\x0estorage_status\x18\x08 \x01(\x0e\x32\'.mavsdk.rpc.camera.Status.StorageStatus\"\x91\x01\n\rStorageStatus\x12 \n\x1cSTORAGE_STATUS_NOT_AVAILABLE\x10\x00\x12\x1e\n\x1aSTORAGE_STATUS_UNFORMATTED\x10\x01\x12\x1c\n\x18STORAGE_STATUS_FORMATTED\x10\x02\x12 \n\x1cSTORAGE_STATUS_NOT_SUPPORTED\x10\x03\"7\n\x06Option\x12\x11\n\toption_id\x18\x01 \x01(\t\x12\x1a\n\x12option_description\x18\x02 \x01(\t\"w\n\x07Setting\x12\x12\n\nsetting_id\x18\x01 \x01(\t\x12\x1b\n\x13setting_description\x18\x02 \x01(\t\x12)\n\x06option\x18\x03 \x01(\x0b\x32\x19.mavsdk.rpc.camera.Option\x12\x10\n\x08is_range\x18\x04 \x01(\x08\"\x7f\n\x0eSettingOptions\x12\x12\n\nsetting_id\x18\x01 \x01(\t\x12\x1b\n\x13setting_description\x18\x02 \x01(\t\x12*\n\x07options\x18\x03 \x03(\x0b\x32\x19.mavsdk.rpc.camera.Option\x12\x10\n\x08is_range\x18\x04 \x01(\x08\"6\n\x0bInformation\x12\x13\n\x0bvendor_name\x18\x01 \x01(\t\x12\x12\n\nmodel_name\x18\x02 \x01(\t*8\n\x04Mode\x12\x10\n\x0cMODE_UNKNOWN\x10\x00\x12\x0e\n\nMODE_PHOTO\x10\x01\x12\x0e\n\nMODE_VIDEO\x10\x02*F\n\x0bPhotosRange\x12\x14\n\x10PHOTOS_RANGE_ALL\x10\x00\x12!\n\x1dPHOTOS_RANGE_SINCE_CONNECTION\x10\x01\x32\x98\x10\n\rCameraService\x12X\n\tTakePhoto\x12#.mavsdk.rpc.camera.TakePhotoRequest\x1a$.mavsdk.rpc.camera.TakePhotoResponse\"\x00\x12s\n\x12StartPhotoInterval\x12,.mavsdk.rpc.camera.StartPhotoIntervalRequest\x1a-.mavsdk.rpc.camera.StartPhotoIntervalResponse\"\x00\x12p\n\x11StopPhotoInterval\x12+.mavsdk.rpc.camera.StopPhotoIntervalRequest\x1a,.mavsdk.rpc.camera.StopPhotoIntervalResponse\"\x00\x12[\n\nStartVideo\x12$.mavsdk.rpc.camera.StartVideoRequest\x1a%.mavsdk.rpc.camera.StartVideoResponse\"\x00\x12X\n\tStopVideo\x12#.mavsdk.rpc.camera.StopVideoRequest\x1a$.mavsdk.rpc.camera.StopVideoResponse\"\x00\x12z\n\x13StartVideoStreaming\x12-.mavsdk.rpc.camera.StartVideoStreamingRequest\x1a..mavsdk.rpc.camera.StartVideoStreamingResponse\"\x04\x80\xb5\x18\x01\x12w\n\x12StopVideoStreaming\x12,.mavsdk.rpc.camera.StopVideoStreamingRequest\x1a-.mavsdk.rpc.camera.StopVideoStreamingResponse\"\x04\x80\xb5\x18\x01\x12R\n\x07SetMode\x12!.mavsdk.rpc.camera.SetModeRequest\x1a\".mavsdk.rpc.camera.SetModeResponse\"\x00\x12[\n\nListPhotos\x12$.mavsdk.rpc.camera.ListPhotosRequest\x1a%.mavsdk.rpc.camera.ListPhotosResponse\"\x00\x12]\n\rSubscribeMode\x12\'.mavsdk.rpc.camera.SubscribeModeRequest\x1a\x1f.mavsdk.rpc.camera.ModeResponse\"\x00\x30\x01\x12r\n\x14SubscribeInformation\x12..mavsdk.rpc.camera.SubscribeInformationRequest\x1a&.mavsdk.rpc.camera.InformationResponse\"\x00\x30\x01\x12~\n\x18SubscribeVideoStreamInfo\x12\x32.mavsdk.rpc.camera.SubscribeVideoStreamInfoRequest\x1a*.mavsdk.rpc.camera.VideoStreamInfoResponse\"\x00\x30\x01\x12v\n\x14SubscribeCaptureInfo\x12..mavsdk.rpc.camera.SubscribeCaptureInfoRequest\x1a&.mavsdk.rpc.camera.CaptureInfoResponse\"\x04\x80\xb5\x18\x00\x30\x01\x12\x63\n\x0fSubscribeStatus\x12).mavsdk.rpc.camera.SubscribeStatusRequest\x1a!.mavsdk.rpc.camera.StatusResponse\"\x00\x30\x01\x12\x82\x01\n\x18SubscribeCurrentSettings\x12\x32.mavsdk.rpc.camera.SubscribeCurrentSettingsRequest\x1a*.mavsdk.rpc.camera.CurrentSettingsResponse\"\x04\x80\xb5\x18\x00\x30\x01\x12\x93\x01\n\x1fSubscribePossibleSettingOptions\x12\x39.mavsdk.rpc.camera.SubscribePossibleSettingOptionsRequest\x1a\x31.mavsdk.rpc.camera.PossibleSettingOptionsResponse\"\x00\x30\x01\x12[\n\nSetSetting\x12$.mavsdk.rpc.camera.SetSettingRequest\x1a%.mavsdk.rpc.camera.SetSettingResponse\"\x00\x12[\n\nGetSetting\x12$.mavsdk.rpc.camera.GetSettingRequest\x1a%.mavsdk.rpc.camera.GetSettingResponse\"\x00\x12\x64\n\rFormatStorage\x12\'.mavsdk.rpc.camera.FormatStorageRequest\x1a(.mavsdk.rpc.camera.FormatStorageResponse\"\x00\x42\x1f\n\x10io.mavsdk.cameraB\x0b\x43\x61meraProtob\x06proto3' + serialized_pb=b'\n\x13\x63\x61mera/camera.proto\x12\x11mavsdk.rpc.camera\x1a\x14mavsdk_options.proto\"\x12\n\x10TakePhotoRequest\"K\n\x11TakePhotoResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\"/\n\x19StartPhotoIntervalRequest\x12\x12\n\ninterval_s\x18\x01 \x01(\x02\"T\n\x1aStartPhotoIntervalResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\"\x1a\n\x18StopPhotoIntervalRequest\"S\n\x19StopPhotoIntervalResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\"\x13\n\x11StartVideoRequest\"L\n\x12StartVideoResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\"\x12\n\x10StopVideoRequest\"K\n\x11StopVideoResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\"\x1c\n\x1aStartVideoStreamingRequest\"U\n\x1bStartVideoStreamingResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\"\x1b\n\x19StopVideoStreamingRequest\"T\n\x1aStopVideoStreamingResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\"7\n\x0eSetModeRequest\x12%\n\x04mode\x18\x01 \x01(\x0e\x32\x17.mavsdk.rpc.camera.Mode\"I\n\x0fSetModeResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\"I\n\x11ListPhotosRequest\x12\x34\n\x0cphotos_range\x18\x01 \x01(\x0e\x32\x1e.mavsdk.rpc.camera.PhotosRange\"\x83\x01\n\x12ListPhotosResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\x12\x35\n\rcapture_infos\x18\x02 \x03(\x0b\x32\x1e.mavsdk.rpc.camera.CaptureInfo\"\x1d\n\x1bSubscribeInformationRequest\"J\n\x13InformationResponse\x12\x33\n\x0binformation\x18\x01 \x01(\x0b\x32\x1e.mavsdk.rpc.camera.Information\"\x16\n\x14SubscribeModeRequest\"5\n\x0cModeResponse\x12%\n\x04mode\x18\x01 \x01(\x0e\x32\x17.mavsdk.rpc.camera.Mode\"!\n\x1fSubscribeVideoStreamInfoRequest\"X\n\x17VideoStreamInfoResponse\x12=\n\x11video_stream_info\x18\x01 \x01(\x0b\x32\".mavsdk.rpc.camera.VideoStreamInfo\"\x1d\n\x1bSubscribeCaptureInfoRequest\"K\n\x13\x43\x61ptureInfoResponse\x12\x34\n\x0c\x63\x61pture_info\x18\x01 \x01(\x0b\x32\x1e.mavsdk.rpc.camera.CaptureInfo\"\x18\n\x16SubscribeStatusRequest\"B\n\x0eStatusResponse\x12\x30\n\rcamera_status\x18\x01 \x01(\x0b\x32\x19.mavsdk.rpc.camera.Status\"!\n\x1fSubscribeCurrentSettingsRequest\"O\n\x17\x43urrentSettingsResponse\x12\x34\n\x10\x63urrent_settings\x18\x01 \x03(\x0b\x32\x1a.mavsdk.rpc.camera.Setting\"(\n&SubscribePossibleSettingOptionsRequest\"\\\n\x1ePossibleSettingOptionsResponse\x12:\n\x0fsetting_options\x18\x01 \x03(\x0b\x32!.mavsdk.rpc.camera.SettingOptions\"@\n\x11SetSettingRequest\x12+\n\x07setting\x18\x01 \x01(\x0b\x32\x1a.mavsdk.rpc.camera.Setting\"L\n\x12SetSettingResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\"@\n\x11GetSettingRequest\x12+\n\x07setting\x18\x01 \x01(\x0b\x32\x1a.mavsdk.rpc.camera.Setting\"y\n\x12GetSettingResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\x12+\n\x07setting\x18\x02 \x01(\x0b\x32\x1a.mavsdk.rpc.camera.Setting\"\x16\n\x14\x46ormatStorageRequest\"O\n\x15\x46ormatStorageResponse\x12\x36\n\rcamera_result\x18\x01 \x01(\x0b\x32\x1f.mavsdk.rpc.camera.CameraResult\"\x8a\x02\n\x0c\x43\x61meraResult\x12\x36\n\x06result\x18\x01 \x01(\x0e\x32&.mavsdk.rpc.camera.CameraResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t\"\xad\x01\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x16\n\x12RESULT_IN_PROGRESS\x10\x02\x12\x0f\n\x0bRESULT_BUSY\x10\x03\x12\x11\n\rRESULT_DENIED\x10\x04\x12\x10\n\x0cRESULT_ERROR\x10\x05\x12\x12\n\x0eRESULT_TIMEOUT\x10\x06\x12\x19\n\x15RESULT_WRONG_ARGUMENT\x10\x07\"q\n\x08Position\x12\x14\n\x0clatitude_deg\x18\x01 \x01(\x01\x12\x15\n\rlongitude_deg\x18\x02 \x01(\x01\x12\x1b\n\x13\x61\x62solute_altitude_m\x18\x03 \x01(\x02\x12\x1b\n\x13relative_altitude_m\x18\x04 \x01(\x02\"8\n\nQuaternion\x12\t\n\x01w\x18\x01 \x01(\x02\x12\t\n\x01x\x18\x02 \x01(\x02\x12\t\n\x01y\x18\x03 \x01(\x02\x12\t\n\x01z\x18\x04 \x01(\x02\"B\n\nEulerAngle\x12\x10\n\x08roll_deg\x18\x01 \x01(\x02\x12\x11\n\tpitch_deg\x18\x02 \x01(\x02\x12\x0f\n\x07yaw_deg\x18\x03 \x01(\x02\"\xff\x01\n\x0b\x43\x61ptureInfo\x12-\n\x08position\x18\x01 \x01(\x0b\x32\x1b.mavsdk.rpc.camera.Position\x12:\n\x13\x61ttitude_quaternion\x18\x02 \x01(\x0b\x32\x1d.mavsdk.rpc.camera.Quaternion\x12;\n\x14\x61ttitude_euler_angle\x18\x03 \x01(\x0b\x32\x1d.mavsdk.rpc.camera.EulerAngle\x12\x13\n\x0btime_utc_us\x18\x04 \x01(\x04\x12\x12\n\nis_success\x18\x05 \x01(\x08\x12\r\n\x05index\x18\x06 \x01(\x05\x12\x10\n\x08\x66ile_url\x18\x07 \x01(\t\"\xc5\x01\n\x13VideoStreamSettings\x12\x15\n\rframe_rate_hz\x18\x01 \x01(\x02\x12!\n\x19horizontal_resolution_pix\x18\x02 \x01(\r\x12\x1f\n\x17vertical_resolution_pix\x18\x03 \x01(\r\x12\x14\n\x0c\x62it_rate_b_s\x18\x04 \x01(\r\x12\x14\n\x0crotation_deg\x18\x05 \x01(\r\x12\x0b\n\x03uri\x18\x06 \x01(\t\x12\x1a\n\x12horizontal_fov_deg\x18\x07 \x01(\x02\"\xc2\x03\n\x0fVideoStreamInfo\x12\x38\n\x08settings\x18\x01 \x01(\x0b\x32&.mavsdk.rpc.camera.VideoStreamSettings\x12\x44\n\x06status\x18\x02 \x01(\x0e\x32\x34.mavsdk.rpc.camera.VideoStreamInfo.VideoStreamStatus\x12H\n\x08spectrum\x18\x03 \x01(\x0e\x32\x36.mavsdk.rpc.camera.VideoStreamInfo.VideoStreamSpectrum\"]\n\x11VideoStreamStatus\x12#\n\x1fVIDEO_STREAM_STATUS_NOT_RUNNING\x10\x00\x12#\n\x1fVIDEO_STREAM_STATUS_IN_PROGRESS\x10\x01\"\x85\x01\n\x13VideoStreamSpectrum\x12!\n\x1dVIDEO_STREAM_SPECTRUM_UNKNOWN\x10\x00\x12\'\n#VIDEO_STREAM_SPECTRUM_VISIBLE_LIGHT\x10\x01\x12\"\n\x1eVIDEO_STREAM_SPECTRUM_INFRARED\x10\x02\"\x93\x03\n\x06Status\x12\x10\n\x08video_on\x18\x01 \x01(\x08\x12\x19\n\x11photo_interval_on\x18\x02 \x01(\x08\x12\x18\n\x10used_storage_mib\x18\x03 \x01(\x02\x12\x1d\n\x15\x61vailable_storage_mib\x18\x04 \x01(\x02\x12\x19\n\x11total_storage_mib\x18\x05 \x01(\x02\x12\x18\n\x10recording_time_s\x18\x06 \x01(\x02\x12\x19\n\x11media_folder_name\x18\x07 \x01(\t\x12?\n\x0estorage_status\x18\x08 \x01(\x0e\x32\'.mavsdk.rpc.camera.Status.StorageStatus\"\x91\x01\n\rStorageStatus\x12 \n\x1cSTORAGE_STATUS_NOT_AVAILABLE\x10\x00\x12\x1e\n\x1aSTORAGE_STATUS_UNFORMATTED\x10\x01\x12\x1c\n\x18STORAGE_STATUS_FORMATTED\x10\x02\x12 \n\x1cSTORAGE_STATUS_NOT_SUPPORTED\x10\x03\"7\n\x06Option\x12\x11\n\toption_id\x18\x01 \x01(\t\x12\x1a\n\x12option_description\x18\x02 \x01(\t\"w\n\x07Setting\x12\x12\n\nsetting_id\x18\x01 \x01(\t\x12\x1b\n\x13setting_description\x18\x02 \x01(\t\x12)\n\x06option\x18\x03 \x01(\x0b\x32\x19.mavsdk.rpc.camera.Option\x12\x10\n\x08is_range\x18\x04 \x01(\x08\"\x7f\n\x0eSettingOptions\x12\x12\n\nsetting_id\x18\x01 \x01(\t\x12\x1b\n\x13setting_description\x18\x02 \x01(\t\x12*\n\x07options\x18\x03 \x03(\x0b\x32\x19.mavsdk.rpc.camera.Option\x12\x10\n\x08is_range\x18\x04 \x01(\x08\"\xd5\x01\n\x0bInformation\x12\x13\n\x0bvendor_name\x18\x01 \x01(\t\x12\x12\n\nmodel_name\x18\x02 \x01(\t\x12\x17\n\x0f\x66ocal_length_mm\x18\x03 \x01(\x02\x12!\n\x19horizontal_sensor_size_mm\x18\x04 \x01(\x02\x12\x1f\n\x17vertical_sensor_size_mm\x18\x05 \x01(\x02\x12 \n\x18horizontal_resolution_px\x18\x06 \x01(\r\x12\x1e\n\x16vertical_resolution_px\x18\x07 \x01(\r*8\n\x04Mode\x12\x10\n\x0cMODE_UNKNOWN\x10\x00\x12\x0e\n\nMODE_PHOTO\x10\x01\x12\x0e\n\nMODE_VIDEO\x10\x02*F\n\x0bPhotosRange\x12\x14\n\x10PHOTOS_RANGE_ALL\x10\x00\x12!\n\x1dPHOTOS_RANGE_SINCE_CONNECTION\x10\x01\x32\x98\x10\n\rCameraService\x12X\n\tTakePhoto\x12#.mavsdk.rpc.camera.TakePhotoRequest\x1a$.mavsdk.rpc.camera.TakePhotoResponse\"\x00\x12s\n\x12StartPhotoInterval\x12,.mavsdk.rpc.camera.StartPhotoIntervalRequest\x1a-.mavsdk.rpc.camera.StartPhotoIntervalResponse\"\x00\x12p\n\x11StopPhotoInterval\x12+.mavsdk.rpc.camera.StopPhotoIntervalRequest\x1a,.mavsdk.rpc.camera.StopPhotoIntervalResponse\"\x00\x12[\n\nStartVideo\x12$.mavsdk.rpc.camera.StartVideoRequest\x1a%.mavsdk.rpc.camera.StartVideoResponse\"\x00\x12X\n\tStopVideo\x12#.mavsdk.rpc.camera.StopVideoRequest\x1a$.mavsdk.rpc.camera.StopVideoResponse\"\x00\x12z\n\x13StartVideoStreaming\x12-.mavsdk.rpc.camera.StartVideoStreamingRequest\x1a..mavsdk.rpc.camera.StartVideoStreamingResponse\"\x04\x80\xb5\x18\x01\x12w\n\x12StopVideoStreaming\x12,.mavsdk.rpc.camera.StopVideoStreamingRequest\x1a-.mavsdk.rpc.camera.StopVideoStreamingResponse\"\x04\x80\xb5\x18\x01\x12R\n\x07SetMode\x12!.mavsdk.rpc.camera.SetModeRequest\x1a\".mavsdk.rpc.camera.SetModeResponse\"\x00\x12[\n\nListPhotos\x12$.mavsdk.rpc.camera.ListPhotosRequest\x1a%.mavsdk.rpc.camera.ListPhotosResponse\"\x00\x12]\n\rSubscribeMode\x12\'.mavsdk.rpc.camera.SubscribeModeRequest\x1a\x1f.mavsdk.rpc.camera.ModeResponse\"\x00\x30\x01\x12r\n\x14SubscribeInformation\x12..mavsdk.rpc.camera.SubscribeInformationRequest\x1a&.mavsdk.rpc.camera.InformationResponse\"\x00\x30\x01\x12~\n\x18SubscribeVideoStreamInfo\x12\x32.mavsdk.rpc.camera.SubscribeVideoStreamInfoRequest\x1a*.mavsdk.rpc.camera.VideoStreamInfoResponse\"\x00\x30\x01\x12v\n\x14SubscribeCaptureInfo\x12..mavsdk.rpc.camera.SubscribeCaptureInfoRequest\x1a&.mavsdk.rpc.camera.CaptureInfoResponse\"\x04\x80\xb5\x18\x00\x30\x01\x12\x63\n\x0fSubscribeStatus\x12).mavsdk.rpc.camera.SubscribeStatusRequest\x1a!.mavsdk.rpc.camera.StatusResponse\"\x00\x30\x01\x12\x82\x01\n\x18SubscribeCurrentSettings\x12\x32.mavsdk.rpc.camera.SubscribeCurrentSettingsRequest\x1a*.mavsdk.rpc.camera.CurrentSettingsResponse\"\x04\x80\xb5\x18\x00\x30\x01\x12\x93\x01\n\x1fSubscribePossibleSettingOptions\x12\x39.mavsdk.rpc.camera.SubscribePossibleSettingOptionsRequest\x1a\x31.mavsdk.rpc.camera.PossibleSettingOptionsResponse\"\x00\x30\x01\x12[\n\nSetSetting\x12$.mavsdk.rpc.camera.SetSettingRequest\x1a%.mavsdk.rpc.camera.SetSettingResponse\"\x00\x12[\n\nGetSetting\x12$.mavsdk.rpc.camera.GetSettingRequest\x1a%.mavsdk.rpc.camera.GetSettingResponse\"\x00\x12\x64\n\rFormatStorage\x12\'.mavsdk.rpc.camera.FormatStorageRequest\x1a(.mavsdk.rpc.camera.FormatStorageResponse\"\x00\x42\x1f\n\x10io.mavsdk.cameraB\x0b\x43\x61meraProtob\x06proto3' , dependencies=[mavsdk__options__pb2.DESCRIPTOR,]) @@ -50,8 +50,8 @@ ], containing_type=None, serialized_options=None, - serialized_start=4571, - serialized_end=4627, + serialized_start=4731, + serialized_end=4787, ) _sym_db.RegisterEnumDescriptor(_MODE) @@ -76,8 +76,8 @@ ], containing_type=None, serialized_options=None, - serialized_start=4629, - serialized_end=4699, + serialized_start=4789, + serialized_end=4859, ) _sym_db.RegisterEnumDescriptor(_PHOTOSRANGE) @@ -2004,6 +2004,41 @@ message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='focal_length_mm', full_name='mavsdk.rpc.camera.Information.focal_length_mm', index=2, + number=3, type=2, cpp_type=6, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='horizontal_sensor_size_mm', full_name='mavsdk.rpc.camera.Information.horizontal_sensor_size_mm', index=3, + number=4, type=2, cpp_type=6, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='vertical_sensor_size_mm', full_name='mavsdk.rpc.camera.Information.vertical_sensor_size_mm', index=4, + number=5, type=2, cpp_type=6, label=1, + has_default_value=False, default_value=float(0), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='horizontal_resolution_px', full_name='mavsdk.rpc.camera.Information.horizontal_resolution_px', index=5, + number=6, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='vertical_resolution_px', full_name='mavsdk.rpc.camera.Information.vertical_resolution_px', index=6, + number=7, type=13, cpp_type=3, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), ], extensions=[ ], @@ -2016,8 +2051,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=4515, - serialized_end=4569, + serialized_start=4516, + serialized_end=4729, ) _TAKEPHOTORESPONSE.fields_by_name['camera_result'].message_type = _CAMERARESULT @@ -2473,8 +2508,8 @@ index=0, serialized_options=None, create_key=_descriptor._internal_create_key, - serialized_start=4702, - serialized_end=6774, + serialized_start=4862, + serialized_end=6934, methods=[ _descriptor.MethodDescriptor( name='TakePhoto', diff --git a/mavsdk/log_files.py b/mavsdk/log_files.py index 56abbd01..3cd296b2 100644 --- a/mavsdk/log_files.py +++ b/mavsdk/log_files.py @@ -370,14 +370,14 @@ async def get_entries(self): return entries - async def download_log_file(self, id, path): + async def download_log_file(self, entry, path): """ Download log file. Parameters ---------- - id : uint32_t - ID of the log file to download + entry : Entry + Entry of the log file to download. path : std::string Path of where to download log file to. @@ -394,7 +394,10 @@ async def download_log_file(self, id, path): """ request = log_files_pb2.SubscribeDownloadLogFileRequest() - request.id = id + + entry.translate_to_rpc(request.entry) + + request.path = path download_log_file_stream = self._stub.SubscribeDownloadLogFile(request) @@ -408,7 +411,7 @@ async def download_log_file(self, id, path): success_codes.append(LogFilesResult.Result.NEXT) if result.result not in success_codes: - raise LogFilesError(result, "download_log_file()", id, path) + raise LogFilesError(result, "download_log_file()", entry, path) if result.result is LogFilesResult.Result.SUCCESS: download_log_file_stream.cancel(); diff --git a/mavsdk/log_files_pb2.py b/mavsdk/log_files_pb2.py index fcf027df..9ae8c19e 100644 --- a/mavsdk/log_files_pb2.py +++ b/mavsdk/log_files_pb2.py @@ -20,7 +20,7 @@ syntax='proto3', serialized_options=b'\n\023io.mavsdk.log_filesB\rLogFilesProto', create_key=_descriptor._internal_create_key, - serialized_pb=b'\n\x19log_files/log_files.proto\x12\x14mavsdk.rpc.log_files\x1a\x14mavsdk_options.proto\"\x13\n\x11GetEntriesRequest\"\x82\x01\n\x12GetEntriesResponse\x12>\n\x10log_files_result\x18\x01 \x01(\x0b\x32$.mavsdk.rpc.log_files.LogFilesResult\x12,\n\x07\x65ntries\x18\x02 \x03(\x0b\x32\x1b.mavsdk.rpc.log_files.Entry\";\n\x1fSubscribeDownloadLogFileRequest\x12\n\n\x02id\x18\x01 \x01(\r\x12\x0c\n\x04path\x18\x02 \x01(\t\"\x8f\x01\n\x17\x44ownloadLogFileResponse\x12>\n\x10log_files_result\x18\x01 \x01(\x0b\x32$.mavsdk.rpc.log_files.LogFilesResult\x12\x34\n\x08progress\x18\x02 \x01(\x0b\x32\".mavsdk.rpc.log_files.ProgressData\")\n\x0cProgressData\x12\x19\n\x08progress\x18\x01 \x01(\x02\x42\x07\x82\xb5\x18\x03NaN\"5\n\x05\x45ntry\x12\n\n\x02id\x18\x01 \x01(\r\x12\x0c\n\x04\x64\x61te\x18\x02 \x01(\t\x12\x12\n\nsize_bytes\x18\x03 \x01(\r\"\x8b\x02\n\x0eLogFilesResult\x12;\n\x06result\x18\x01 \x01(\x0e\x32+.mavsdk.rpc.log_files.LogFilesResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t\"\xa7\x01\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x0f\n\x0bRESULT_NEXT\x10\x02\x12\x16\n\x12RESULT_NO_LOGFILES\x10\x03\x12\x12\n\x0eRESULT_TIMEOUT\x10\x04\x12\x1b\n\x17RESULT_INVALID_ARGUMENT\x10\x05\x12\x1b\n\x17RESULT_FILE_OPEN_FAILED\x10\x06\x32\x83\x02\n\x0fLogFilesService\x12\x61\n\nGetEntries\x12\'.mavsdk.rpc.log_files.GetEntriesRequest\x1a(.mavsdk.rpc.log_files.GetEntriesResponse\"\x00\x12\x8c\x01\n\x18SubscribeDownloadLogFile\x12\x35.mavsdk.rpc.log_files.SubscribeDownloadLogFileRequest\x1a-.mavsdk.rpc.log_files.DownloadLogFileResponse\"\x08\x80\xb5\x18\x00\x88\xb5\x18\x01\x30\x01\x42$\n\x13io.mavsdk.log_filesB\rLogFilesProtob\x06proto3' + serialized_pb=b'\n\x19log_files/log_files.proto\x12\x14mavsdk.rpc.log_files\x1a\x14mavsdk_options.proto\"\x13\n\x11GetEntriesRequest\"\x82\x01\n\x12GetEntriesResponse\x12>\n\x10log_files_result\x18\x01 \x01(\x0b\x32$.mavsdk.rpc.log_files.LogFilesResult\x12,\n\x07\x65ntries\x18\x02 \x03(\x0b\x32\x1b.mavsdk.rpc.log_files.Entry\"[\n\x1fSubscribeDownloadLogFileRequest\x12*\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x1b.mavsdk.rpc.log_files.Entry\x12\x0c\n\x04path\x18\x02 \x01(\t\"\x8f\x01\n\x17\x44ownloadLogFileResponse\x12>\n\x10log_files_result\x18\x01 \x01(\x0b\x32$.mavsdk.rpc.log_files.LogFilesResult\x12\x34\n\x08progress\x18\x02 \x01(\x0b\x32\".mavsdk.rpc.log_files.ProgressData\")\n\x0cProgressData\x12\x19\n\x08progress\x18\x01 \x01(\x02\x42\x07\x82\xb5\x18\x03NaN\"5\n\x05\x45ntry\x12\n\n\x02id\x18\x01 \x01(\r\x12\x0c\n\x04\x64\x61te\x18\x02 \x01(\t\x12\x12\n\nsize_bytes\x18\x03 \x01(\r\"\x8b\x02\n\x0eLogFilesResult\x12;\n\x06result\x18\x01 \x01(\x0e\x32+.mavsdk.rpc.log_files.LogFilesResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t\"\xa7\x01\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x0f\n\x0bRESULT_NEXT\x10\x02\x12\x16\n\x12RESULT_NO_LOGFILES\x10\x03\x12\x12\n\x0eRESULT_TIMEOUT\x10\x04\x12\x1b\n\x17RESULT_INVALID_ARGUMENT\x10\x05\x12\x1b\n\x17RESULT_FILE_OPEN_FAILED\x10\x06\x32\x83\x02\n\x0fLogFilesService\x12\x61\n\nGetEntries\x12\'.mavsdk.rpc.log_files.GetEntriesRequest\x1a(.mavsdk.rpc.log_files.GetEntriesResponse\"\x00\x12\x8c\x01\n\x18SubscribeDownloadLogFile\x12\x35.mavsdk.rpc.log_files.SubscribeDownloadLogFileRequest\x1a-.mavsdk.rpc.log_files.DownloadLogFileResponse\"\x08\x80\xb5\x18\x00\x88\xb5\x18\x01\x30\x01\x42$\n\x13io.mavsdk.log_filesB\rLogFilesProtob\x06proto3' , dependencies=[mavsdk__options__pb2.DESCRIPTOR,]) @@ -71,8 +71,8 @@ ], containing_type=None, serialized_options=None, - serialized_start=633, - serialized_end=800, + serialized_start=665, + serialized_end=832, ) _sym_db.RegisterEnumDescriptor(_LOGFILESRESULT_RESULT) @@ -150,9 +150,9 @@ create_key=_descriptor._internal_create_key, fields=[ _descriptor.FieldDescriptor( - name='id', full_name='mavsdk.rpc.log_files.SubscribeDownloadLogFileRequest.id', index=0, - number=1, type=13, cpp_type=3, label=1, - has_default_value=False, default_value=0, + name='entry', full_name='mavsdk.rpc.log_files.SubscribeDownloadLogFileRequest.entry', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), @@ -176,7 +176,7 @@ oneofs=[ ], serialized_start=227, - serialized_end=286, + serialized_end=318, ) @@ -214,8 +214,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=289, - serialized_end=432, + serialized_start=321, + serialized_end=464, ) @@ -246,8 +246,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=434, - serialized_end=475, + serialized_start=466, + serialized_end=507, ) @@ -292,8 +292,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=477, - serialized_end=530, + serialized_start=509, + serialized_end=562, ) @@ -332,12 +332,13 @@ extension_ranges=[], oneofs=[ ], - serialized_start=533, - serialized_end=800, + serialized_start=565, + serialized_end=832, ) _GETENTRIESRESPONSE.fields_by_name['log_files_result'].message_type = _LOGFILESRESULT _GETENTRIESRESPONSE.fields_by_name['entries'].message_type = _ENTRY +_SUBSCRIBEDOWNLOADLOGFILEREQUEST.fields_by_name['entry'].message_type = _ENTRY _DOWNLOADLOGFILERESPONSE.fields_by_name['log_files_result'].message_type = _LOGFILESRESULT _DOWNLOADLOGFILERESPONSE.fields_by_name['progress'].message_type = _PROGRESSDATA _LOGFILESRESULT.fields_by_name['result'].enum_type = _LOGFILESRESULT_RESULT @@ -411,8 +412,8 @@ index=0, serialized_options=None, create_key=_descriptor._internal_create_key, - serialized_start=803, - serialized_end=1062, + serialized_start=835, + serialized_end=1094, methods=[ _descriptor.MethodDescriptor( name='GetEntries', diff --git a/mavsdk/server_utility.py b/mavsdk/server_utility.py new file mode 100644 index 00000000..eefe8028 --- /dev/null +++ b/mavsdk/server_utility.py @@ -0,0 +1,291 @@ +# -*- coding: utf-8 -*- +# DO NOT EDIT! This file is auto-generated from +# https://github.com/mavlink/MAVSDK-Python/tree/main/other/templates/py +from ._base import AsyncBase +from . import server_utility_pb2, server_utility_pb2_grpc +from enum import Enum + + +class StatusTextType(Enum): + """ + Status types. + + Values + ------ + DEBUG + Debug + + INFO + Information + + NOTICE + Notice + + WARNING + Warning + + ERROR + Error + + CRITICAL + Critical + + ALERT + Alert + + EMERGENCY + Emergency + + """ + + + DEBUG = 0 + INFO = 1 + NOTICE = 2 + WARNING = 3 + ERROR = 4 + CRITICAL = 5 + ALERT = 6 + EMERGENCY = 7 + + def translate_to_rpc(self): + if self == StatusTextType.DEBUG: + return server_utility_pb2.STATUS_TEXT_TYPE_DEBUG + if self == StatusTextType.INFO: + return server_utility_pb2.STATUS_TEXT_TYPE_INFO + if self == StatusTextType.NOTICE: + return server_utility_pb2.STATUS_TEXT_TYPE_NOTICE + if self == StatusTextType.WARNING: + return server_utility_pb2.STATUS_TEXT_TYPE_WARNING + if self == StatusTextType.ERROR: + return server_utility_pb2.STATUS_TEXT_TYPE_ERROR + if self == StatusTextType.CRITICAL: + return server_utility_pb2.STATUS_TEXT_TYPE_CRITICAL + if self == StatusTextType.ALERT: + return server_utility_pb2.STATUS_TEXT_TYPE_ALERT + if self == StatusTextType.EMERGENCY: + return server_utility_pb2.STATUS_TEXT_TYPE_EMERGENCY + + @staticmethod + def translate_from_rpc(rpc_enum_value): + """ Parses a gRPC response """ + if rpc_enum_value == server_utility_pb2.STATUS_TEXT_TYPE_DEBUG: + return StatusTextType.DEBUG + if rpc_enum_value == server_utility_pb2.STATUS_TEXT_TYPE_INFO: + return StatusTextType.INFO + if rpc_enum_value == server_utility_pb2.STATUS_TEXT_TYPE_NOTICE: + return StatusTextType.NOTICE + if rpc_enum_value == server_utility_pb2.STATUS_TEXT_TYPE_WARNING: + return StatusTextType.WARNING + if rpc_enum_value == server_utility_pb2.STATUS_TEXT_TYPE_ERROR: + return StatusTextType.ERROR + if rpc_enum_value == server_utility_pb2.STATUS_TEXT_TYPE_CRITICAL: + return StatusTextType.CRITICAL + if rpc_enum_value == server_utility_pb2.STATUS_TEXT_TYPE_ALERT: + return StatusTextType.ALERT + if rpc_enum_value == server_utility_pb2.STATUS_TEXT_TYPE_EMERGENCY: + return StatusTextType.EMERGENCY + + def __str__(self): + return self.name + + +class ServerUtilityResult: + """ + + + Parameters + ---------- + result : Result + Result enum value + + result_str : std::string + Human-readable English string describing the result + + """ + + + + class Result(Enum): + """ + Possible results returned for server utility requests. + + Values + ------ + UNKNOWN + Unknown result + + SUCCESS + Request succeeded + + NO_SYSTEM + No system is connected + + CONNECTION_ERROR + Connection error + + INVALID_ARGUMENT + Invalid argument + + """ + + + UNKNOWN = 0 + SUCCESS = 1 + NO_SYSTEM = 2 + CONNECTION_ERROR = 3 + INVALID_ARGUMENT = 4 + + def translate_to_rpc(self): + if self == ServerUtilityResult.Result.UNKNOWN: + return server_utility_pb2.ServerUtilityResult.RESULT_UNKNOWN + if self == ServerUtilityResult.Result.SUCCESS: + return server_utility_pb2.ServerUtilityResult.RESULT_SUCCESS + if self == ServerUtilityResult.Result.NO_SYSTEM: + return server_utility_pb2.ServerUtilityResult.RESULT_NO_SYSTEM + if self == ServerUtilityResult.Result.CONNECTION_ERROR: + return server_utility_pb2.ServerUtilityResult.RESULT_CONNECTION_ERROR + if self == ServerUtilityResult.Result.INVALID_ARGUMENT: + return server_utility_pb2.ServerUtilityResult.RESULT_INVALID_ARGUMENT + + @staticmethod + def translate_from_rpc(rpc_enum_value): + """ Parses a gRPC response """ + if rpc_enum_value == server_utility_pb2.ServerUtilityResult.RESULT_UNKNOWN: + return ServerUtilityResult.Result.UNKNOWN + if rpc_enum_value == server_utility_pb2.ServerUtilityResult.RESULT_SUCCESS: + return ServerUtilityResult.Result.SUCCESS + if rpc_enum_value == server_utility_pb2.ServerUtilityResult.RESULT_NO_SYSTEM: + return ServerUtilityResult.Result.NO_SYSTEM + if rpc_enum_value == server_utility_pb2.ServerUtilityResult.RESULT_CONNECTION_ERROR: + return ServerUtilityResult.Result.CONNECTION_ERROR + if rpc_enum_value == server_utility_pb2.ServerUtilityResult.RESULT_INVALID_ARGUMENT: + return ServerUtilityResult.Result.INVALID_ARGUMENT + + def __str__(self): + return self.name + + + def __init__( + self, + result, + result_str): + """ Initializes the ServerUtilityResult object """ + self.result = result + self.result_str = result_str + + def __equals__(self, to_compare): + """ Checks if two ServerUtilityResult are the same """ + try: + # Try to compare - this likely fails when it is compared to a non + # ServerUtilityResult object + return \ + (self.result == to_compare.result) and \ + (self.result_str == to_compare.result_str) + + except AttributeError: + return False + + def __str__(self): + """ ServerUtilityResult in string representation """ + struct_repr = ", ".join([ + "result: " + str(self.result), + "result_str: " + str(self.result_str) + ]) + + return f"ServerUtilityResult: [{struct_repr}]" + + @staticmethod + def translate_from_rpc(rpcServerUtilityResult): + """ Translates a gRPC struct to the SDK equivalent """ + return ServerUtilityResult( + + ServerUtilityResult.Result.translate_from_rpc(rpcServerUtilityResult.result), + + + rpcServerUtilityResult.result_str + ) + + def translate_to_rpc(self, rpcServerUtilityResult): + """ Translates this SDK object into its gRPC equivalent """ + + + + + rpcServerUtilityResult.result = self.result.translate_to_rpc() + + + + + + rpcServerUtilityResult.result_str = self.result_str + + + + + + +class ServerUtilityError(Exception): + """ Raised when a ServerUtilityResult is a fail code """ + + def __init__(self, result, origin, *params): + self._result = result + self._origin = origin + self._params = params + + def __str__(self): + return f"{self._result.result}: '{self._result.result_str}'; origin: {self._origin}; params: {self._params}" + + +class ServerUtility(AsyncBase): + """ + Utility for onboard MAVSDK instances for common "server" tasks. + + Generated by dcsdkgen - MAVSDK ServerUtility API + """ + + # Plugin name + name = "ServerUtility" + + def _setup_stub(self, channel): + """ Setups the api stub """ + self._stub = server_utility_pb2_grpc.ServerUtilityServiceStub(channel) + + + def _extract_result(self, response): + """ Returns the response status and description """ + return ServerUtilityResult.translate_from_rpc(response.server_utility_result) + + + async def send_status_text(self, type, text): + """ + Sends a statustext. + + Parameters + ---------- + type : StatusTextType + The text to send + + text : std::string + Text message + + Raises + ------ + ServerUtilityError + If the request fails. The error contains the reason for the failure. + """ + + request = server_utility_pb2.SendStatusTextRequest() + + request.type = type.translate_to_rpc() + + + request.text = text + response = await self._stub.SendStatusText(request) + + + result = self._extract_result(response) + + if result.result is not ServerUtilityResult.Result.SUCCESS: + raise ServerUtilityError(result, "send_status_text()", type, text) + \ No newline at end of file diff --git a/mavsdk/server_utility_pb2.py b/mavsdk/server_utility_pb2.py new file mode 100644 index 00000000..c18e2d2f --- /dev/null +++ b/mavsdk/server_utility_pb2.py @@ -0,0 +1,304 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: server_utility/server_utility.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from . import mavsdk_options_pb2 as mavsdk__options__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='server_utility/server_utility.proto', + package='mavsdk.rpc.server_utility', + syntax='proto3', + serialized_options=b'\n\030io.mavsdk.server_utilityB\022ServerUtilityProto', + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n#server_utility/server_utility.proto\x12\x19mavsdk.rpc.server_utility\x1a\x14mavsdk_options.proto\"^\n\x15SendStatusTextRequest\x12\x37\n\x04type\x18\x01 \x01(\x0e\x32).mavsdk.rpc.server_utility.StatusTextType\x12\x0c\n\x04text\x18\x02 \x01(\t\"g\n\x16SendStatusTextResponse\x12M\n\x15server_utility_result\x18\x01 \x01(\x0b\x32..mavsdk.rpc.server_utility.ServerUtilityResult\"\xf3\x01\n\x13ServerUtilityResult\x12\x45\n\x06result\x18\x01 \x01(\x0e\x32\x35.mavsdk.rpc.server_utility.ServerUtilityResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t\"\x80\x01\n\x06Result\x12\x12\n\x0eRESULT_UNKNOWN\x10\x00\x12\x12\n\x0eRESULT_SUCCESS\x10\x01\x12\x14\n\x10RESULT_NO_SYSTEM\x10\x02\x12\x1b\n\x17RESULT_CONNECTION_ERROR\x10\x03\x12\x1b\n\x17RESULT_INVALID_ARGUMENT\x10\x04*\xf9\x01\n\x0eStatusTextType\x12\x1a\n\x16STATUS_TEXT_TYPE_DEBUG\x10\x00\x12\x19\n\x15STATUS_TEXT_TYPE_INFO\x10\x01\x12\x1b\n\x17STATUS_TEXT_TYPE_NOTICE\x10\x02\x12\x1c\n\x18STATUS_TEXT_TYPE_WARNING\x10\x03\x12\x1a\n\x16STATUS_TEXT_TYPE_ERROR\x10\x04\x12\x1d\n\x19STATUS_TEXT_TYPE_CRITICAL\x10\x05\x12\x1a\n\x16STATUS_TEXT_TYPE_ALERT\x10\x06\x12\x1e\n\x1aSTATUS_TEXT_TYPE_EMERGENCY\x10\x07\x32\x93\x01\n\x14ServerUtilityService\x12{\n\x0eSendStatusText\x12\x30.mavsdk.rpc.server_utility.SendStatusTextRequest\x1a\x31.mavsdk.rpc.server_utility.SendStatusTextResponse\"\x04\x80\xb5\x18\x01\x42.\n\x18io.mavsdk.server_utilityB\x12ServerUtilityProtob\x06proto3' + , + dependencies=[mavsdk__options__pb2.DESCRIPTOR,]) + +_STATUSTEXTTYPE = _descriptor.EnumDescriptor( + name='StatusTextType', + full_name='mavsdk.rpc.server_utility.StatusTextType', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='STATUS_TEXT_TYPE_DEBUG', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATUS_TEXT_TYPE_INFO', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATUS_TEXT_TYPE_NOTICE', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATUS_TEXT_TYPE_WARNING', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATUS_TEXT_TYPE_ERROR', index=4, number=4, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATUS_TEXT_TYPE_CRITICAL', index=5, number=5, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATUS_TEXT_TYPE_ALERT', index=6, number=6, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='STATUS_TEXT_TYPE_EMERGENCY', index=7, number=7, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=536, + serialized_end=785, +) +_sym_db.RegisterEnumDescriptor(_STATUSTEXTTYPE) + +StatusTextType = enum_type_wrapper.EnumTypeWrapper(_STATUSTEXTTYPE) +STATUS_TEXT_TYPE_DEBUG = 0 +STATUS_TEXT_TYPE_INFO = 1 +STATUS_TEXT_TYPE_NOTICE = 2 +STATUS_TEXT_TYPE_WARNING = 3 +STATUS_TEXT_TYPE_ERROR = 4 +STATUS_TEXT_TYPE_CRITICAL = 5 +STATUS_TEXT_TYPE_ALERT = 6 +STATUS_TEXT_TYPE_EMERGENCY = 7 + + +_SERVERUTILITYRESULT_RESULT = _descriptor.EnumDescriptor( + name='Result', + full_name='mavsdk.rpc.server_utility.ServerUtilityResult.Result', + filename=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + values=[ + _descriptor.EnumValueDescriptor( + name='RESULT_UNKNOWN', index=0, number=0, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='RESULT_SUCCESS', index=1, number=1, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='RESULT_NO_SYSTEM', index=2, number=2, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='RESULT_CONNECTION_ERROR', index=3, number=3, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + _descriptor.EnumValueDescriptor( + name='RESULT_INVALID_ARGUMENT', index=4, number=4, + serialized_options=None, + type=None, + create_key=_descriptor._internal_create_key), + ], + containing_type=None, + serialized_options=None, + serialized_start=405, + serialized_end=533, +) +_sym_db.RegisterEnumDescriptor(_SERVERUTILITYRESULT_RESULT) + + +_SENDSTATUSTEXTREQUEST = _descriptor.Descriptor( + name='SendStatusTextRequest', + full_name='mavsdk.rpc.server_utility.SendStatusTextRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='type', full_name='mavsdk.rpc.server_utility.SendStatusTextRequest.type', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='text', full_name='mavsdk.rpc.server_utility.SendStatusTextRequest.text', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=88, + serialized_end=182, +) + + +_SENDSTATUSTEXTRESPONSE = _descriptor.Descriptor( + name='SendStatusTextResponse', + full_name='mavsdk.rpc.server_utility.SendStatusTextResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='server_utility_result', full_name='mavsdk.rpc.server_utility.SendStatusTextResponse.server_utility_result', index=0, + number=1, type=11, cpp_type=10, label=1, + has_default_value=False, default_value=None, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=184, + serialized_end=287, +) + + +_SERVERUTILITYRESULT = _descriptor.Descriptor( + name='ServerUtilityResult', + full_name='mavsdk.rpc.server_utility.ServerUtilityResult', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='result', full_name='mavsdk.rpc.server_utility.ServerUtilityResult.result', index=0, + number=1, type=14, cpp_type=8, label=1, + has_default_value=False, default_value=0, + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='result_str', full_name='mavsdk.rpc.server_utility.ServerUtilityResult.result_str', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + _SERVERUTILITYRESULT_RESULT, + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=290, + serialized_end=533, +) + +_SENDSTATUSTEXTREQUEST.fields_by_name['type'].enum_type = _STATUSTEXTTYPE +_SENDSTATUSTEXTRESPONSE.fields_by_name['server_utility_result'].message_type = _SERVERUTILITYRESULT +_SERVERUTILITYRESULT.fields_by_name['result'].enum_type = _SERVERUTILITYRESULT_RESULT +_SERVERUTILITYRESULT_RESULT.containing_type = _SERVERUTILITYRESULT +DESCRIPTOR.message_types_by_name['SendStatusTextRequest'] = _SENDSTATUSTEXTREQUEST +DESCRIPTOR.message_types_by_name['SendStatusTextResponse'] = _SENDSTATUSTEXTRESPONSE +DESCRIPTOR.message_types_by_name['ServerUtilityResult'] = _SERVERUTILITYRESULT +DESCRIPTOR.enum_types_by_name['StatusTextType'] = _STATUSTEXTTYPE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +SendStatusTextRequest = _reflection.GeneratedProtocolMessageType('SendStatusTextRequest', (_message.Message,), { + 'DESCRIPTOR' : _SENDSTATUSTEXTREQUEST, + '__module__' : 'server_utility.server_utility_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.server_utility.SendStatusTextRequest) + }) +_sym_db.RegisterMessage(SendStatusTextRequest) + +SendStatusTextResponse = _reflection.GeneratedProtocolMessageType('SendStatusTextResponse', (_message.Message,), { + 'DESCRIPTOR' : _SENDSTATUSTEXTRESPONSE, + '__module__' : 'server_utility.server_utility_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.server_utility.SendStatusTextResponse) + }) +_sym_db.RegisterMessage(SendStatusTextResponse) + +ServerUtilityResult = _reflection.GeneratedProtocolMessageType('ServerUtilityResult', (_message.Message,), { + 'DESCRIPTOR' : _SERVERUTILITYRESULT, + '__module__' : 'server_utility.server_utility_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.server_utility.ServerUtilityResult) + }) +_sym_db.RegisterMessage(ServerUtilityResult) + + +DESCRIPTOR._options = None + +_SERVERUTILITYSERVICE = _descriptor.ServiceDescriptor( + name='ServerUtilityService', + full_name='mavsdk.rpc.server_utility.ServerUtilityService', + file=DESCRIPTOR, + index=0, + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_start=788, + serialized_end=935, + methods=[ + _descriptor.MethodDescriptor( + name='SendStatusText', + full_name='mavsdk.rpc.server_utility.ServerUtilityService.SendStatusText', + index=0, + containing_service=None, + input_type=_SENDSTATUSTEXTREQUEST, + output_type=_SENDSTATUSTEXTRESPONSE, + serialized_options=b'\200\265\030\001', + create_key=_descriptor._internal_create_key, + ), +]) +_sym_db.RegisterServiceDescriptor(_SERVERUTILITYSERVICE) + +DESCRIPTOR.services_by_name['ServerUtilityService'] = _SERVERUTILITYSERVICE + +# @@protoc_insertion_point(module_scope) diff --git a/mavsdk/server_utility_pb2_grpc.py b/mavsdk/server_utility_pb2_grpc.py new file mode 100644 index 00000000..71f90047 --- /dev/null +++ b/mavsdk/server_utility_pb2_grpc.py @@ -0,0 +1,73 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from . import server_utility_pb2 as server__utility_dot_server__utility__pb2 + + +class ServerUtilityServiceStub(object): + """ + Utility for onboard MAVSDK instances for common "server" tasks. + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.SendStatusText = channel.unary_unary( + '/mavsdk.rpc.server_utility.ServerUtilityService/SendStatusText', + request_serializer=server__utility_dot_server__utility__pb2.SendStatusTextRequest.SerializeToString, + response_deserializer=server__utility_dot_server__utility__pb2.SendStatusTextResponse.FromString, + ) + + +class ServerUtilityServiceServicer(object): + """ + Utility for onboard MAVSDK instances for common "server" tasks. + """ + + def SendStatusText(self, request, context): + """Sends a statustext. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_ServerUtilityServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'SendStatusText': grpc.unary_unary_rpc_method_handler( + servicer.SendStatusText, + request_deserializer=server__utility_dot_server__utility__pb2.SendStatusTextRequest.FromString, + response_serializer=server__utility_dot_server__utility__pb2.SendStatusTextResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'mavsdk.rpc.server_utility.ServerUtilityService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class ServerUtilityService(object): + """ + Utility for onboard MAVSDK instances for common "server" tasks. + """ + + @staticmethod + def SendStatusText(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/mavsdk.rpc.server_utility.ServerUtilityService/SendStatusText', + server__utility_dot_server__utility__pb2.SendStatusTextRequest.SerializeToString, + server__utility_dot_server__utility__pb2.SendStatusTextResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/mavsdk/source/plugins/index.rst b/mavsdk/source/plugins/index.rst index 62c7f4a6..42ad694f 100644 --- a/mavsdk/source/plugins/index.rst +++ b/mavsdk/source/plugins/index.rst @@ -25,3 +25,4 @@ Plugins tune failure tracking_server + server_utility diff --git a/mavsdk/source/plugins/server_utility.rst b/mavsdk/source/plugins/server_utility.rst new file mode 100644 index 00000000..4e8202ef --- /dev/null +++ b/mavsdk/source/plugins/server_utility.rst @@ -0,0 +1,8 @@ +ServerUtility +==== + +.. automodule:: mavsdk.server_utility + :members: + :undoc-members: + :show-inheritance: + :exclude-members: translate_from_rpc, translate_to_rpc \ No newline at end of file diff --git a/proto b/proto index a0d9af7b..3d35a8f0 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit a0d9af7b530261535d21299ccd9dec78d88d58c2 +Subproject commit 3d35a8f0ef5d736dc1ba275ecbd436248f525282