From 514c19a68e8427d1be7cb713e4935d6b929053bc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 10 Feb 2024 14:16:46 -0600 Subject: [PATCH 1/2] [create-pull-request] automated change (#3198) Co-authored-by: thebentern --- protobufs | 2 +- src/mesh/generated/meshtastic/atak.pb.c | 2 +- src/mesh/generated/meshtastic/atak.pb.h | 15 ++++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/protobufs b/protobufs index 99bd42baf..1fa72525a 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 99bd42baf8dd2e8ca0eec70f05e1cf7f1a40a283 +Subproject commit 1fa72525a13117908a850d6754b5368eabdee163 diff --git a/src/mesh/generated/meshtastic/atak.pb.c b/src/mesh/generated/meshtastic/atak.pb.c index b0554c48c..1413b748e 100644 --- a/src/mesh/generated/meshtastic/atak.pb.c +++ b/src/mesh/generated/meshtastic/atak.pb.c @@ -9,7 +9,7 @@ PB_BIND(meshtastic_TAKPacket, meshtastic_TAKPacket, 2) -PB_BIND(meshtastic_GeoChat, meshtastic_GeoChat, AUTO) +PB_BIND(meshtastic_GeoChat, meshtastic_GeoChat, 2) PB_BIND(meshtastic_Group, meshtastic_Group, AUTO) diff --git a/src/mesh/generated/meshtastic/atak.pb.h b/src/mesh/generated/meshtastic/atak.pb.h index 0ac6cb49f..71c3c387f 100644 --- a/src/mesh/generated/meshtastic/atak.pb.h +++ b/src/mesh/generated/meshtastic/atak.pb.h @@ -71,7 +71,8 @@ typedef struct _meshtastic_GeoChat { /* The text message */ char message[200]; /* Uid recipient of the message */ - pb_callback_t to; + bool has_to; + char to[120]; } meshtastic_GeoChat; /* ATAK Group @@ -163,13 +164,13 @@ extern "C" { /* Initializer values for message structs */ #define meshtastic_TAKPacket_init_default {0, false, meshtastic_Contact_init_default, false, meshtastic_Group_init_default, false, meshtastic_Status_init_default, 0, {meshtastic_PLI_init_default}} -#define meshtastic_GeoChat_init_default {"", {{NULL}, NULL}} +#define meshtastic_GeoChat_init_default {"", false, ""} #define meshtastic_Group_init_default {_meshtastic_MemberRole_MIN, _meshtastic_Team_MIN} #define meshtastic_Status_init_default {0} #define meshtastic_Contact_init_default {"", ""} #define meshtastic_PLI_init_default {0, 0, 0, 0, 0} #define meshtastic_TAKPacket_init_zero {0, false, meshtastic_Contact_init_zero, false, meshtastic_Group_init_zero, false, meshtastic_Status_init_zero, 0, {meshtastic_PLI_init_zero}} -#define meshtastic_GeoChat_init_zero {"", {{NULL}, NULL}} +#define meshtastic_GeoChat_init_zero {"", false, ""} #define meshtastic_Group_init_zero {_meshtastic_MemberRole_MIN, _meshtastic_Team_MIN} #define meshtastic_Status_init_zero {0} #define meshtastic_Contact_init_zero {"", ""} @@ -213,8 +214,8 @@ X(a, STATIC, ONEOF, MESSAGE, (payload_variant,chat,payload_variant.chat), #define meshtastic_GeoChat_FIELDLIST(X, a) \ X(a, STATIC, SINGULAR, STRING, message, 1) \ -X(a, CALLBACK, OPTIONAL, STRING, to, 2) -#define meshtastic_GeoChat_CALLBACK pb_default_field_callback +X(a, STATIC, OPTIONAL, STRING, to, 2) +#define meshtastic_GeoChat_CALLBACK NULL #define meshtastic_GeoChat_DEFAULT NULL #define meshtastic_Group_FIELDLIST(X, a) \ @@ -259,12 +260,12 @@ extern const pb_msgdesc_t meshtastic_PLI_msg; #define meshtastic_PLI_fields &meshtastic_PLI_msg /* Maximum encoded size of messages (where known) */ -/* meshtastic_TAKPacket_size depends on runtime parameters */ -/* meshtastic_GeoChat_size depends on runtime parameters */ #define meshtastic_Contact_size 242 +#define meshtastic_GeoChat_size 323 #define meshtastic_Group_size 4 #define meshtastic_PLI_size 26 #define meshtastic_Status_size 3 +#define meshtastic_TAKPacket_size 584 #ifdef __cplusplus } /* extern "C" */ From 404d0dda79543f39074abe0271afbe568dda83b3 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 10 Feb 2024 14:20:04 -0600 Subject: [PATCH 2/2] Fix - Add GeoChat To field to payloads and handle compression (#3199) * WIP ATAK plugin message handling * Log * Update size and regen * Rework protos and remove compression * Track * Altitude * Protos * Protos and formatting * Add to column * Fixes / updates * Doh! * S * Refactoring and compression fixes * Fix missing (to) from ATAK geochat * Trunk * Explicitly set has_to * Fmt * Protobufs --- protobufs | 2 +- src/modules/AtakPluginModule.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/protobufs b/protobufs index 1fa72525a..99bd42baf 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 1fa72525a13117908a850d6754b5368eabdee163 +Subproject commit 99bd42baf8dd2e8ca0eec70f05e1cf7f1a40a283 diff --git a/src/modules/AtakPluginModule.cpp b/src/modules/AtakPluginModule.cpp index 86e143811..ffc4fe68a 100644 --- a/src/modules/AtakPluginModule.cpp +++ b/src/modules/AtakPluginModule.cpp @@ -84,6 +84,15 @@ void AtakPluginModule::alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtast LOG_DEBUG("Uncompressed chat message '%s' - %d bytes\n", t->payload_variant.chat.message, strlen(t->payload_variant.chat.message)); LOG_DEBUG("Compressed chat message '%s' - %d bytes\n", compressed.payload_variant.chat.message, length); + + if (t->payload_variant.chat.has_to) { + compressed.payload_variant.chat.has_to = true; + length = unishox2_compress_simple(t->payload_variant.chat.to, strlen(t->payload_variant.chat.to), + compressed.payload_variant.chat.to); + LOG_DEBUG("Uncompressed chat to '%s' - %d bytes\n", t->payload_variant.chat.to, + strlen(t->payload_variant.chat.to)); + LOG_DEBUG("Compressed chat to '%s' - %d bytes\n", compressed.payload_variant.chat.to, length); + } } mp.decoded.payload.size = pb_encode_to_bytes(mp.decoded.payload.bytes, sizeof(mp.decoded.payload.bytes), meshtastic_TAKPacket_fields, &compressed); @@ -117,6 +126,14 @@ void AtakPluginModule::alterReceivedProtobuf(meshtastic_MeshPacket &mp, meshtast uncompressed.payload_variant.chat.message); LOG_DEBUG("Compressed chat message: %d bytes\n", strlen(t->payload_variant.chat.message)); LOG_DEBUG("Decompressed chat message: '%s' @ %d bytes\n", uncompressed.payload_variant.chat.message, length); + + if (t->payload_variant.chat.has_to) { + uncompressed.payload_variant.chat.has_to = true; + length = unishox2_decompress_simple(t->payload_variant.chat.to, strlen(t->payload_variant.chat.to), + uncompressed.payload_variant.chat.to); + LOG_DEBUG("Compressed chat to: %d bytes\n", strlen(t->payload_variant.chat.to)); + LOG_DEBUG("Decompressed chat to: '%s' @ %d bytes\n", uncompressed.payload_variant.chat.to, length); + } } decompressedCopy->decoded.payload.size = pb_encode_to_bytes(decompressedCopy->decoded.payload.bytes, sizeof(decompressedCopy->decoded.payload),