From e480cf11991e8cbe509f9e09da807c60e5fca103 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Mon, 13 May 2024 15:51:51 +1200 Subject: [PATCH] Update to MAVSDK v2.10.0 Signed-off-by: Julian Oes --- MAVSDK_SERVER_VERSION | 2 +- mavsdk/component_metadata.py | 498 ++++++++++++++++++ mavsdk/component_metadata_pb2.py | 159 ++++++ mavsdk/component_metadata_pb2_grpc.py | 179 +++++++ mavsdk/component_metadata_server.py | 171 ++++++ mavsdk/component_metadata_server_pb2.py | 69 +++ mavsdk/component_metadata_server_pb2_grpc.py | 71 +++ mavsdk/log_streaming.py | 320 +++++++++++ mavsdk/log_streaming_pb2.py | 114 ++++ mavsdk/log_streaming_pb2_grpc.py | 138 +++++ mavsdk/source/plugins/component_metadata.rst | 8 + .../plugins/component_metadata_server.rst | 8 + mavsdk/source/plugins/index.rst | 3 + mavsdk/source/plugins/log_streaming.rst | 8 + proto | 2 +- 15 files changed, 1748 insertions(+), 2 deletions(-) create mode 100644 mavsdk/component_metadata.py create mode 100644 mavsdk/component_metadata_pb2.py create mode 100644 mavsdk/component_metadata_pb2_grpc.py create mode 100644 mavsdk/component_metadata_server.py create mode 100644 mavsdk/component_metadata_server_pb2.py create mode 100644 mavsdk/component_metadata_server_pb2_grpc.py create mode 100644 mavsdk/log_streaming.py create mode 100644 mavsdk/log_streaming_pb2.py create mode 100644 mavsdk/log_streaming_pb2_grpc.py create mode 100644 mavsdk/source/plugins/component_metadata.rst create mode 100644 mavsdk/source/plugins/component_metadata_server.rst create mode 100644 mavsdk/source/plugins/log_streaming.rst diff --git a/MAVSDK_SERVER_VERSION b/MAVSDK_SERVER_VERSION index 7227c77f..80de12c5 100644 --- a/MAVSDK_SERVER_VERSION +++ b/MAVSDK_SERVER_VERSION @@ -1 +1 @@ -v2.9.1 +v2.10.0 diff --git a/mavsdk/component_metadata.py b/mavsdk/component_metadata.py new file mode 100644 index 00000000..2f7f54b8 --- /dev/null +++ b/mavsdk/component_metadata.py @@ -0,0 +1,498 @@ +# -*- 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 component_metadata_pb2, component_metadata_pb2_grpc +from enum import Enum + + +class MetadataType(Enum): + """ + + + Values + ------ + ALL_COMPLETED + This is set in the subscription callback when all metadata types completed for a given component ID + + PARAMETER + Parameter metadata + + EVENTS + Event definitions + + ACTUATORS + Actuator definitions + + """ + + + ALL_COMPLETED = 0 + PARAMETER = 1 + EVENTS = 2 + ACTUATORS = 3 + + def translate_to_rpc(self): + if self == MetadataType.ALL_COMPLETED: + return component_metadata_pb2.METADATA_TYPE_ALL_COMPLETED + if self == MetadataType.PARAMETER: + return component_metadata_pb2.METADATA_TYPE_PARAMETER + if self == MetadataType.EVENTS: + return component_metadata_pb2.METADATA_TYPE_EVENTS + if self == MetadataType.ACTUATORS: + return component_metadata_pb2.METADATA_TYPE_ACTUATORS + + @staticmethod + def translate_from_rpc(rpc_enum_value): + """ Parses a gRPC response """ + if rpc_enum_value == component_metadata_pb2.METADATA_TYPE_ALL_COMPLETED: + return MetadataType.ALL_COMPLETED + if rpc_enum_value == component_metadata_pb2.METADATA_TYPE_PARAMETER: + return MetadataType.PARAMETER + if rpc_enum_value == component_metadata_pb2.METADATA_TYPE_EVENTS: + return MetadataType.EVENTS + if rpc_enum_value == component_metadata_pb2.METADATA_TYPE_ACTUATORS: + return MetadataType.ACTUATORS + + def __str__(self): + return self.name + + +class MetadataData: + """ + Metadata response + + Parameters + ---------- + json_metadata : std::string + The JSON metadata + + """ + + + + def __init__( + self, + json_metadata): + """ Initializes the MetadataData object """ + self.json_metadata = json_metadata + + def __eq__(self, to_compare): + """ Checks if two MetadataData are the same """ + try: + # Try to compare - this likely fails when it is compared to a non + # MetadataData object + return \ + (self.json_metadata == to_compare.json_metadata) + + except AttributeError: + return False + + def __str__(self): + """ MetadataData in string representation """ + struct_repr = ", ".join([ + "json_metadata: " + str(self.json_metadata) + ]) + + return f"MetadataData: [{struct_repr}]" + + @staticmethod + def translate_from_rpc(rpcMetadataData): + """ Translates a gRPC struct to the SDK equivalent """ + return MetadataData( + + rpcMetadataData.json_metadata + ) + + def translate_to_rpc(self, rpcMetadataData): + """ Translates this SDK object into its gRPC equivalent """ + + + + + rpcMetadataData.json_metadata = self.json_metadata + + + + + +class ComponentMetadataResult: + """ + Result type. + + Parameters + ---------- + result : Result + Result enum value + + result_str : std::string + Human-readable English string describing the result + + """ + + + + class Result(Enum): + """ + Possible results returned for GetMetadata + + Values + ------ + SUCCESS + + NOT_AVAILABLE + + CONNECTION_ERROR + + UNSUPPORTED + + DENIED + + FAILED + + TIMEOUT + + NO_SYSTEM + + NOT_REQUESTED + + """ + + + SUCCESS = 0 + NOT_AVAILABLE = 1 + CONNECTION_ERROR = 2 + UNSUPPORTED = 3 + DENIED = 4 + FAILED = 5 + TIMEOUT = 6 + NO_SYSTEM = 7 + NOT_REQUESTED = 8 + + def translate_to_rpc(self): + if self == ComponentMetadataResult.Result.SUCCESS: + return component_metadata_pb2.ComponentMetadataResult.RESULT_SUCCESS + if self == ComponentMetadataResult.Result.NOT_AVAILABLE: + return component_metadata_pb2.ComponentMetadataResult.RESULT_NOT_AVAILABLE + if self == ComponentMetadataResult.Result.CONNECTION_ERROR: + return component_metadata_pb2.ComponentMetadataResult.RESULT_CONNECTION_ERROR + if self == ComponentMetadataResult.Result.UNSUPPORTED: + return component_metadata_pb2.ComponentMetadataResult.RESULT_UNSUPPORTED + if self == ComponentMetadataResult.Result.DENIED: + return component_metadata_pb2.ComponentMetadataResult.RESULT_DENIED + if self == ComponentMetadataResult.Result.FAILED: + return component_metadata_pb2.ComponentMetadataResult.RESULT_FAILED + if self == ComponentMetadataResult.Result.TIMEOUT: + return component_metadata_pb2.ComponentMetadataResult.RESULT_TIMEOUT + if self == ComponentMetadataResult.Result.NO_SYSTEM: + return component_metadata_pb2.ComponentMetadataResult.RESULT_NO_SYSTEM + if self == ComponentMetadataResult.Result.NOT_REQUESTED: + return component_metadata_pb2.ComponentMetadataResult.RESULT_NOT_REQUESTED + + @staticmethod + def translate_from_rpc(rpc_enum_value): + """ Parses a gRPC response """ + if rpc_enum_value == component_metadata_pb2.ComponentMetadataResult.RESULT_SUCCESS: + return ComponentMetadataResult.Result.SUCCESS + if rpc_enum_value == component_metadata_pb2.ComponentMetadataResult.RESULT_NOT_AVAILABLE: + return ComponentMetadataResult.Result.NOT_AVAILABLE + if rpc_enum_value == component_metadata_pb2.ComponentMetadataResult.RESULT_CONNECTION_ERROR: + return ComponentMetadataResult.Result.CONNECTION_ERROR + if rpc_enum_value == component_metadata_pb2.ComponentMetadataResult.RESULT_UNSUPPORTED: + return ComponentMetadataResult.Result.UNSUPPORTED + if rpc_enum_value == component_metadata_pb2.ComponentMetadataResult.RESULT_DENIED: + return ComponentMetadataResult.Result.DENIED + if rpc_enum_value == component_metadata_pb2.ComponentMetadataResult.RESULT_FAILED: + return ComponentMetadataResult.Result.FAILED + if rpc_enum_value == component_metadata_pb2.ComponentMetadataResult.RESULT_TIMEOUT: + return ComponentMetadataResult.Result.TIMEOUT + if rpc_enum_value == component_metadata_pb2.ComponentMetadataResult.RESULT_NO_SYSTEM: + return ComponentMetadataResult.Result.NO_SYSTEM + if rpc_enum_value == component_metadata_pb2.ComponentMetadataResult.RESULT_NOT_REQUESTED: + return ComponentMetadataResult.Result.NOT_REQUESTED + + def __str__(self): + return self.name + + + def __init__( + self, + result, + result_str): + """ Initializes the ComponentMetadataResult object """ + self.result = result + self.result_str = result_str + + def __eq__(self, to_compare): + """ Checks if two ComponentMetadataResult are the same """ + try: + # Try to compare - this likely fails when it is compared to a non + # ComponentMetadataResult object + return \ + (self.result == to_compare.result) and \ + (self.result_str == to_compare.result_str) + + except AttributeError: + return False + + def __str__(self): + """ ComponentMetadataResult in string representation """ + struct_repr = ", ".join([ + "result: " + str(self.result), + "result_str: " + str(self.result_str) + ]) + + return f"ComponentMetadataResult: [{struct_repr}]" + + @staticmethod + def translate_from_rpc(rpcComponentMetadataResult): + """ Translates a gRPC struct to the SDK equivalent """ + return ComponentMetadataResult( + + ComponentMetadataResult.Result.translate_from_rpc(rpcComponentMetadataResult.result), + + + rpcComponentMetadataResult.result_str + ) + + def translate_to_rpc(self, rpcComponentMetadataResult): + """ Translates this SDK object into its gRPC equivalent """ + + + + + rpcComponentMetadataResult.result = self.result.translate_to_rpc() + + + + + + rpcComponentMetadataResult.result_str = self.result_str + + + + + +class MetadataUpdate: + """ + Metadata for a given component and type + + Parameters + ---------- + compid : uint32_t + The component ID + + type : MetadataType + The metadata type + + json_metadata : std::string + The JSON metadata + + """ + + + + def __init__( + self, + compid, + type, + json_metadata): + """ Initializes the MetadataUpdate object """ + self.compid = compid + self.type = type + self.json_metadata = json_metadata + + def __eq__(self, to_compare): + """ Checks if two MetadataUpdate are the same """ + try: + # Try to compare - this likely fails when it is compared to a non + # MetadataUpdate object + return \ + (self.compid == to_compare.compid) and \ + (self.type == to_compare.type) and \ + (self.json_metadata == to_compare.json_metadata) + + except AttributeError: + return False + + def __str__(self): + """ MetadataUpdate in string representation """ + struct_repr = ", ".join([ + "compid: " + str(self.compid), + "type: " + str(self.type), + "json_metadata: " + str(self.json_metadata) + ]) + + return f"MetadataUpdate: [{struct_repr}]" + + @staticmethod + def translate_from_rpc(rpcMetadataUpdate): + """ Translates a gRPC struct to the SDK equivalent """ + return MetadataUpdate( + + rpcMetadataUpdate.compid, + + + MetadataType.translate_from_rpc(rpcMetadataUpdate.type), + + + rpcMetadataUpdate.json_metadata + ) + + def translate_to_rpc(self, rpcMetadataUpdate): + """ Translates this SDK object into its gRPC equivalent """ + + + + + rpcMetadataUpdate.compid = self.compid + + + + + + rpcMetadataUpdate.type = self.type.translate_to_rpc() + + + + + + rpcMetadataUpdate.json_metadata = self.json_metadata + + + + + + +class ComponentMetadataError(Exception): + """ Raised when a ComponentMetadataResult 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 ComponentMetadata(AsyncBase): + """ + Access component metadata json definitions, such as parameters. + + Generated by dcsdkgen - MAVSDK ComponentMetadata API + """ + + # Plugin name + name = "ComponentMetadata" + + def _setup_stub(self, channel): + """ Setups the api stub """ + self._stub = component_metadata_pb2_grpc.ComponentMetadataServiceStub(channel) + + + def _extract_result(self, response): + """ Returns the response status and description """ + return ComponentMetadataResult.translate_from_rpc(response.component_metadata_result) + + + async def request_component(self, compid): + """ + Request metadata from a specific component. This is used to start requesting metadata from a component. + The metadata can later be accessed via subscription (see below) or GetMetadata. + + Parameters + ---------- + compid : uint32_t + The component ID to request + + + """ + + request = component_metadata_pb2.RequestComponentRequest() + request.compid = compid + response = await self._stub.RequestComponent(request) + + + + async def request_autopilot_component(self): + """ + Request metadata from the autopilot component. This is used to start requesting metadata from the autopilot. + The metadata can later be accessed via subscription (see below) or GetMetadata. + + + """ + + request = component_metadata_pb2.RequestAutopilotComponentRequest() + response = await self._stub.RequestAutopilotComponent(request) + + + + async def metadata_available(self): + """ + Register a callback that gets called when metadata is available + + Yields + ------- + data : MetadataUpdate + + + """ + + request = component_metadata_pb2.SubscribeMetadataAvailableRequest() + metadata_available_stream = self._stub.SubscribeMetadataAvailable(request) + + try: + async for response in metadata_available_stream: + + + + yield MetadataUpdate.translate_from_rpc(response.data) + finally: + metadata_available_stream.cancel() + + async def get_metadata(self, compid, metadata_type): + """ + Access metadata. This can be used if you know the metadata is available already, otherwise use + the subscription to get notified when it becomes available. + + Parameters + ---------- + compid : uint32_t + The component ID to request + + metadata_type : MetadataType + The metadata type + + Returns + ------- + response : MetadataData + + Raises + ------ + ComponentMetadataError + If the request fails. The error contains the reason for the failure. + """ + + request = component_metadata_pb2.GetMetadataRequest() + + + request.compid = compid + + + + + request.metadata_type = metadata_type.translate_to_rpc() + + + response = await self._stub.GetMetadata(request) + + + result = self._extract_result(response) + + if result.result != ComponentMetadataResult.Result.SUCCESS: + raise ComponentMetadataError(result, "get_metadata()", compid, metadata_type) + + + return MetadataData.translate_from_rpc(response.response) + \ No newline at end of file diff --git a/mavsdk/component_metadata_pb2.py b/mavsdk/component_metadata_pb2.py new file mode 100644 index 00000000..ca8ffdc7 --- /dev/null +++ b/mavsdk/component_metadata_pb2.py @@ -0,0 +1,159 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: component_metadata/component_metadata.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +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_pool.Default().AddSerializedFile(b'\n+component_metadata/component_metadata.proto\x12\x1dmavsdk.rpc.component_metadata\x1a\x14mavsdk_options.proto\")\n\x17RequestComponentRequest\x12\x0e\n\x06\x63ompid\x18\x01 \x01(\r\"h\n\x12GetMetadataRequest\x12\x0e\n\x06\x63ompid\x18\x01 \x01(\r\x12\x42\n\rmetadata_type\x18\x02 \x01(\x0e\x32+.mavsdk.rpc.component_metadata.MetadataType\"\xaf\x01\n\x13GetMetadataResponse\x12Y\n\x19\x63omponent_metadata_result\x18\x01 \x01(\x0b\x32\x36.mavsdk.rpc.component_metadata.ComponentMetadataResult\x12=\n\x08response\x18\x02 \x01(\x0b\x32+.mavsdk.rpc.component_metadata.MetadataData\"%\n\x0cMetadataData\x12\x15\n\rjson_metadata\x18\x01 \x01(\t\"\xd4\x02\n\x17\x43omponentMetadataResult\x12M\n\x06result\x18\x01 \x01(\x0e\x32=.mavsdk.rpc.component_metadata.ComponentMetadataResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t\"\xd5\x01\n\x06Result\x12\x12\n\x0eRESULT_SUCCESS\x10\x00\x12\x18\n\x14RESULT_NOT_AVAILABLE\x10\x01\x12\x1b\n\x17RESULT_CONNECTION_ERROR\x10\x02\x12\x16\n\x12RESULT_UNSUPPORTED\x10\x03\x12\x11\n\rRESULT_DENIED\x10\x04\x12\x11\n\rRESULT_FAILED\x10\x05\x12\x12\n\x0eRESULT_TIMEOUT\x10\x06\x12\x14\n\x10RESULT_NO_SYSTEM\x10\x07\x12\x18\n\x14RESULT_NOT_REQUESTED\x10\x08\"\x1a\n\x18RequestComponentResponse\"\"\n RequestAutopilotComponentRequest\"#\n!RequestAutopilotComponentResponse\"#\n!SubscribeMetadataAvailableRequest\"X\n\x19MetadataAvailableResponse\x12;\n\x04\x64\x61ta\x18\x01 \x01(\x0b\x32-.mavsdk.rpc.component_metadata.MetadataUpdate\"r\n\x0eMetadataUpdate\x12\x0e\n\x06\x63ompid\x18\x01 \x01(\r\x12\x39\n\x04type\x18\x02 \x01(\x0e\x32+.mavsdk.rpc.component_metadata.MetadataType\x12\x15\n\rjson_metadata\x18\x03 \x01(\t*\x83\x01\n\x0cMetadataType\x12\x1f\n\x1bMETADATA_TYPE_ALL_COMPLETED\x10\x00\x12\x1b\n\x17METADATA_TYPE_PARAMETER\x10\x01\x12\x18\n\x14METADATA_TYPE_EVENTS\x10\x02\x12\x1b\n\x17METADATA_TYPE_ACTUATORS\x10\x03\x32\xec\x04\n\x18\x43omponentMetadataService\x12\x89\x01\n\x10RequestComponent\x12\x36.mavsdk.rpc.component_metadata.RequestComponentRequest\x1a\x37.mavsdk.rpc.component_metadata.RequestComponentResponse\"\x04\x80\xb5\x18\x01\x12\xa4\x01\n\x19RequestAutopilotComponent\x12?.mavsdk.rpc.component_metadata.RequestAutopilotComponentRequest\x1a@.mavsdk.rpc.component_metadata.RequestAutopilotComponentResponse\"\x04\x80\xb5\x18\x01\x12\xa0\x01\n\x1aSubscribeMetadataAvailable\x12@.mavsdk.rpc.component_metadata.SubscribeMetadataAvailableRequest\x1a\x38.mavsdk.rpc.component_metadata.MetadataAvailableResponse\"\x04\x80\xb5\x18\x00\x30\x01\x12z\n\x0bGetMetadata\x12\x31.mavsdk.rpc.component_metadata.GetMetadataRequest\x1a\x32.mavsdk.rpc.component_metadata.GetMetadataResponse\"\x04\x80\xb5\x18\x01\x42\x36\n\x1cio.mavsdk.component_metadataB\x16\x43omponentMetadataProtob\x06proto3') + +_METADATATYPE = DESCRIPTOR.enum_types_by_name['MetadataType'] +MetadataType = enum_type_wrapper.EnumTypeWrapper(_METADATATYPE) +METADATA_TYPE_ALL_COMPLETED = 0 +METADATA_TYPE_PARAMETER = 1 +METADATA_TYPE_EVENTS = 2 +METADATA_TYPE_ACTUATORS = 3 + + +_REQUESTCOMPONENTREQUEST = DESCRIPTOR.message_types_by_name['RequestComponentRequest'] +_GETMETADATAREQUEST = DESCRIPTOR.message_types_by_name['GetMetadataRequest'] +_GETMETADATARESPONSE = DESCRIPTOR.message_types_by_name['GetMetadataResponse'] +_METADATADATA = DESCRIPTOR.message_types_by_name['MetadataData'] +_COMPONENTMETADATARESULT = DESCRIPTOR.message_types_by_name['ComponentMetadataResult'] +_REQUESTCOMPONENTRESPONSE = DESCRIPTOR.message_types_by_name['RequestComponentResponse'] +_REQUESTAUTOPILOTCOMPONENTREQUEST = DESCRIPTOR.message_types_by_name['RequestAutopilotComponentRequest'] +_REQUESTAUTOPILOTCOMPONENTRESPONSE = DESCRIPTOR.message_types_by_name['RequestAutopilotComponentResponse'] +_SUBSCRIBEMETADATAAVAILABLEREQUEST = DESCRIPTOR.message_types_by_name['SubscribeMetadataAvailableRequest'] +_METADATAAVAILABLERESPONSE = DESCRIPTOR.message_types_by_name['MetadataAvailableResponse'] +_METADATAUPDATE = DESCRIPTOR.message_types_by_name['MetadataUpdate'] +_COMPONENTMETADATARESULT_RESULT = _COMPONENTMETADATARESULT.enum_types_by_name['Result'] +RequestComponentRequest = _reflection.GeneratedProtocolMessageType('RequestComponentRequest', (_message.Message,), { + 'DESCRIPTOR' : _REQUESTCOMPONENTREQUEST, + '__module__' : 'component_metadata.component_metadata_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.component_metadata.RequestComponentRequest) + }) +_sym_db.RegisterMessage(RequestComponentRequest) + +GetMetadataRequest = _reflection.GeneratedProtocolMessageType('GetMetadataRequest', (_message.Message,), { + 'DESCRIPTOR' : _GETMETADATAREQUEST, + '__module__' : 'component_metadata.component_metadata_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.component_metadata.GetMetadataRequest) + }) +_sym_db.RegisterMessage(GetMetadataRequest) + +GetMetadataResponse = _reflection.GeneratedProtocolMessageType('GetMetadataResponse', (_message.Message,), { + 'DESCRIPTOR' : _GETMETADATARESPONSE, + '__module__' : 'component_metadata.component_metadata_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.component_metadata.GetMetadataResponse) + }) +_sym_db.RegisterMessage(GetMetadataResponse) + +MetadataData = _reflection.GeneratedProtocolMessageType('MetadataData', (_message.Message,), { + 'DESCRIPTOR' : _METADATADATA, + '__module__' : 'component_metadata.component_metadata_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.component_metadata.MetadataData) + }) +_sym_db.RegisterMessage(MetadataData) + +ComponentMetadataResult = _reflection.GeneratedProtocolMessageType('ComponentMetadataResult', (_message.Message,), { + 'DESCRIPTOR' : _COMPONENTMETADATARESULT, + '__module__' : 'component_metadata.component_metadata_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.component_metadata.ComponentMetadataResult) + }) +_sym_db.RegisterMessage(ComponentMetadataResult) + +RequestComponentResponse = _reflection.GeneratedProtocolMessageType('RequestComponentResponse', (_message.Message,), { + 'DESCRIPTOR' : _REQUESTCOMPONENTRESPONSE, + '__module__' : 'component_metadata.component_metadata_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.component_metadata.RequestComponentResponse) + }) +_sym_db.RegisterMessage(RequestComponentResponse) + +RequestAutopilotComponentRequest = _reflection.GeneratedProtocolMessageType('RequestAutopilotComponentRequest', (_message.Message,), { + 'DESCRIPTOR' : _REQUESTAUTOPILOTCOMPONENTREQUEST, + '__module__' : 'component_metadata.component_metadata_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.component_metadata.RequestAutopilotComponentRequest) + }) +_sym_db.RegisterMessage(RequestAutopilotComponentRequest) + +RequestAutopilotComponentResponse = _reflection.GeneratedProtocolMessageType('RequestAutopilotComponentResponse', (_message.Message,), { + 'DESCRIPTOR' : _REQUESTAUTOPILOTCOMPONENTRESPONSE, + '__module__' : 'component_metadata.component_metadata_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.component_metadata.RequestAutopilotComponentResponse) + }) +_sym_db.RegisterMessage(RequestAutopilotComponentResponse) + +SubscribeMetadataAvailableRequest = _reflection.GeneratedProtocolMessageType('SubscribeMetadataAvailableRequest', (_message.Message,), { + 'DESCRIPTOR' : _SUBSCRIBEMETADATAAVAILABLEREQUEST, + '__module__' : 'component_metadata.component_metadata_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.component_metadata.SubscribeMetadataAvailableRequest) + }) +_sym_db.RegisterMessage(SubscribeMetadataAvailableRequest) + +MetadataAvailableResponse = _reflection.GeneratedProtocolMessageType('MetadataAvailableResponse', (_message.Message,), { + 'DESCRIPTOR' : _METADATAAVAILABLERESPONSE, + '__module__' : 'component_metadata.component_metadata_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.component_metadata.MetadataAvailableResponse) + }) +_sym_db.RegisterMessage(MetadataAvailableResponse) + +MetadataUpdate = _reflection.GeneratedProtocolMessageType('MetadataUpdate', (_message.Message,), { + 'DESCRIPTOR' : _METADATAUPDATE, + '__module__' : 'component_metadata.component_metadata_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.component_metadata.MetadataUpdate) + }) +_sym_db.RegisterMessage(MetadataUpdate) + +_COMPONENTMETADATASERVICE = DESCRIPTOR.services_by_name['ComponentMetadataService'] +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\034io.mavsdk.component_metadataB\026ComponentMetadataProto' + _COMPONENTMETADATASERVICE.methods_by_name['RequestComponent']._options = None + _COMPONENTMETADATASERVICE.methods_by_name['RequestComponent']._serialized_options = b'\200\265\030\001' + _COMPONENTMETADATASERVICE.methods_by_name['RequestAutopilotComponent']._options = None + _COMPONENTMETADATASERVICE.methods_by_name['RequestAutopilotComponent']._serialized_options = b'\200\265\030\001' + _COMPONENTMETADATASERVICE.methods_by_name['SubscribeMetadataAvailable']._options = None + _COMPONENTMETADATASERVICE.methods_by_name['SubscribeMetadataAvailable']._serialized_options = b'\200\265\030\000' + _COMPONENTMETADATASERVICE.methods_by_name['GetMetadata']._options = None + _COMPONENTMETADATASERVICE.methods_by_name['GetMetadata']._serialized_options = b'\200\265\030\001' + _METADATATYPE._serialized_start=1154 + _METADATATYPE._serialized_end=1285 + _REQUESTCOMPONENTREQUEST._serialized_start=100 + _REQUESTCOMPONENTREQUEST._serialized_end=141 + _GETMETADATAREQUEST._serialized_start=143 + _GETMETADATAREQUEST._serialized_end=247 + _GETMETADATARESPONSE._serialized_start=250 + _GETMETADATARESPONSE._serialized_end=425 + _METADATADATA._serialized_start=427 + _METADATADATA._serialized_end=464 + _COMPONENTMETADATARESULT._serialized_start=467 + _COMPONENTMETADATARESULT._serialized_end=807 + _COMPONENTMETADATARESULT_RESULT._serialized_start=594 + _COMPONENTMETADATARESULT_RESULT._serialized_end=807 + _REQUESTCOMPONENTRESPONSE._serialized_start=809 + _REQUESTCOMPONENTRESPONSE._serialized_end=835 + _REQUESTAUTOPILOTCOMPONENTREQUEST._serialized_start=837 + _REQUESTAUTOPILOTCOMPONENTREQUEST._serialized_end=871 + _REQUESTAUTOPILOTCOMPONENTRESPONSE._serialized_start=873 + _REQUESTAUTOPILOTCOMPONENTRESPONSE._serialized_end=908 + _SUBSCRIBEMETADATAAVAILABLEREQUEST._serialized_start=910 + _SUBSCRIBEMETADATAAVAILABLEREQUEST._serialized_end=945 + _METADATAAVAILABLERESPONSE._serialized_start=947 + _METADATAAVAILABLERESPONSE._serialized_end=1035 + _METADATAUPDATE._serialized_start=1037 + _METADATAUPDATE._serialized_end=1151 + _COMPONENTMETADATASERVICE._serialized_start=1288 + _COMPONENTMETADATASERVICE._serialized_end=1908 +# @@protoc_insertion_point(module_scope) diff --git a/mavsdk/component_metadata_pb2_grpc.py b/mavsdk/component_metadata_pb2_grpc.py new file mode 100644 index 00000000..055028f3 --- /dev/null +++ b/mavsdk/component_metadata_pb2_grpc.py @@ -0,0 +1,179 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from . import component_metadata_pb2 as component__metadata_dot_component__metadata__pb2 + + +class ComponentMetadataServiceStub(object): + """Access component metadata json definitions, such as parameters. + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.RequestComponent = channel.unary_unary( + '/mavsdk.rpc.component_metadata.ComponentMetadataService/RequestComponent', + request_serializer=component__metadata_dot_component__metadata__pb2.RequestComponentRequest.SerializeToString, + response_deserializer=component__metadata_dot_component__metadata__pb2.RequestComponentResponse.FromString, + ) + self.RequestAutopilotComponent = channel.unary_unary( + '/mavsdk.rpc.component_metadata.ComponentMetadataService/RequestAutopilotComponent', + request_serializer=component__metadata_dot_component__metadata__pb2.RequestAutopilotComponentRequest.SerializeToString, + response_deserializer=component__metadata_dot_component__metadata__pb2.RequestAutopilotComponentResponse.FromString, + ) + self.SubscribeMetadataAvailable = channel.unary_stream( + '/mavsdk.rpc.component_metadata.ComponentMetadataService/SubscribeMetadataAvailable', + request_serializer=component__metadata_dot_component__metadata__pb2.SubscribeMetadataAvailableRequest.SerializeToString, + response_deserializer=component__metadata_dot_component__metadata__pb2.MetadataAvailableResponse.FromString, + ) + self.GetMetadata = channel.unary_unary( + '/mavsdk.rpc.component_metadata.ComponentMetadataService/GetMetadata', + request_serializer=component__metadata_dot_component__metadata__pb2.GetMetadataRequest.SerializeToString, + response_deserializer=component__metadata_dot_component__metadata__pb2.GetMetadataResponse.FromString, + ) + + +class ComponentMetadataServiceServicer(object): + """Access component metadata json definitions, such as parameters. + """ + + def RequestComponent(self, request, context): + """ + Request metadata from a specific component. This is used to start requesting metadata from a component. + The metadata can later be accessed via subscription (see below) or GetMetadata. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def RequestAutopilotComponent(self, request, context): + """ + Request metadata from the autopilot component. This is used to start requesting metadata from the autopilot. + The metadata can later be accessed via subscription (see below) or GetMetadata. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SubscribeMetadataAvailable(self, request, context): + """ + Register a callback that gets called when metadata is available + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def GetMetadata(self, request, context): + """ + Access metadata. This can be used if you know the metadata is available already, otherwise use + the subscription to get notified when it becomes available. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_ComponentMetadataServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'RequestComponent': grpc.unary_unary_rpc_method_handler( + servicer.RequestComponent, + request_deserializer=component__metadata_dot_component__metadata__pb2.RequestComponentRequest.FromString, + response_serializer=component__metadata_dot_component__metadata__pb2.RequestComponentResponse.SerializeToString, + ), + 'RequestAutopilotComponent': grpc.unary_unary_rpc_method_handler( + servicer.RequestAutopilotComponent, + request_deserializer=component__metadata_dot_component__metadata__pb2.RequestAutopilotComponentRequest.FromString, + response_serializer=component__metadata_dot_component__metadata__pb2.RequestAutopilotComponentResponse.SerializeToString, + ), + 'SubscribeMetadataAvailable': grpc.unary_stream_rpc_method_handler( + servicer.SubscribeMetadataAvailable, + request_deserializer=component__metadata_dot_component__metadata__pb2.SubscribeMetadataAvailableRequest.FromString, + response_serializer=component__metadata_dot_component__metadata__pb2.MetadataAvailableResponse.SerializeToString, + ), + 'GetMetadata': grpc.unary_unary_rpc_method_handler( + servicer.GetMetadata, + request_deserializer=component__metadata_dot_component__metadata__pb2.GetMetadataRequest.FromString, + response_serializer=component__metadata_dot_component__metadata__pb2.GetMetadataResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'mavsdk.rpc.component_metadata.ComponentMetadataService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class ComponentMetadataService(object): + """Access component metadata json definitions, such as parameters. + """ + + @staticmethod + def RequestComponent(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.component_metadata.ComponentMetadataService/RequestComponent', + component__metadata_dot_component__metadata__pb2.RequestComponentRequest.SerializeToString, + component__metadata_dot_component__metadata__pb2.RequestComponentResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def RequestAutopilotComponent(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.component_metadata.ComponentMetadataService/RequestAutopilotComponent', + component__metadata_dot_component__metadata__pb2.RequestAutopilotComponentRequest.SerializeToString, + component__metadata_dot_component__metadata__pb2.RequestAutopilotComponentResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def SubscribeMetadataAvailable(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_stream(request, target, '/mavsdk.rpc.component_metadata.ComponentMetadataService/SubscribeMetadataAvailable', + component__metadata_dot_component__metadata__pb2.SubscribeMetadataAvailableRequest.SerializeToString, + component__metadata_dot_component__metadata__pb2.MetadataAvailableResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def GetMetadata(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.component_metadata.ComponentMetadataService/GetMetadata', + component__metadata_dot_component__metadata__pb2.GetMetadataRequest.SerializeToString, + component__metadata_dot_component__metadata__pb2.GetMetadataResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/mavsdk/component_metadata_server.py b/mavsdk/component_metadata_server.py new file mode 100644 index 00000000..c2231fc6 --- /dev/null +++ b/mavsdk/component_metadata_server.py @@ -0,0 +1,171 @@ +# -*- 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 component_metadata_server_pb2, component_metadata_server_pb2_grpc +from enum import Enum + + +class MetadataType(Enum): + """ + + + Values + ------ + PARAMETER + Parameter metadata + + EVENTS + Event definitions + + ACTUATORS + Actuator definitions + + """ + + + PARAMETER = 0 + EVENTS = 1 + ACTUATORS = 2 + + def translate_to_rpc(self): + if self == MetadataType.PARAMETER: + return component_metadata_server_pb2.METADATA_TYPE_PARAMETER + if self == MetadataType.EVENTS: + return component_metadata_server_pb2.METADATA_TYPE_EVENTS + if self == MetadataType.ACTUATORS: + return component_metadata_server_pb2.METADATA_TYPE_ACTUATORS + + @staticmethod + def translate_from_rpc(rpc_enum_value): + """ Parses a gRPC response """ + if rpc_enum_value == component_metadata_server_pb2.METADATA_TYPE_PARAMETER: + return MetadataType.PARAMETER + if rpc_enum_value == component_metadata_server_pb2.METADATA_TYPE_EVENTS: + return MetadataType.EVENTS + if rpc_enum_value == component_metadata_server_pb2.METADATA_TYPE_ACTUATORS: + return MetadataType.ACTUATORS + + def __str__(self): + return self.name + + +class Metadata: + """ + + + Parameters + ---------- + type : MetadataType + The metadata type + + json_metadata : std::string + The JSON metadata + + """ + + + + def __init__( + self, + type, + json_metadata): + """ Initializes the Metadata object """ + self.type = type + self.json_metadata = json_metadata + + def __eq__(self, to_compare): + """ Checks if two Metadata are the same """ + try: + # Try to compare - this likely fails when it is compared to a non + # Metadata object + return \ + (self.type == to_compare.type) and \ + (self.json_metadata == to_compare.json_metadata) + + except AttributeError: + return False + + def __str__(self): + """ Metadata in string representation """ + struct_repr = ", ".join([ + "type: " + str(self.type), + "json_metadata: " + str(self.json_metadata) + ]) + + return f"Metadata: [{struct_repr}]" + + @staticmethod + def translate_from_rpc(rpcMetadata): + """ Translates a gRPC struct to the SDK equivalent """ + return Metadata( + + MetadataType.translate_from_rpc(rpcMetadata.type), + + + rpcMetadata.json_metadata + ) + + def translate_to_rpc(self, rpcMetadata): + """ Translates this SDK object into its gRPC equivalent """ + + + + + rpcMetadata.type = self.type.translate_to_rpc() + + + + + + rpcMetadata.json_metadata = self.json_metadata + + + + + + + +class ComponentMetadataServer(AsyncBase): + """ + Provide component metadata json definitions, such as parameters. + + Generated by dcsdkgen - MAVSDK ComponentMetadataServer API + """ + + # Plugin name + name = "ComponentMetadataServer" + + def _setup_stub(self, channel): + """ Setups the api stub """ + self._stub = component_metadata_server_pb2_grpc.ComponentMetadataServerServiceStub(channel) + + + + async def set_metadata(self, metadata): + """ + Provide metadata (can only be called once) + + Parameters + ---------- + metadata : [Metadata] + List of metadata + + + """ + + request = component_metadata_server_pb2.SetMetadataRequest() + + rpc_elems_list = [] + for elem in metadata: + + rpc_elem = component_metadata_server_pb2.Metadata() + elem.translate_to_rpc(rpc_elem) + rpc_elems_list.append(rpc_elem) + + request.metadata.extend(rpc_elems_list) + + + response = await self._stub.SetMetadata(request) + + \ No newline at end of file diff --git a/mavsdk/component_metadata_server_pb2.py b/mavsdk/component_metadata_server_pb2.py new file mode 100644 index 00000000..b53d739f --- /dev/null +++ b/mavsdk/component_metadata_server_pb2.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: component_metadata_server/component_metadata_server.proto +"""Generated protocol buffer code.""" +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +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_pool.Default().AddSerializedFile(b'\n9component_metadata_server/component_metadata_server.proto\x12$mavsdk.rpc.component_metadata_server\x1a\x14mavsdk_options.proto\"V\n\x12SetMetadataRequest\x12@\n\x08metadata\x18\x01 \x03(\x0b\x32..mavsdk.rpc.component_metadata_server.Metadata\"\x15\n\x13SetMetadataResponse\"c\n\x08Metadata\x12@\n\x04type\x18\x01 \x01(\x0e\x32\x32.mavsdk.rpc.component_metadata_server.MetadataType\x12\x15\n\rjson_metadata\x18\x02 \x01(\t*b\n\x0cMetadataType\x12\x1b\n\x17METADATA_TYPE_PARAMETER\x10\x00\x12\x18\n\x14METADATA_TYPE_EVENTS\x10\x01\x12\x1b\n\x17METADATA_TYPE_ACTUATORS\x10\x02\x32\xab\x01\n\x1e\x43omponentMetadataServerService\x12\x88\x01\n\x0bSetMetadata\x12\x38.mavsdk.rpc.component_metadata_server.SetMetadataRequest\x1a\x39.mavsdk.rpc.component_metadata_server.SetMetadataResponse\"\x04\x80\xb5\x18\x01\x42\x43\n#io.mavsdk.component_metadata_serverB\x1c\x43omponentMetadataServerProtob\x06proto3') + +_METADATATYPE = DESCRIPTOR.enum_types_by_name['MetadataType'] +MetadataType = enum_type_wrapper.EnumTypeWrapper(_METADATATYPE) +METADATA_TYPE_PARAMETER = 0 +METADATA_TYPE_EVENTS = 1 +METADATA_TYPE_ACTUATORS = 2 + + +_SETMETADATAREQUEST = DESCRIPTOR.message_types_by_name['SetMetadataRequest'] +_SETMETADATARESPONSE = DESCRIPTOR.message_types_by_name['SetMetadataResponse'] +_METADATA = DESCRIPTOR.message_types_by_name['Metadata'] +SetMetadataRequest = _reflection.GeneratedProtocolMessageType('SetMetadataRequest', (_message.Message,), { + 'DESCRIPTOR' : _SETMETADATAREQUEST, + '__module__' : 'component_metadata_server.component_metadata_server_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.component_metadata_server.SetMetadataRequest) + }) +_sym_db.RegisterMessage(SetMetadataRequest) + +SetMetadataResponse = _reflection.GeneratedProtocolMessageType('SetMetadataResponse', (_message.Message,), { + 'DESCRIPTOR' : _SETMETADATARESPONSE, + '__module__' : 'component_metadata_server.component_metadata_server_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.component_metadata_server.SetMetadataResponse) + }) +_sym_db.RegisterMessage(SetMetadataResponse) + +Metadata = _reflection.GeneratedProtocolMessageType('Metadata', (_message.Message,), { + 'DESCRIPTOR' : _METADATA, + '__module__' : 'component_metadata_server.component_metadata_server_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.component_metadata_server.Metadata) + }) +_sym_db.RegisterMessage(Metadata) + +_COMPONENTMETADATASERVERSERVICE = DESCRIPTOR.services_by_name['ComponentMetadataServerService'] +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n#io.mavsdk.component_metadata_serverB\034ComponentMetadataServerProto' + _COMPONENTMETADATASERVERSERVICE.methods_by_name['SetMetadata']._options = None + _COMPONENTMETADATASERVERSERVICE.methods_by_name['SetMetadata']._serialized_options = b'\200\265\030\001' + _METADATATYPE._serialized_start=333 + _METADATATYPE._serialized_end=431 + _SETMETADATAREQUEST._serialized_start=121 + _SETMETADATAREQUEST._serialized_end=207 + _SETMETADATARESPONSE._serialized_start=209 + _SETMETADATARESPONSE._serialized_end=230 + _METADATA._serialized_start=232 + _METADATA._serialized_end=331 + _COMPONENTMETADATASERVERSERVICE._serialized_start=434 + _COMPONENTMETADATASERVERSERVICE._serialized_end=605 +# @@protoc_insertion_point(module_scope) diff --git a/mavsdk/component_metadata_server_pb2_grpc.py b/mavsdk/component_metadata_server_pb2_grpc.py new file mode 100644 index 00000000..9e8f1ac1 --- /dev/null +++ b/mavsdk/component_metadata_server_pb2_grpc.py @@ -0,0 +1,71 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from . import component_metadata_server_pb2 as component__metadata__server_dot_component__metadata__server__pb2 + + +class ComponentMetadataServerServiceStub(object): + """Provide component metadata json definitions, such as parameters. + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.SetMetadata = channel.unary_unary( + '/mavsdk.rpc.component_metadata_server.ComponentMetadataServerService/SetMetadata', + request_serializer=component__metadata__server_dot_component__metadata__server__pb2.SetMetadataRequest.SerializeToString, + response_deserializer=component__metadata__server_dot_component__metadata__server__pb2.SetMetadataResponse.FromString, + ) + + +class ComponentMetadataServerServiceServicer(object): + """Provide component metadata json definitions, such as parameters. + """ + + def SetMetadata(self, request, context): + """ + Provide metadata (can only be called once) + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_ComponentMetadataServerServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'SetMetadata': grpc.unary_unary_rpc_method_handler( + servicer.SetMetadata, + request_deserializer=component__metadata__server_dot_component__metadata__server__pb2.SetMetadataRequest.FromString, + response_serializer=component__metadata__server_dot_component__metadata__server__pb2.SetMetadataResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'mavsdk.rpc.component_metadata_server.ComponentMetadataServerService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class ComponentMetadataServerService(object): + """Provide component metadata json definitions, such as parameters. + """ + + @staticmethod + def SetMetadata(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.component_metadata_server.ComponentMetadataServerService/SetMetadata', + component__metadata__server_dot_component__metadata__server__pb2.SetMetadataRequest.SerializeToString, + component__metadata__server_dot_component__metadata__server__pb2.SetMetadataResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/mavsdk/log_streaming.py b/mavsdk/log_streaming.py new file mode 100644 index 00000000..40c6ed62 --- /dev/null +++ b/mavsdk/log_streaming.py @@ -0,0 +1,320 @@ +# -*- 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 log_streaming_pb2, log_streaming_pb2_grpc +from enum import Enum + + +class LogStreamingRaw: + """ + Raw logging data type + + Parameters + ---------- + data : std::string + Ulog file stream data encoded as base64 + + """ + + + + def __init__( + self, + data): + """ Initializes the LogStreamingRaw object """ + self.data = data + + def __eq__(self, to_compare): + """ Checks if two LogStreamingRaw are the same """ + try: + # Try to compare - this likely fails when it is compared to a non + # LogStreamingRaw object + return \ + (self.data == to_compare.data) + + except AttributeError: + return False + + def __str__(self): + """ LogStreamingRaw in string representation """ + struct_repr = ", ".join([ + "data: " + str(self.data) + ]) + + return f"LogStreamingRaw: [{struct_repr}]" + + @staticmethod + def translate_from_rpc(rpcLogStreamingRaw): + """ Translates a gRPC struct to the SDK equivalent """ + return LogStreamingRaw( + + rpcLogStreamingRaw.data + ) + + def translate_to_rpc(self, rpcLogStreamingRaw): + """ Translates this SDK object into its gRPC equivalent """ + + + + + rpcLogStreamingRaw.data = self.data + + + + + +class LogStreamingResult: + """ + Result type. + + Parameters + ---------- + result : Result + Result enum value + + result_str : std::string + Human-readable English string describing the result + + """ + + + + class Result(Enum): + """ + Possible results returned for logging requests + + Values + ------ + SUCCESS + Request succeeded + + NO_SYSTEM + No system connected + + CONNECTION_ERROR + Connection error + + BUSY + System busy + + COMMAND_DENIED + Command denied + + TIMEOUT + Timeout + + UNSUPPORTED + Unsupported + + UNKNOWN + Unknown error + + """ + + + SUCCESS = 0 + NO_SYSTEM = 1 + CONNECTION_ERROR = 2 + BUSY = 3 + COMMAND_DENIED = 4 + TIMEOUT = 5 + UNSUPPORTED = 6 + UNKNOWN = 7 + + def translate_to_rpc(self): + if self == LogStreamingResult.Result.SUCCESS: + return log_streaming_pb2.LogStreamingResult.RESULT_SUCCESS + if self == LogStreamingResult.Result.NO_SYSTEM: + return log_streaming_pb2.LogStreamingResult.RESULT_NO_SYSTEM + if self == LogStreamingResult.Result.CONNECTION_ERROR: + return log_streaming_pb2.LogStreamingResult.RESULT_CONNECTION_ERROR + if self == LogStreamingResult.Result.BUSY: + return log_streaming_pb2.LogStreamingResult.RESULT_BUSY + if self == LogStreamingResult.Result.COMMAND_DENIED: + return log_streaming_pb2.LogStreamingResult.RESULT_COMMAND_DENIED + if self == LogStreamingResult.Result.TIMEOUT: + return log_streaming_pb2.LogStreamingResult.RESULT_TIMEOUT + if self == LogStreamingResult.Result.UNSUPPORTED: + return log_streaming_pb2.LogStreamingResult.RESULT_UNSUPPORTED + if self == LogStreamingResult.Result.UNKNOWN: + return log_streaming_pb2.LogStreamingResult.RESULT_UNKNOWN + + @staticmethod + def translate_from_rpc(rpc_enum_value): + """ Parses a gRPC response """ + if rpc_enum_value == log_streaming_pb2.LogStreamingResult.RESULT_SUCCESS: + return LogStreamingResult.Result.SUCCESS + if rpc_enum_value == log_streaming_pb2.LogStreamingResult.RESULT_NO_SYSTEM: + return LogStreamingResult.Result.NO_SYSTEM + if rpc_enum_value == log_streaming_pb2.LogStreamingResult.RESULT_CONNECTION_ERROR: + return LogStreamingResult.Result.CONNECTION_ERROR + if rpc_enum_value == log_streaming_pb2.LogStreamingResult.RESULT_BUSY: + return LogStreamingResult.Result.BUSY + if rpc_enum_value == log_streaming_pb2.LogStreamingResult.RESULT_COMMAND_DENIED: + return LogStreamingResult.Result.COMMAND_DENIED + if rpc_enum_value == log_streaming_pb2.LogStreamingResult.RESULT_TIMEOUT: + return LogStreamingResult.Result.TIMEOUT + if rpc_enum_value == log_streaming_pb2.LogStreamingResult.RESULT_UNSUPPORTED: + return LogStreamingResult.Result.UNSUPPORTED + if rpc_enum_value == log_streaming_pb2.LogStreamingResult.RESULT_UNKNOWN: + return LogStreamingResult.Result.UNKNOWN + + def __str__(self): + return self.name + + + def __init__( + self, + result, + result_str): + """ Initializes the LogStreamingResult object """ + self.result = result + self.result_str = result_str + + def __eq__(self, to_compare): + """ Checks if two LogStreamingResult are the same """ + try: + # Try to compare - this likely fails when it is compared to a non + # LogStreamingResult object + return \ + (self.result == to_compare.result) and \ + (self.result_str == to_compare.result_str) + + except AttributeError: + return False + + def __str__(self): + """ LogStreamingResult in string representation """ + struct_repr = ", ".join([ + "result: " + str(self.result), + "result_str: " + str(self.result_str) + ]) + + return f"LogStreamingResult: [{struct_repr}]" + + @staticmethod + def translate_from_rpc(rpcLogStreamingResult): + """ Translates a gRPC struct to the SDK equivalent """ + return LogStreamingResult( + + LogStreamingResult.Result.translate_from_rpc(rpcLogStreamingResult.result), + + + rpcLogStreamingResult.result_str + ) + + def translate_to_rpc(self, rpcLogStreamingResult): + """ Translates this SDK object into its gRPC equivalent """ + + + + + rpcLogStreamingResult.result = self.result.translate_to_rpc() + + + + + + rpcLogStreamingResult.result_str = self.result_str + + + + + + +class LogStreamingError(Exception): + """ Raised when a LogStreamingResult 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 LogStreaming(AsyncBase): + """ + Provide log streaming data. + + Generated by dcsdkgen - MAVSDK LogStreaming API + """ + + # Plugin name + name = "LogStreaming" + + def _setup_stub(self, channel): + """ Setups the api stub """ + self._stub = log_streaming_pb2_grpc.LogStreamingServiceStub(channel) + + + def _extract_result(self, response): + """ Returns the response status and description """ + return LogStreamingResult.translate_from_rpc(response.log_streaming_result) + + + async def start_log_streaming(self): + """ + Start streaming logging data. + + Raises + ------ + LogStreamingError + If the request fails. The error contains the reason for the failure. + """ + + request = log_streaming_pb2.StartLogStreamingRequest() + response = await self._stub.StartLogStreaming(request) + + + result = self._extract_result(response) + + if result.result != LogStreamingResult.Result.SUCCESS: + raise LogStreamingError(result, "start_log_streaming()") + + + async def stop_log_streaming(self): + """ + Stop streaming logging data. + + Raises + ------ + LogStreamingError + If the request fails. The error contains the reason for the failure. + """ + + request = log_streaming_pb2.StopLogStreamingRequest() + response = await self._stub.StopLogStreaming(request) + + + result = self._extract_result(response) + + if result.result != LogStreamingResult.Result.SUCCESS: + raise LogStreamingError(result, "stop_log_streaming()") + + + async def log_streaming_raw(self): + """ + Subscribe to logging messages + + Yields + ------- + logging_raw : LogStreamingRaw + A message containing logged data + + + """ + + request = log_streaming_pb2.SubscribeLogStreamingRawRequest() + log_streaming_raw_stream = self._stub.SubscribeLogStreamingRaw(request) + + try: + async for response in log_streaming_raw_stream: + + + + yield LogStreamingRaw.translate_from_rpc(response.logging_raw) + finally: + log_streaming_raw_stream.cancel() \ No newline at end of file diff --git a/mavsdk/log_streaming_pb2.py b/mavsdk/log_streaming_pb2.py new file mode 100644 index 00000000..4f35b41c --- /dev/null +++ b/mavsdk/log_streaming_pb2.py @@ -0,0 +1,114 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: log_streaming/log_streaming.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +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_pool.Default().AddSerializedFile(b'\n!log_streaming/log_streaming.proto\x12\x18mavsdk.rpc.log_streaming\x1a\x14mavsdk_options.proto\"\x1a\n\x18StartLogStreamingRequest\"g\n\x19StartLogStreamingResponse\x12J\n\x14log_streaming_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.log_streaming.LogStreamingResult\"\x19\n\x17StopLogStreamingRequest\"f\n\x18StopLogStreamingResponse\x12J\n\x14log_streaming_result\x18\x01 \x01(\x0b\x32,.mavsdk.rpc.log_streaming.LogStreamingResult\"!\n\x1fSubscribeLogStreamingRawRequest\"Y\n\x17LogStreamingRawResponse\x12>\n\x0blogging_raw\x18\x01 \x01(\x0b\x32).mavsdk.rpc.log_streaming.LogStreamingRaw\"\x1f\n\x0fLogStreamingRaw\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\t\"\xab\x02\n\x12LogStreamingResult\x12\x43\n\x06result\x18\x01 \x01(\x0e\x32\x33.mavsdk.rpc.log_streaming.LogStreamingResult.Result\x12\x12\n\nresult_str\x18\x02 \x01(\t\"\xbb\x01\n\x06Result\x12\x12\n\x0eRESULT_SUCCESS\x10\x00\x12\x14\n\x10RESULT_NO_SYSTEM\x10\x01\x12\x1b\n\x17RESULT_CONNECTION_ERROR\x10\x02\x12\x0f\n\x0bRESULT_BUSY\x10\x03\x12\x19\n\x15RESULT_COMMAND_DENIED\x10\x04\x12\x12\n\x0eRESULT_TIMEOUT\x10\x05\x12\x16\n\x12RESULT_UNSUPPORTED\x10\x06\x12\x12\n\x0eRESULT_UNKNOWN\x10\x07\x32\xa5\x03\n\x13LogStreamingService\x12~\n\x11StartLogStreaming\x12\x32.mavsdk.rpc.log_streaming.StartLogStreamingRequest\x1a\x33.mavsdk.rpc.log_streaming.StartLogStreamingResponse\"\x00\x12{\n\x10StopLogStreaming\x12\x31.mavsdk.rpc.log_streaming.StopLogStreamingRequest\x1a\x32.mavsdk.rpc.log_streaming.StopLogStreamingResponse\"\x00\x12\x90\x01\n\x18SubscribeLogStreamingRaw\x12\x39.mavsdk.rpc.log_streaming.SubscribeLogStreamingRawRequest\x1a\x31.mavsdk.rpc.log_streaming.LogStreamingRawResponse\"\x04\x80\xb5\x18\x00\x30\x01\x42,\n\x17io.mavsdk.log_streamingB\x11LogStreamingProtob\x06proto3') + + + +_STARTLOGSTREAMINGREQUEST = DESCRIPTOR.message_types_by_name['StartLogStreamingRequest'] +_STARTLOGSTREAMINGRESPONSE = DESCRIPTOR.message_types_by_name['StartLogStreamingResponse'] +_STOPLOGSTREAMINGREQUEST = DESCRIPTOR.message_types_by_name['StopLogStreamingRequest'] +_STOPLOGSTREAMINGRESPONSE = DESCRIPTOR.message_types_by_name['StopLogStreamingResponse'] +_SUBSCRIBELOGSTREAMINGRAWREQUEST = DESCRIPTOR.message_types_by_name['SubscribeLogStreamingRawRequest'] +_LOGSTREAMINGRAWRESPONSE = DESCRIPTOR.message_types_by_name['LogStreamingRawResponse'] +_LOGSTREAMINGRAW = DESCRIPTOR.message_types_by_name['LogStreamingRaw'] +_LOGSTREAMINGRESULT = DESCRIPTOR.message_types_by_name['LogStreamingResult'] +_LOGSTREAMINGRESULT_RESULT = _LOGSTREAMINGRESULT.enum_types_by_name['Result'] +StartLogStreamingRequest = _reflection.GeneratedProtocolMessageType('StartLogStreamingRequest', (_message.Message,), { + 'DESCRIPTOR' : _STARTLOGSTREAMINGREQUEST, + '__module__' : 'log_streaming.log_streaming_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.log_streaming.StartLogStreamingRequest) + }) +_sym_db.RegisterMessage(StartLogStreamingRequest) + +StartLogStreamingResponse = _reflection.GeneratedProtocolMessageType('StartLogStreamingResponse', (_message.Message,), { + 'DESCRIPTOR' : _STARTLOGSTREAMINGRESPONSE, + '__module__' : 'log_streaming.log_streaming_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.log_streaming.StartLogStreamingResponse) + }) +_sym_db.RegisterMessage(StartLogStreamingResponse) + +StopLogStreamingRequest = _reflection.GeneratedProtocolMessageType('StopLogStreamingRequest', (_message.Message,), { + 'DESCRIPTOR' : _STOPLOGSTREAMINGREQUEST, + '__module__' : 'log_streaming.log_streaming_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.log_streaming.StopLogStreamingRequest) + }) +_sym_db.RegisterMessage(StopLogStreamingRequest) + +StopLogStreamingResponse = _reflection.GeneratedProtocolMessageType('StopLogStreamingResponse', (_message.Message,), { + 'DESCRIPTOR' : _STOPLOGSTREAMINGRESPONSE, + '__module__' : 'log_streaming.log_streaming_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.log_streaming.StopLogStreamingResponse) + }) +_sym_db.RegisterMessage(StopLogStreamingResponse) + +SubscribeLogStreamingRawRequest = _reflection.GeneratedProtocolMessageType('SubscribeLogStreamingRawRequest', (_message.Message,), { + 'DESCRIPTOR' : _SUBSCRIBELOGSTREAMINGRAWREQUEST, + '__module__' : 'log_streaming.log_streaming_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.log_streaming.SubscribeLogStreamingRawRequest) + }) +_sym_db.RegisterMessage(SubscribeLogStreamingRawRequest) + +LogStreamingRawResponse = _reflection.GeneratedProtocolMessageType('LogStreamingRawResponse', (_message.Message,), { + 'DESCRIPTOR' : _LOGSTREAMINGRAWRESPONSE, + '__module__' : 'log_streaming.log_streaming_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.log_streaming.LogStreamingRawResponse) + }) +_sym_db.RegisterMessage(LogStreamingRawResponse) + +LogStreamingRaw = _reflection.GeneratedProtocolMessageType('LogStreamingRaw', (_message.Message,), { + 'DESCRIPTOR' : _LOGSTREAMINGRAW, + '__module__' : 'log_streaming.log_streaming_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.log_streaming.LogStreamingRaw) + }) +_sym_db.RegisterMessage(LogStreamingRaw) + +LogStreamingResult = _reflection.GeneratedProtocolMessageType('LogStreamingResult', (_message.Message,), { + 'DESCRIPTOR' : _LOGSTREAMINGRESULT, + '__module__' : 'log_streaming.log_streaming_pb2' + # @@protoc_insertion_point(class_scope:mavsdk.rpc.log_streaming.LogStreamingResult) + }) +_sym_db.RegisterMessage(LogStreamingResult) + +_LOGSTREAMINGSERVICE = DESCRIPTOR.services_by_name['LogStreamingService'] +if _descriptor._USE_C_DESCRIPTORS == False: + + DESCRIPTOR._options = None + DESCRIPTOR._serialized_options = b'\n\027io.mavsdk.log_streamingB\021LogStreamingProto' + _LOGSTREAMINGSERVICE.methods_by_name['SubscribeLogStreamingRaw']._options = None + _LOGSTREAMINGSERVICE.methods_by_name['SubscribeLogStreamingRaw']._serialized_options = b'\200\265\030\000' + _STARTLOGSTREAMINGREQUEST._serialized_start=85 + _STARTLOGSTREAMINGREQUEST._serialized_end=111 + _STARTLOGSTREAMINGRESPONSE._serialized_start=113 + _STARTLOGSTREAMINGRESPONSE._serialized_end=216 + _STOPLOGSTREAMINGREQUEST._serialized_start=218 + _STOPLOGSTREAMINGREQUEST._serialized_end=243 + _STOPLOGSTREAMINGRESPONSE._serialized_start=245 + _STOPLOGSTREAMINGRESPONSE._serialized_end=347 + _SUBSCRIBELOGSTREAMINGRAWREQUEST._serialized_start=349 + _SUBSCRIBELOGSTREAMINGRAWREQUEST._serialized_end=382 + _LOGSTREAMINGRAWRESPONSE._serialized_start=384 + _LOGSTREAMINGRAWRESPONSE._serialized_end=473 + _LOGSTREAMINGRAW._serialized_start=475 + _LOGSTREAMINGRAW._serialized_end=506 + _LOGSTREAMINGRESULT._serialized_start=509 + _LOGSTREAMINGRESULT._serialized_end=808 + _LOGSTREAMINGRESULT_RESULT._serialized_start=621 + _LOGSTREAMINGRESULT_RESULT._serialized_end=808 + _LOGSTREAMINGSERVICE._serialized_start=811 + _LOGSTREAMINGSERVICE._serialized_end=1232 +# @@protoc_insertion_point(module_scope) diff --git a/mavsdk/log_streaming_pb2_grpc.py b/mavsdk/log_streaming_pb2_grpc.py new file mode 100644 index 00000000..8f003096 --- /dev/null +++ b/mavsdk/log_streaming_pb2_grpc.py @@ -0,0 +1,138 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from . import log_streaming_pb2 as log__streaming_dot_log__streaming__pb2 + + +class LogStreamingServiceStub(object): + """Provide log streaming data. + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.StartLogStreaming = channel.unary_unary( + '/mavsdk.rpc.log_streaming.LogStreamingService/StartLogStreaming', + request_serializer=log__streaming_dot_log__streaming__pb2.StartLogStreamingRequest.SerializeToString, + response_deserializer=log__streaming_dot_log__streaming__pb2.StartLogStreamingResponse.FromString, + ) + self.StopLogStreaming = channel.unary_unary( + '/mavsdk.rpc.log_streaming.LogStreamingService/StopLogStreaming', + request_serializer=log__streaming_dot_log__streaming__pb2.StopLogStreamingRequest.SerializeToString, + response_deserializer=log__streaming_dot_log__streaming__pb2.StopLogStreamingResponse.FromString, + ) + self.SubscribeLogStreamingRaw = channel.unary_stream( + '/mavsdk.rpc.log_streaming.LogStreamingService/SubscribeLogStreamingRaw', + request_serializer=log__streaming_dot_log__streaming__pb2.SubscribeLogStreamingRawRequest.SerializeToString, + response_deserializer=log__streaming_dot_log__streaming__pb2.LogStreamingRawResponse.FromString, + ) + + +class LogStreamingServiceServicer(object): + """Provide log streaming data. + """ + + def StartLogStreaming(self, request, context): + """Start streaming logging data. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def StopLogStreaming(self, request, context): + """Stop streaming logging data. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def SubscribeLogStreamingRaw(self, request, context): + """Subscribe to logging messages + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_LogStreamingServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + 'StartLogStreaming': grpc.unary_unary_rpc_method_handler( + servicer.StartLogStreaming, + request_deserializer=log__streaming_dot_log__streaming__pb2.StartLogStreamingRequest.FromString, + response_serializer=log__streaming_dot_log__streaming__pb2.StartLogStreamingResponse.SerializeToString, + ), + 'StopLogStreaming': grpc.unary_unary_rpc_method_handler( + servicer.StopLogStreaming, + request_deserializer=log__streaming_dot_log__streaming__pb2.StopLogStreamingRequest.FromString, + response_serializer=log__streaming_dot_log__streaming__pb2.StopLogStreamingResponse.SerializeToString, + ), + 'SubscribeLogStreamingRaw': grpc.unary_stream_rpc_method_handler( + servicer.SubscribeLogStreamingRaw, + request_deserializer=log__streaming_dot_log__streaming__pb2.SubscribeLogStreamingRawRequest.FromString, + response_serializer=log__streaming_dot_log__streaming__pb2.LogStreamingRawResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'mavsdk.rpc.log_streaming.LogStreamingService', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class LogStreamingService(object): + """Provide log streaming data. + """ + + @staticmethod + def StartLogStreaming(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.log_streaming.LogStreamingService/StartLogStreaming', + log__streaming_dot_log__streaming__pb2.StartLogStreamingRequest.SerializeToString, + log__streaming_dot_log__streaming__pb2.StartLogStreamingResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def StopLogStreaming(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.log_streaming.LogStreamingService/StopLogStreaming', + log__streaming_dot_log__streaming__pb2.StopLogStreamingRequest.SerializeToString, + log__streaming_dot_log__streaming__pb2.StopLogStreamingResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def SubscribeLogStreamingRaw(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_stream(request, target, '/mavsdk.rpc.log_streaming.LogStreamingService/SubscribeLogStreamingRaw', + log__streaming_dot_log__streaming__pb2.SubscribeLogStreamingRawRequest.SerializeToString, + log__streaming_dot_log__streaming__pb2.LogStreamingRawResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/mavsdk/source/plugins/component_metadata.rst b/mavsdk/source/plugins/component_metadata.rst new file mode 100644 index 00000000..12fef09e --- /dev/null +++ b/mavsdk/source/plugins/component_metadata.rst @@ -0,0 +1,8 @@ +ComponentMetadata +==== + +.. automodule:: mavsdk.component_metadata + :members: + :undoc-members: + :show-inheritance: + :exclude-members: translate_from_rpc, translate_to_rpc \ No newline at end of file diff --git a/mavsdk/source/plugins/component_metadata_server.rst b/mavsdk/source/plugins/component_metadata_server.rst new file mode 100644 index 00000000..e2139ef1 --- /dev/null +++ b/mavsdk/source/plugins/component_metadata_server.rst @@ -0,0 +1,8 @@ +ComponentMetadataServer +==== + +.. automodule:: mavsdk.component_metadata_server + :members: + :undoc-members: + :show-inheritance: + :exclude-members: translate_from_rpc, translate_to_rpc \ No newline at end of file diff --git a/mavsdk/source/plugins/index.rst b/mavsdk/source/plugins/index.rst index e2b3bbe4..86e3bd36 100644 --- a/mavsdk/source/plugins/index.rst +++ b/mavsdk/source/plugins/index.rst @@ -39,3 +39,6 @@ Plugins gripper winch arm_authorizer_server + component_metadata + component_metadata_server + log_streaming diff --git a/mavsdk/source/plugins/log_streaming.rst b/mavsdk/source/plugins/log_streaming.rst new file mode 100644 index 00000000..a76b927c --- /dev/null +++ b/mavsdk/source/plugins/log_streaming.rst @@ -0,0 +1,8 @@ +LogStreaming +==== + +.. automodule:: mavsdk.log_streaming + :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 debaacd1..34bce6d6 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit debaacd17271803520a264120165d19bf6d24c37 +Subproject commit 34bce6d61dba5f72b602bdbd31f04fceff093881