sforkowany z mirror/meshtastic-firmware
fix nodeid
rodzic
139da372e7
commit
8890ca759d
|
@ -42,9 +42,9 @@ MQTT::MQTT() : pubSub(mqttClient)
|
||||||
pubSub.setCallback(mqttCallback);
|
pubSub.setCallback(mqttCallback);
|
||||||
|
|
||||||
DEBUG_MSG("Connecting to MQTT server: %s\n", serverAddr);
|
DEBUG_MSG("Connecting to MQTT server: %s\n", serverAddr);
|
||||||
auto myStatus = (statusTopic + nodeId);
|
auto myStatus = (statusTopic + owner.id);
|
||||||
// bool connected = pubSub.connect(nodeId.c_str(), "meshdev", "apes4cats", myStatus.c_str(), 1, true, "offline");
|
// bool connected = pubSub.connect(nodeId.c_str(), "meshdev", "apes4cats", myStatus.c_str(), 1, true, "offline");
|
||||||
bool connected = pubSub.connect(nodeId.c_str(), myStatus.c_str(), 1, true, "offline");
|
bool connected = pubSub.connect(owner.id, myStatus.c_str(), 1, true, "offline");
|
||||||
if (connected) {
|
if (connected) {
|
||||||
DEBUG_MSG("MQTT connected\n");
|
DEBUG_MSG("MQTT connected\n");
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ MQTT::MQTT() : pubSub(mqttClient)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MQTT::publish(const MeshPacket *mp, String channelId)
|
void MQTT::publish(const MeshPacket *mp)
|
||||||
{
|
{
|
||||||
// DEBUG_MSG("publish %s = %s\n", suffix.c_str(), payload.c_str());
|
// DEBUG_MSG("publish %s = %s\n", suffix.c_str(), payload.c_str());
|
||||||
|
|
||||||
|
@ -71,6 +71,6 @@ const char *MQTT::getTopic(String suffix, const char *direction)
|
||||||
static char buf[128];
|
static char buf[128];
|
||||||
|
|
||||||
// "mesh/crypt/CHANNELID/NODEID/PORTID"
|
// "mesh/crypt/CHANNELID/NODEID/PORTID"
|
||||||
snprintf(buf, sizeof(buf), "mesh/%s/%s/%s", direction, nodeId.c_str(), suffix.c_str());
|
snprintf(buf, sizeof(buf), "mesh/%s/%s/%s", direction, owner.id, suffix.c_str());
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
|
@ -11,9 +11,6 @@
|
||||||
*/
|
*/
|
||||||
class MQTT
|
class MQTT
|
||||||
{
|
{
|
||||||
/// Our globally unique node ID
|
|
||||||
String nodeId = "fixmemode";
|
|
||||||
|
|
||||||
// supposedly the current version is busted:
|
// supposedly the current version is busted:
|
||||||
// http://www.iotsharing.com/2017/08/how-to-use-esp32-mqtts-with-mqtts-mosquitto-broker-tls-ssl.html
|
// http://www.iotsharing.com/2017/08/how-to-use-esp32-mqtts-with-mqtts-mosquitto-broker-tls-ssl.html
|
||||||
// WiFiClientSecure wifiClient;
|
// WiFiClientSecure wifiClient;
|
||||||
|
@ -25,9 +22,8 @@ class MQTT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Publish a packet on the glboal MQTT server.
|
* Publish a packet on the glboal MQTT server.
|
||||||
* @param channelId must be a globally unique channel ID
|
|
||||||
*/
|
*/
|
||||||
void publish(const MeshPacket *mp, String channelId);
|
void publish(const MeshPacket *mp);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char *getTopic(String suffix, const char *direction = "dev");
|
const char *getTopic(String suffix, const char *direction = "dev");
|
||||||
|
|
Ładowanie…
Reference in New Issue