V1.10.6 - Use receiver callsign for MQTT client ID because that needs to be unique

master
Dave Akerman 2023-10-11 11:57:44 +01:00
rodzic 89581085ab
commit c40159c254
4 zmienionych plików z 10 dodań i 10 usunięć

Wyświetl plik

@ -296,6 +296,9 @@ Many thanks to David Brooke for coding this feature and the AFC.
Change History
==============
## 08/10/2023 - V1.10.6
Use callsign for MQTT client ID
## 08/10/2023 - V1.10.5
Fully handle all documented Sondehub responses - see https://github.com/projecthorus/sondehub-infra/wiki/API-(Beta)#notes-on-api-response-codes

Wyświetl plik

@ -45,7 +45,7 @@
#include "udpclient.h"
#include "lifo_buffer.h"
#define VERSION "V1.10.5"
#define VERSION "V1.10.6"
bool run = TRUE;
// RFM98
@ -2142,7 +2142,6 @@ void LoadConfigFile(void)
RegisterConfigString(MainSection, -1, "MQTTPort", Config.MQTTPort, sizeof(Config.MQTTPort), NULL);
RegisterConfigString(MainSection, -1, "MQTTUser", Config.MQTTUser, sizeof(Config.MQTTUser), NULL);
RegisterConfigString(MainSection, -1, "MQTTPass", Config.MQTTPass, sizeof(Config.MQTTPass), NULL);
RegisterConfigString(MainSection, -1, "MQTTClient", Config.MQTTClient, sizeof(Config.MQTTClient), NULL);
RegisterConfigString(MainSection, -1, "MQTTTopic", Config.MQTTTopic, sizeof(Config.MQTTTopic), NULL);
@ -2753,7 +2752,7 @@ int main( int argc, char **argv )
strcpy(mqttConnection->user, Config.MQTTUser);
strcpy(mqttConnection->pass, Config.MQTTPass);
strcpy(mqttConnection->topic, Config.MQTTTopic);
strcpy(mqttConnection->clientId, Config.MQTTClient);
strcpy(mqttConnection->clientId, Config.Tracker);
if ( pthread_create (&MQTTThread, NULL, MQTTLoop, mqttConnection))
{

Wyświetl plik

@ -151,7 +151,6 @@ struct TConfig
char MQTTPort[8];
char MQTTUser[16];
char MQTTPass[32];
char MQTTClient[16];
char MQTTTopic[128];
};

11
mqtt.c
Wyświetl plik

@ -110,17 +110,16 @@ bool UploadMQTTPacket(mqtt_connect_t * mqttConnection, received_t * t )
BuildMQTTPath(topic, mqttConnection, t);
MQTTClient_create(&client, address, mqttConnection->clientId,
MQTTCLIENT_PERSISTENCE_NONE, NULL);
MQTTClient_create(&client, address, mqttConnection->clientId, MQTTCLIENT_PERSISTENCE_NONE, NULL);
conn_opts.keepAliveInterval = 20;
conn_opts.cleansession = 1;
conn_opts.username = mqttConnection->user;
conn_opts.password = mqttConnection->pass;
MQTTClient_setCallbacks(client, NULL, connlost, msgarrvd, delivered);
// LogMessage("Attempting publication on host: %s\n",
// address);
//"on topic %s for client with ClientID: %s\n",
//t->Message, address, topic, mqttConnection->clientId);
LogMessage("Attempting publication on host: %s\n", address);
LogMessage("on topic %s for client with ClientID: %s\n", topic, mqttConnection->clientId);
if ((rc = MQTTClient_connect(client, &conn_opts)) != MQTTCLIENT_SUCCESS)
{
LogMessage("MQTT: Failed to connect, return code %d\n", rc);