diff --git a/meshtastic/mesh.options b/meshtastic/mesh.options index 35e4dc6..ad8bd71 100644 --- a/meshtastic/mesh.options +++ b/meshtastic/mesh.options @@ -53,4 +53,8 @@ *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 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 8c50965..2b92a66 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -674,6 +674,36 @@ message Waypoint { fixed32 icon = 8; } +/* + * This message will be proxied over the PhoneAPI for the 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 or text for mqtt pub / sub + */ + oneof payload_variant { + /* + * Bytes + */ + bytes data = 2; + + /* + * Text + */ + string text = 3; + } + + /* + * Whether the message should be retained (or not) + */ + bool retained = 4; +} + /* * A packet envelope sent/received over the mesh * only payload_variant is sent in the payload portion of the LORA packet. @@ -1320,6 +1350,11 @@ message FromRadio { * Device metadata message */ DeviceMetadata metadata = 13; + + /* + * MQTT Client Proxy Message + */ + MqttClientProxyMessage mqttClientProxyMessage = 14; } } @@ -1361,6 +1396,11 @@ message ToRadio { */ XModem xmodemPacket = 5; + + /* + * MQTT Client Proxy Message + */ + MqttClientProxyMessage mqttClientProxyMessage = 6; } } @@ -1465,4 +1505,4 @@ message DeviceMetadata { * Has Remote Hardware enabled */ bool hasRemoteHardware = 10; -} \ No newline at end of file +} diff --git a/meshtastic/module_config.proto b/meshtastic/module_config.proto index e60820f..75fb96f 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; } /* 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