diff --git a/protos/component_information/component_information.proto b/protos/component_information/component_information.proto deleted file mode 100644 index db7581460..000000000 --- a/protos/component_information/component_information.proto +++ /dev/null @@ -1,65 +0,0 @@ -syntax = "proto3"; - -package mavsdk.rpc.component_information; - -import "mavsdk_options.proto"; - -option java_package = "io.mavsdk.component_information"; -option java_outer_classname = "ComponentInformationProto"; - -// Access component information such as parameters. -service ComponentInformationService { - /* - * List available float params. - */ - rpc AccessFloatParams(AccessFloatParamsRequest) returns(AccessFloatParamsResponse) { option (mavsdk.options.async_type) = SYNC; } - /* - * Subscribe to float param changes/updates. - */ - rpc SubscribeFloatParam(SubscribeFloatParamRequest) returns(stream FloatParamResponse) { option (mavsdk.options.async_type) = ASYNC; } -} - -// Meta information for parameter of type float. -message FloatParam { - string name = 1; // Name (max 16 chars) - string short_description = 2; // Short description - string long_description = 3; // Long description - string unit = 4; // Unit - int32 decimal_places = 5; // Decimal places for user to show - float start_value = 6; // Current/starting value - float default_value = 7; // Default value - float min_value = 8; // Minimum value - float max_value = 9; // Maximum value -} - -message AccessFloatParamsRequest {} - -message AccessFloatParamsResponse { - ComponentInformationResult component_information_result = 1; - repeated FloatParam params = 2; // Float param definitions -} - -// A float param that has been updated. -message FloatParamUpdate { - string name = 1; // Name of param that changed - float value = 2; // New value of param -} - -message SubscribeFloatParamRequest {} - -message FloatParamResponse { - FloatParamUpdate param_update = 1; // A param update -} - -// Result type. -message ComponentInformationResult { - // Possible results returned for param requests. - enum Result { - RESULT_UNKNOWN = 0; // Unknown result - RESULT_SUCCESS = 1; // Request succeeded - RESULT_NO_SYSTEM = 3; // No system is connected - } - - Result result = 1; // Result enum value - string result_str = 2; // Human-readable English string describing the result -} diff --git a/protos/component_information_server/component_information_server.proto b/protos/component_information_server/component_information_server.proto deleted file mode 100644 index 37a912059..000000000 --- a/protos/component_information_server/component_information_server.proto +++ /dev/null @@ -1,71 +0,0 @@ -syntax = "proto3"; - -package mavsdk.rpc.component_information_server; - -import "mavsdk_options.proto"; - -option java_package = "io.mavsdk.component_information_server"; -option java_outer_classname = "ComponentInformationServerProto"; - -// Provide component information such as parameters. -service ComponentInformationServerService { - /* - * Provide a param of type float. - */ - rpc ProvideFloatParam(ProvideFloatParamRequest) returns(ProvideFloatParamResponse) { option (mavsdk.options.async_type) = SYNC; } - - /* - * Subscribe to float param updates. - */ - rpc SubscribeFloatParam(SubscribeFloatParamRequest) returns(stream FloatParamResponse) { option (mavsdk.options.async_type) = ASYNC; } -} - -// Meta information for parameter of type float. -message FloatParam { - string name = 1; // Name (max 16 chars) - string short_description = 2; // Short description - string long_description = 3; // Long description - string unit = 4; // Unit - int32 decimal_places = 5; // Decimal places for user to show - float start_value = 6; // Current/starting value - float default_value = 7; // Default value - float min_value = 8; // Minimum value - float max_value = 9; // Maximum value -} - -message ProvideFloatParamRequest { - FloatParam param = 1; // Float param definition -} - -message ProvideFloatParamResponse { - ComponentInformationServerResult component_information_server_result = 1; -} - -// A float param that has been updated. -message FloatParamUpdate { - string name = 1; // Name of param that changed - float value = 2; // New value of param -} - -message SubscribeFloatParamRequest {} - -message FloatParamResponse { - FloatParamUpdate param_update = 1; // A param update -} - -// Result type. -message ComponentInformationServerResult { - // Possible results returned for param requests. - enum Result { - RESULT_UNKNOWN = 0; // Unknown result - RESULT_SUCCESS = 1; // Request succeeded - RESULT_DUPLICATE_PARAM = 2; // Duplicate param - RESULT_INVALID_PARAM_START_VALUE = 3; // Invalid start param value - RESULT_INVALID_PARAM_DEFAULT_VALUE = 4; // Invalid default param value - RESULT_INVALID_PARAM_NAME = 5; // Invalid param name - RESULT_NO_SYSTEM = 6; // No system is connected - } - - Result result = 1; // Result enum value - string result_str = 2; // Human-readable English string describing the result -} diff --git a/protos/component_metadata/component_metadata.proto b/protos/component_metadata/component_metadata.proto new file mode 100644 index 000000000..948b93010 --- /dev/null +++ b/protos/component_metadata/component_metadata.proto @@ -0,0 +1,75 @@ +syntax = "proto3"; + +package mavsdk.rpc.component_metadata; + +import "mavsdk_options.proto"; + +option java_package = "io.mavsdk.component_metadata"; +option java_outer_classname = "ComponentMetadataProto"; + +// Access component metadata json definitions, such as parameters. +service ComponentMetadataService { + + /* + * Request metadata from a specific component + */ + rpc RequestComponent(RequestComponentRequest) returns(EmptyResponse) { option (mavsdk.options.async_type) = SYNC; } + + /* + * Request metadata from the autopilot component + */ + rpc RequestAutopilotComponent(EmptyRequest) returns(EmptyResponse) { option (mavsdk.options.async_type) = SYNC; } + + /* + * Register a callback that gets called when metadata is available + */ + rpc SubscribeMetadataAvailable(MetadataAvailableRequest) returns(stream MetadataUpdateResponse) { option (mavsdk.options.async_type) = ASYNC; } + + /* + * Request metadata from the autopilot component + */ + rpc GetMetadata(GetMetadataRequest) returns(GetMetadataResponse) { option (mavsdk.options.async_type) = SYNC; } +} + +message RequestComponentRequest { + uint32 compid = 1; // The component ID to request +} + +message GetMetadataRequest { + uint32 compid = 1; // The component ID to request + MetadataType type = 2; // The metadata type +} + +message GetMetadataResponse { + MetadataData response = 1; +} + +// Metadata response +message MetadataData { + bool success = 1; // true if the metadata is available + string json_metadata = 2; // The JSON metadata +} + +message EmptyRequest {} + +message EmptyResponse {} + +message MetadataAvailableRequest {} + + +message MetadataUpdateResponse { + MetadataUpdate data = 1; +} + +// Metadata for a given component and type +message MetadataUpdate { + uint32 compid = 1; // The component ID + MetadataType type = 2; // The metadata type + string json_metadata = 3; // The JSON metadata +} + +enum MetadataType { + PARAMETER = 0; // Parameter metadata + Events = 1; // Event definitions + Actuators = 2; // Actuator definitions +} diff --git a/protos/component_metadata_server/component_metadata_server.proto b/protos/component_metadata_server/component_metadata_server.proto new file mode 100644 index 000000000..2ed99d5fa --- /dev/null +++ b/protos/component_metadata_server/component_metadata_server.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; + +package mavsdk.rpc.component_metadata_server; + +import "mavsdk_options.proto"; + +option java_package = "io.mavsdk.component_metadata_server"; +option java_outer_classname = "ComponentMetadataServerProto"; + +// Provide component metadata json definitions, such as parameters. +service ComponentMetadataServerService { + /* + * Provide metadata (can only be called once) + */ + rpc SetMetadata(RequestComponentRequest) returns(EmptyResponse) { option (mavsdk.options.async_type) = SYNC; } +} + +message RequestComponentRequest { + repeated Metadata metadata = 1; // List of metadata +} +message EmptyResponse {} + +message Metadata { + MetadataType type = 1; // The metadata type + string json_metadata = 2; // The JSON metadata +} + +enum MetadataType { + PARAMETER = 0; // Parameter metadata + Events = 1; // Event definitions + Actuators = 2; // Actuator definitions +}