diff --git a/bin/mqtt-listen.sh b/bin/mqtt-listen.sh index 112d42bdb..73ccb50a3 100755 --- a/bin/mqtt-listen.sh +++ b/bin/mqtt-listen.sh @@ -1,3 +1,3 @@ -mosquitto_sub -h test.mosquitto.org -v -t mesh/stat/\# -t mesh/json/\# +mosquitto_sub -h mqtt.meshtastic.org -v -t \$SYS/\# -t msh/+/stat/\# -t msh/+/json/\# # mosquitto_sub -h test.mosquitto.org -v -t mesh/\# -F "%j" diff --git a/bin/mqtt-send-status.sh b/bin/mqtt-send-status.sh index d14560233..4df8a895e 100755 --- a/bin/mqtt-send-status.sh +++ b/bin/mqtt-send-status.sh @@ -1 +1 @@ -mosquitto_pub -h test.mosquitto.org -t mesh/stat/FakeNode -m online -d +mosquitto_pub -h mqtt.meshtastic.org -u meshdev -P large4cats -t msh/1/stat/FakeNode -m online -d diff --git a/docs/software/TODO.md b/docs/software/TODO.md index d6abab0b6..01ae40a4c 100644 --- a/docs/software/TODO.md +++ b/docs/software/TODO.md @@ -4,9 +4,6 @@ You probably don't care about this section - skip to the next one. ## before next release -* DONE android speed settings https://github.com/meshtastic/Meshtastic-Android/issues/271 -* fix heltec battery scaling - * DONE remote admin busted? * DONE check android code - @havealoha comments about odd sleep behavior * ABANDONED test github actions locally on linux diff --git a/docs/software/mqtt.md b/docs/software/mqtt.md index 80daf06ab..62d8d66dd 100644 --- a/docs/software/mqtt.md +++ b/docs/software/mqtt.md @@ -72,15 +72,17 @@ Any gateway-device will contact the MQTT broker. ### Topics -* The "/mesh/crypt/CHANNELID/NODEID" [topic](https://www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices/) will be used for (encrypted) messages sent from/to a mesh. +* The "/msh/1/c/CHANNELID/NODEID" [topic](https://www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices/) will be used for (encrypted) messages sent from/to a mesh. (The "1" in this path is for protocol version 1, other values are reserved. "c" is for "enCrypted") Gateway nodes will foward any MeshPacket from a local mesh channel with uplink_enabled. The packet (encapsulated in a ServiceEnvelope) will remain encrypted with the key for the specified channel. -For any channels in the gateway node with downlink_enabled, the gateway node will forward packets from MQTT to the local mesh. It will do this by subscribing to mesh/crypt/CHANNELID/# and forwarding relevant packets. +For any channels in the gateway node with downlink_enabled, the gateway node will forward packets from MQTT to the local mesh. It will do this by subscribing to msh/1/c/CHANNELID/# and forwarding relevant packets. -* If the channelid 'well known'/public it could be decrypted by a web service (if the web service was provided with the associated channel key), in which case it will be decrypted by a web service and appear at "mesh/clear/CHANNELID/NODEID/PORTID". +* If the channelid 'well known'/public it could be decrypted by a web service (if the web service was provided with the associated channel key), in which case it will be decrypted by a web service and appear at "msh/1/CLEAR/CHANNELID/NODEID/PORTID". -* If it was possible to republish on mesh/clear/... and the PORTID is wellknown (i.e. the protobufs needed for decoding it are in the master github), it will be decoded and republished as JSON on mesh/json/CHANNELID/NODEID/PortName. This is to facilitate the development of third party apps to visualize 'live' node positions and 'texts' (for users that have opted to send on those explicitly public channels). +* If it was possible to republish on msh/1/CLEAR/... and the PORTID is wellknown (i.e. the protobufs needed for decoding it are in the master github), it will be decoded and republished as JSON on msh/1/JSON/CHANNELID/NODEID/PortName. This is to facilitate the development of third party apps to visualize 'live' node positions and 'texts' (for users that have opted to send on those explicitly public channels). + +Note: Normally "CLEAR" is simply "clear" (for cleartext), but during development we might run **multiple** testing services, and in that case those service might appear using a different string here (i.e. "cleardev" etc...). Similarly normally "JSON" is "json", but other values might be used. FIXME, consider how text message global mirroring could scale (or not) FIXME, possibly don't global mirror text messages - instead rely on matrix/riot? diff --git a/docs/software/rak-wizblock.md b/docs/software/rak-wizblock.md new file mode 100644 index 000000000..b0c79702c --- /dev/null +++ b/docs/software/rak-wizblock.md @@ -0,0 +1,19 @@ +# RAK Wireless RisBlock + +https://docs.rakwireless.com/Product-Categories/WisBlock/Quickstart/#wisblock-base-2 + +GPS module: +Supposedly "Install in slot A only" but I think installing on the back would fit better with the OLED. FIXME. +https://docs.rakwireless.com/Product-Categories/WisBlock/RAK1910/Overview/#product-description + +ST KPS22HB +baro sensor +https://docs.rakwireless.com/Product-Categories/WisBlock/RAK1902/Overview/#product-description + +OLED +https://docs.rakwireless.com/Product-Categories/WisBlock/RAK1921/Overview/#product-features +Must be installed on the front for the I2C wires to lineup + +Solar enclosure +https://docs.rakwireless.com/Product-Categories/Accessories/RAKBox-B2/Overview/#product-description + diff --git a/proto b/proto index 3252ed0f1..858d816b8 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit 3252ed0f1357d55233f2d5cb50acf20dbb9160ed +Subproject commit 858d816b8c18911fd4dc2aee3fa421fd67325631 diff --git a/src/mesh/generated/deviceonly.pb.h b/src/mesh/generated/deviceonly.pb.h index fa5de7b93..432572825 100644 --- a/src/mesh/generated/deviceonly.pb.h +++ b/src/mesh/generated/deviceonly.pb.h @@ -125,7 +125,7 @@ extern const pb_msgdesc_t ChannelFile_msg; /* Maximum encoded size of messages (where known) */ #define LegacyRadioConfig_size 4 #define LegacyRadioConfig_LegacyPreferences_size 2 -#define DeviceState_size 5118 +#define DeviceState_size 5184 #define ChannelFile_size 832 #ifdef __cplusplus diff --git a/src/mesh/generated/mesh.pb.h b/src/mesh/generated/mesh.pb.h index 4f30ade8b..93bb63cdf 100644 --- a/src/mesh/generated/mesh.pb.h +++ b/src/mesh/generated/mesh.pb.h @@ -135,6 +135,7 @@ typedef struct _User { char short_name[5]; pb_byte_t macaddr[6]; HardwareModel hw_model; + bool is_licensed; } User; typedef PB_BYTES_ARRAY_T(256) MeshPacket_encrypted_t; @@ -230,7 +231,7 @@ extern "C" { /* Initializer values for message structs */ #define Position_init_default {0, 0, 0, 0, 0} -#define User_init_default {"", "", "", {0}, _HardwareModel_MIN} +#define User_init_default {"", "", "", {0}, _HardwareModel_MIN, 0} #define RouteDiscovery_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}} #define Routing_init_default {0, {RouteDiscovery_init_default}} #define Data_init_default {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0} @@ -241,7 +242,7 @@ extern "C" { #define FromRadio_init_default {0, 0, {MyNodeInfo_init_default}} #define ToRadio_init_default {0, {MeshPacket_init_default}} #define Position_init_zero {0, 0, 0, 0, 0} -#define User_init_zero {"", "", "", {0}, _HardwareModel_MIN} +#define User_init_zero {"", "", "", {0}, _HardwareModel_MIN, 0} #define RouteDiscovery_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}} #define Routing_init_zero {0, {RouteDiscovery_init_zero}} #define Data_init_zero {_PortNum_MIN, {0, {0}}, 0, 0, 0, 0} @@ -287,6 +288,7 @@ extern "C" { #define User_short_name_tag 3 #define User_macaddr_tag 4 #define User_hw_model_tag 6 +#define User_is_licensed_tag 7 #define MeshPacket_from_tag 1 #define MeshPacket_to_tag 2 #define MeshPacket_channel_tag 3 @@ -333,7 +335,8 @@ X(a, STATIC, SINGULAR, STRING, id, 1) \ X(a, STATIC, SINGULAR, STRING, long_name, 2) \ X(a, STATIC, SINGULAR, STRING, short_name, 3) \ X(a, STATIC, SINGULAR, FIXED_LENGTH_BYTES, macaddr, 4) \ -X(a, STATIC, SINGULAR, UENUM, hw_model, 6) +X(a, STATIC, SINGULAR, UENUM, hw_model, 6) \ +X(a, STATIC, SINGULAR, BOOL, is_licensed, 7) #define User_CALLBACK NULL #define User_DEFAULT NULL @@ -464,12 +467,12 @@ extern const pb_msgdesc_t ToRadio_msg; /* Maximum encoded size of messages (where known) */ #define Position_size 37 -#define User_size 74 +#define User_size 76 #define RouteDiscovery_size 40 #define Routing_size 42 #define Data_size 260 #define MeshPacket_size 309 -#define NodeInfo_size 131 +#define NodeInfo_size 133 #define MyNodeInfo_size 95 #define LogRecord_size 81 #define FromRadio_size 318 diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index 8d3a5eff9..ddaf78a0b 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -9,8 +9,8 @@ MQTT *mqtt; -String statusTopic = "mesh/stat/"; -String cryptTopic = "mesh/crypt/"; // mesh/crypt/CHANNELID/NODEID +String statusTopic = "msh/1/stat/"; +String cryptTopic = "msh/1/c/"; // msh/1/c/CHANNELID/NODEID void MQTT::mqttCallback(char *topic, byte *payload, unsigned int length) { @@ -59,7 +59,7 @@ MQTT::MQTT() : concurrency::OSThread("mqtt"), pubSub(mqttClient) void MQTT::reconnect() { // pubSub.setServer("devsrv.ezdevice.net", 1883); or 192.168.10.188 - const char *serverAddr = "test.mosquitto.org"; // "mqtt.meshtastic.org"; // default hostname + const char *serverAddr = "mqtt.meshtastic.org"; // default hostname if (*radioConfig.preferences.mqtt_server) serverAddr = radioConfig.preferences.mqtt_server; // Override the default @@ -68,8 +68,7 @@ void MQTT::reconnect() DEBUG_MSG("Connecting to MQTT server\n", serverAddr); auto myStatus = (statusTopic + owner.id); - // bool connected = pubSub.connect(nodeId.c_str(), "meshdev", "apes4cats", myStatus.c_str(), 1, true, "offline"); - bool connected = pubSub.connect(owner.id, myStatus.c_str(), 1, true, "offline"); + bool connected = pubSub.connect(owner.id, "meshdev", "large4cats", myStatus.c_str(), 1, true, "offline"); if (connected) { DEBUG_MSG("MQTT connected\n"); enabled = true; // Start running background process again @@ -89,7 +88,7 @@ void MQTT::sendSubscriptions() size_t numChan = channels.getNumChannels(); for (size_t i = 0; i < numChan; i++) { auto &ch = channels.getByIndex(i); - if (ch.settings.uplink_enabled) { + if (ch.settings.downlink_enabled) { String topic = cryptTopic + channels.getGlobalId(i) + "/#"; DEBUG_MSG("Subscribing to %s\n", topic.c_str()); pubSub.subscribe(topic.c_str(), 1); // FIXME, is QOS 1 right? diff --git a/src/plugins/AdminPlugin.cpp b/src/plugins/AdminPlugin.cpp index 87989937b..9ec305ec7 100644 --- a/src/plugins/AdminPlugin.cpp +++ b/src/plugins/AdminPlugin.cpp @@ -115,6 +115,10 @@ void AdminPlugin::handleSetOwner(const User &o) changed |= strcmp(owner.id, o.id); strcpy(owner.id, o.id); } + if (owner.is_licensed != o.is_licensed) { + changed = true; + owner.is_licensed = o.is_licensed; + } if (changed) // If nothing really changed, don't broadcast on the network or write to flash service.reloadOwner(); diff --git a/version.properties b/version.properties index d36ee7b89..0d06a597c 100644 --- a/version.properties +++ b/version.properties @@ -1,4 +1,4 @@ [VERSION] major = 1 minor = 2 -build = 23 +build = 25