kopia lustrzana https://github.com/meshtastic/firmware
we now send packets to mqtt server
rodzic
f3f09f0dcf
commit
638cec7f25
|
@ -15,15 +15,9 @@
|
|||
<component name="ChangeListManager">
|
||||
<list default="true" id="58922733-b05b-4b90-9655-b9b18914977a" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/docs/software/TODO.md" beforeDir="false" afterPath="$PROJECT_DIR$/docs/software/TODO.md" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/docs/software/mqtt.md" beforeDir="false" afterPath="$PROJECT_DIR$/docs/software/mqtt.md" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/platformio.ini" beforeDir="false" afterPath="$PROJECT_DIR$/platformio.ini" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/proto" beforeDir="false" afterPath="$PROJECT_DIR$/proto" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/src/main.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/mesh/generated/admin.pb.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/mesh/generated/admin.pb.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/mesh/generated/apponly.pb.c" beforeDir="false" afterPath="$PROJECT_DIR$/src/mesh/generated/apponly.pb.c" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/mesh/generated/apponly.pb.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/mesh/generated/apponly.pb.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/mesh/generated/radioconfig.pb.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/mesh/generated/radioconfig.pb.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/proto/docs/docs.md" beforeDir="false" afterPath="$PROJECT_DIR$/proto/docs/docs.md" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/mqtt/MQTT.h" beforeDir="false" afterPath="$PROJECT_DIR$/src/mqtt/MQTT.h" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -55,11 +49,6 @@
|
|||
<property name="settings.editor.selected.configurable" value="CMakeSettings" />
|
||||
</component>
|
||||
<component name="RunManager" selected="GDB Remote Debug.gdbremote-localhost-2345">
|
||||
<configuration default="true" type="CLionExternalRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" PASS_PARENT_ENVS_2="true">
|
||||
<method v="2">
|
||||
<option name="CLION.EXTERNAL.BUILD" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration default="true" type="CLion_Remote" version="1" remoteCommand="tcp:localhost:2345" symbolFile="" sysroot="">
|
||||
<debugger kind="GDB" isBundled="true" />
|
||||
<method v="2" />
|
||||
|
@ -78,6 +67,11 @@
|
|||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration default="true" type="GradleAppRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" PASS_PARENT_ENVS_2="true">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.cpp.gradle.execution.GradleNativeBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="PlatformIO Debug" type="platformio" factoryName="PlatformIO Debug" REDIRECT_INPUT="false" ELEVATE="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="meshtastic-esp32" TARGET_NAME="Debug" CONFIG_NAME="native" RUN_TARGET_PROJECT_NAME="meshtastic-esp32" RUN_TARGET_NAME="Debug">
|
||||
<method v="2">
|
||||
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
|
||||
|
@ -112,6 +106,7 @@
|
|||
<workItem from="1617160691713" duration="1016000" />
|
||||
<workItem from="1617279002260" duration="1626000" />
|
||||
<workItem from="1617425689081" duration="1896000" />
|
||||
<workItem from="1617437366919" duration="1182000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
@ -144,9 +139,14 @@
|
|||
<option name="timeStamp" value="7" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
|
||||
<url>file://$USER_HOME$/.platformio/packages/framework-portduino/libraries/WiFi/src/WiFiClient.cpp</url>
|
||||
<line>49</line>
|
||||
<option name="timeStamp" value="9" />
|
||||
<url>file://$PROJECT_DIR$/src/mqtt/MQTT.cpp</url>
|
||||
<line>84</line>
|
||||
<option name="timeStamp" value="10" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="com.jetbrains.cidr.execution.debugger.OCBreakpointType">
|
||||
<url>file://$PROJECT_DIR$/.pio/libdeps/native/PubSubClient/src/PubSubClient.cpp</url>
|
||||
<line>468</line>
|
||||
<option name="timeStamp" value="11" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
|
|
|
@ -1 +1 @@
|
|||
mosquitto_sub -h test.mosquitto.org -v -t mesh/\#
|
||||
mosquitto_sub -h test.mosquitto.org -v -t mesh/\# -F "%j"
|
||||
|
|
|
@ -53,6 +53,10 @@ You probably don't care about this section - skip to the next one.
|
|||
|
||||
## MQTT
|
||||
|
||||
* reply to MC
|
||||
* reply to question about MQTT
|
||||
* add test case of preencrypting in the python tool (and sending through a node that lacks keys)
|
||||
* leave encrypted messages as forwarded (need fixes on both tx and rx sides)
|
||||
* DONE have sim provide a fake wifi connection status saying connected
|
||||
* DONE don't start MQTT if we don't have wifi connected
|
||||
* have plugin send uplinks from mesh
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "MQTT.h"
|
||||
#include "MQTTPlugin.h"
|
||||
#include "NodeDB.h"
|
||||
#include "main.h"
|
||||
#include "mesh/generated/mqtt.pb.h"
|
||||
#include <WiFi.h>
|
||||
#include <assert.h>
|
||||
|
@ -30,7 +31,7 @@ void mqttInit()
|
|||
}
|
||||
}
|
||||
|
||||
MQTT::MQTT() : pubSub(mqttClient)
|
||||
MQTT::MQTT() : concurrency::OSThread("mqtt"), pubSub(mqttClient)
|
||||
{
|
||||
assert(!mqtt);
|
||||
mqtt = this;
|
||||
|
@ -50,6 +51,8 @@ MQTT::MQTT() : pubSub(mqttClient)
|
|||
bool connected = pubSub.connect(owner.id, myStatus.c_str(), 1, true, "offline");
|
||||
if (connected) {
|
||||
DEBUG_MSG("MQTT connected\n");
|
||||
enabled = true; // Start running background process again
|
||||
runASAP = true;
|
||||
|
||||
static char subsStr[64]; /* We keep this static because the mqtt lib
|
||||
might not be copying it */
|
||||
|
@ -62,6 +65,15 @@ MQTT::MQTT() : pubSub(mqttClient)
|
|||
}
|
||||
}
|
||||
|
||||
int32_t MQTT::runOnce()
|
||||
{
|
||||
// If connected poll rapidly, otherwise sleep forever
|
||||
if (!pubSub.loop())
|
||||
enabled = false;
|
||||
|
||||
return 20;
|
||||
}
|
||||
|
||||
void MQTT::publish(const MeshPacket &mp)
|
||||
{
|
||||
// don't bother sending if not connected...
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "configuration.h"
|
||||
|
||||
#include "concurrency/OSThread.h"
|
||||
#include <PubSubClient.h>
|
||||
#include <WiFiClient.h>
|
||||
|
||||
|
@ -9,7 +10,7 @@
|
|||
* Our wrapper/singleton for sending/receiving MQTT "udp" packets. This object isolates the MQTT protocol implementation from
|
||||
* the two components that use it: MQTTPlugin and MQTTSimInterface.
|
||||
*/
|
||||
class MQTT
|
||||
class MQTT : private concurrency::OSThread
|
||||
{
|
||||
// supposedly the current version is busted:
|
||||
// http://www.iotsharing.com/2017/08/how-to-use-esp32-mqtts-with-mqtts-mosquitto-broker-tls-ssl.html
|
||||
|
@ -25,6 +26,9 @@ class MQTT
|
|||
*/
|
||||
void publish(const MeshPacket &mp);
|
||||
|
||||
protected:
|
||||
virtual int32_t runOnce();
|
||||
|
||||
private:
|
||||
const char *getCryptTopic(const char *channelId);
|
||||
};
|
||||
|
|
Ładowanie…
Reference in New Issue