From 151b6f7aa3ffb72669ea98da17d601601f3660a3 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Tue, 2 Apr 2024 09:04:20 +1300 Subject: [PATCH 1/5] Add log_streaming Signed-off-by: Julian Oes --- protos/log_streaming/log_streaming.proto | 54 ++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 protos/log_streaming/log_streaming.proto diff --git a/protos/log_streaming/log_streaming.proto b/protos/log_streaming/log_streaming.proto new file mode 100644 index 00000000..f9530013 --- /dev/null +++ b/protos/log_streaming/log_streaming.proto @@ -0,0 +1,54 @@ +syntax = "proto3"; + +package mavsdk.rpc.log_streaming; + +option java_package = "io.mavsdk.log_streaming"; +option java_outer_classname = "LogStreamingProto"; + +// Provide log streaming data. +service LogStreamingService { + // Start streaming logging data. + rpc StartLogStreaming(StartLogStreamingRequest) returns(StartLogStreamingResponse) {} + // Stop streaming logging data. + rpc StopLogStreaming(StopLogStreamingRequest) returns(StopLogStreamingResponse) {} + // Subscribe to logging messages + rpc SubscribeLogStreamingRaw(SubscribeLogStreamingRawRequest) returns(stream LogStreamingRawResponse) {} +} + +message StartLogStreamingRequest {} +message StartLogStreamingResponse { + LogStreamingResult log_streaming_result = 1; +} + +message StopLogStreamingRequest {} +message StopLogStreamingResponse { + LogStreamingResult log_streaming_result = 1; +} + +message SubscribeLogStreamingRawRequest {} +message LogStreamingRawResponse { + LogStreamingRaw logging_raw = 1; // A message containing logged data +} + +// Raw logging data type +message LogStreamingRaw { + uint32 first_message_offset = 1; // Offset into data where first message starts + bytes data = 2; // Logged data +} + +// Result type. +message LogStreamingResult { + // Possible results returned for logging requests + enum Result { + RESULT_SUCCESS = 0; // Request succeeded + RESULT_NO_SYSTEM = 1; // No system connected + RESULT_CONNECTION_ERROR = 2; // Connection error + RESULT_BUSY = 3; // System busy + RESULT_COMMAND_DENIED = 4; // Command denied + RESULT_TIMEOUT = 5; // Timeout + RESULT_UNKNOWN = 6; // Unknown error + } + + Result result = 1; // Result enum value + string result_str = 2; // Human-readable English string describing the result +} From c136fd4f8e18c34a5e5eb86361d4a48cc0855c0d Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 17 Apr 2024 20:43:24 +1200 Subject: [PATCH 2/5] log_streaming: use base64 Because bytes doesn't compile. Signed-off-by: Julian Oes --- protos/log_streaming/log_streaming.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protos/log_streaming/log_streaming.proto b/protos/log_streaming/log_streaming.proto index f9530013..0d44e6d1 100644 --- a/protos/log_streaming/log_streaming.proto +++ b/protos/log_streaming/log_streaming.proto @@ -33,7 +33,7 @@ message LogStreamingRawResponse { // Raw logging data type message LogStreamingRaw { uint32 first_message_offset = 1; // Offset into data where first message starts - bytes data = 2; // Logged data + string data = 2; // Logged data as base64 } // Result type. From 900bad7f1f4620008dac53da6f4eecdd5939d0fb Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 17 Apr 2024 20:43:55 +1200 Subject: [PATCH 3/5] log_streaming: don't forget unsupported Signed-off-by: Julian Oes --- protos/log_streaming/log_streaming.proto | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/protos/log_streaming/log_streaming.proto b/protos/log_streaming/log_streaming.proto index 0d44e6d1..444306ea 100644 --- a/protos/log_streaming/log_streaming.proto +++ b/protos/log_streaming/log_streaming.proto @@ -46,7 +46,8 @@ message LogStreamingResult { RESULT_BUSY = 3; // System busy RESULT_COMMAND_DENIED = 4; // Command denied RESULT_TIMEOUT = 5; // Timeout - RESULT_UNKNOWN = 6; // Unknown error + RESULT_UNSUPPORTED = 6; // Unsupported + RESULT_UNKNOWN = 7; // Unknown error } Result result = 1; // Result enum value From 8f4cbd682ae47b3ae4a5406dac1b27c05801203b Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Mon, 22 Apr 2024 14:55:20 +1200 Subject: [PATCH 4/5] log_streaming: sync method doesn't make sense Signed-off-by: Julian Oes --- protos/log_streaming/log_streaming.proto | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/protos/log_streaming/log_streaming.proto b/protos/log_streaming/log_streaming.proto index 444306ea..6877e46a 100644 --- a/protos/log_streaming/log_streaming.proto +++ b/protos/log_streaming/log_streaming.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package mavsdk.rpc.log_streaming; +import "mavsdk_options.proto"; + option java_package = "io.mavsdk.log_streaming"; option java_outer_classname = "LogStreamingProto"; @@ -12,7 +14,7 @@ service LogStreamingService { // Stop streaming logging data. rpc StopLogStreaming(StopLogStreamingRequest) returns(StopLogStreamingResponse) {} // Subscribe to logging messages - rpc SubscribeLogStreamingRaw(SubscribeLogStreamingRawRequest) returns(stream LogStreamingRawResponse) {} + rpc SubscribeLogStreamingRaw(SubscribeLogStreamingRawRequest) returns(stream LogStreamingRawResponse) { option (mavsdk.options.async_type) = ASYNC; } } message StartLogStreamingRequest {} From 414456516c1bf7ed8af27d2d3a7e817c57654c94 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Mon, 22 Apr 2024 14:55:41 +1200 Subject: [PATCH 5/5] log_streaming: don't expose protocol internals Signed-off-by: Julian Oes --- protos/log_streaming/log_streaming.proto | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/protos/log_streaming/log_streaming.proto b/protos/log_streaming/log_streaming.proto index 6877e46a..350e081d 100644 --- a/protos/log_streaming/log_streaming.proto +++ b/protos/log_streaming/log_streaming.proto @@ -34,8 +34,7 @@ message LogStreamingRawResponse { // Raw logging data type message LogStreamingRaw { - uint32 first_message_offset = 1; // Offset into data where first message starts - string data = 2; // Logged data as base64 + string data = 1; // Ulog file stream data encoded as base64 } // Result type.