From b29933a4a01a5b4a75ac3acf6bb6f9eb33697e58 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 30 Jun 2023 07:51:51 -0500 Subject: [PATCH 1/4] Move proxy message and just convert to bytes instead --- meshtastic/mesh.options | 5 ++++- meshtastic/mesh.proto | 19 +++++++++++++++++++ meshtastic/mqtt.options | 4 +--- meshtastic/mqtt.proto | 14 -------------- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/meshtastic/mesh.options b/meshtastic/mesh.options index 35e4dc6..c384185 100644 --- a/meshtastic/mesh.options +++ b/meshtastic/mesh.options @@ -53,4 +53,7 @@ *NeighborInfo.neighbors max_count:10 -*DeviceMetadata.firmware_version max_size:18 \ No newline at end of file +*DeviceMetadata.firmware_version max_size:18 + +*MqttClientProxyMessage.topic type:FT_POINTER +*MqttClientProxyMessage.data max_size:500 \ No newline at end of file diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index 8c50965..eb55795 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -674,6 +674,20 @@ message Waypoint { fixed32 icon = 8; } +/* + * This message will be proxied over the PhoneAPI for client to deliver to the MQTT server + */ + message MqttClientProxyMessage { + /* + * The MQTT topic this message will be sent /received on + */ + string topic = 1; + /* + * The actual service envelope payload for mqtt delivery + */ + bytes data = 2; +} + /* * A packet envelope sent/received over the mesh * only payload_variant is sent in the payload portion of the LORA packet. @@ -1320,6 +1334,11 @@ message FromRadio { * Device metadata message */ DeviceMetadata metadata = 13; + + /* + * MQTT Client Proxy Message + */ + MqttClientProxyMessage mqttClientProxyMessage = 14; } } diff --git a/meshtastic/mqtt.options b/meshtastic/mqtt.options index f37fb9a..261a74b 100644 --- a/meshtastic/mqtt.options +++ b/meshtastic/mqtt.options @@ -1,5 +1,3 @@ *ServiceEnvelope.packet type:FT_POINTER *ServiceEnvelope.channel_id type:FT_POINTER -*ServiceEnvelope.gateway_id type:FT_POINTER - -*MqttClientProxyMessage.topic type:FT_POINTER \ No newline at end of file +*ServiceEnvelope.gateway_id type:FT_POINTER \ No newline at end of file diff --git a/meshtastic/mqtt.proto b/meshtastic/mqtt.proto index e8e8451..7631435 100644 --- a/meshtastic/mqtt.proto +++ b/meshtastic/mqtt.proto @@ -30,18 +30,4 @@ message ServiceEnvelope { * the globally trusted nodenum */ string gateway_id = 3; -} - -/* - * This message will be proxied over the PhoneAPI for client to deliver to the MQTT server - */ -message MqttClientProxyMessage { - /* - * The MQTT topic this message will be sent /received on - */ - string topic = 1; - /* - * The actual payload for mqtt delivery - */ - ServiceEnvelope envelope = 2; } \ No newline at end of file From 74f3c56c9b59149d7bbbdd053e062aa95a4f0fe4 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 1 Jul 2023 08:53:13 -0500 Subject: [PATCH 2/4] Config and payload variant --- meshtastic/mesh.options | 5 +++-- meshtastic/mesh.proto | 18 +++++++++++++++++- meshtastic/module_config.proto | 5 +++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/meshtastic/mesh.options b/meshtastic/mesh.options index c384185..ad8bd71 100644 --- a/meshtastic/mesh.options +++ b/meshtastic/mesh.options @@ -55,5 +55,6 @@ *DeviceMetadata.firmware_version max_size:18 -*MqttClientProxyMessage.topic type:FT_POINTER -*MqttClientProxyMessage.data max_size:500 \ No newline at end of file +*MqttClientProxyMessage.topic max_size:60 +*MqttClientProxyMessage.data max_size:435 +*MqttClientProxyMessage.text max_size:435 \ No newline at end of file diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index eb55795..8055028 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -682,10 +682,26 @@ message Waypoint { * The MQTT topic this message will be sent /received on */ string topic = 1; + /* * The actual service envelope payload for mqtt delivery */ - bytes data = 2; + oneof payload_variant { + /* + * Bytes + */ + bytes data = 2; + + /* + * Text + */ + string text = 3; + } + + /* + * Whether the message should be retained (or not) + */ + bool retained = 4; } /* diff --git a/meshtastic/module_config.proto b/meshtastic/module_config.proto index 5008afb..3f429d9 100644 --- a/meshtastic/module_config.proto +++ b/meshtastic/module_config.proto @@ -65,6 +65,11 @@ message ModuleConfig { * This is useful if you want to use a single MQTT server for multiple meshtastic networks and separate them via ACLs */ string root = 8; + + /* + * If true, we can use the connected phone / client to proxy messages to MQTT instead of a direct connection + */ + bool proxy_to_client_enabled = 9; } /* From c8b90c700607ddbab0d99322635f6a73abb64259 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 2 Jul 2023 14:56:32 -0500 Subject: [PATCH 3/4] Add toradio --- meshtastic/mesh.proto | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index 8055028..a063bf9 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -1396,6 +1396,11 @@ message ToRadio { */ XModem xmodemPacket = 5; + + /* + * MQTT Client Proxy Message + */ + MqttClientProxyMessage mqttClientProxyMessage = 6; } } From 223b53e6cf427f5a868b4a0e69078e873e4d3e60 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 3 Jul 2023 07:42:56 -0500 Subject: [PATCH 4/4] Update mesh.proto --- meshtastic/mesh.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index a063bf9..2b92a66 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -675,7 +675,7 @@ message Waypoint { } /* - * This message will be proxied over the PhoneAPI for client to deliver to the MQTT server + * This message will be proxied over the PhoneAPI for the client to deliver to the MQTT server */ message MqttClientProxyMessage { /* @@ -684,7 +684,7 @@ message Waypoint { string topic = 1; /* - * The actual service envelope payload for mqtt delivery + * The actual service envelope payload or text for mqtt pub / sub */ oneof payload_variant { /* @@ -1505,4 +1505,4 @@ message DeviceMetadata { * Has Remote Hardware enabled */ bool hasRemoteHardware = 10; -} \ No newline at end of file +}