kopia lustrzana https://github.com/PiInTheSky/lora-gateway
V1.10.6 - Use receiver callsign for MQTT client ID because that needs to be unique
rodzic
89581085ab
commit
c40159c254
|
@ -296,6 +296,9 @@ Many thanks to David Brooke for coding this feature and the AFC.
|
||||||
Change History
|
Change History
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
## 08/10/2023 - V1.10.6
|
||||||
|
Use callsign for MQTT client ID
|
||||||
|
|
||||||
## 08/10/2023 - V1.10.5
|
## 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
|
Fully handle all documented Sondehub responses - see https://github.com/projecthorus/sondehub-infra/wiki/API-(Beta)#notes-on-api-response-codes
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
#include "udpclient.h"
|
#include "udpclient.h"
|
||||||
#include "lifo_buffer.h"
|
#include "lifo_buffer.h"
|
||||||
|
|
||||||
#define VERSION "V1.10.5"
|
#define VERSION "V1.10.6"
|
||||||
bool run = TRUE;
|
bool run = TRUE;
|
||||||
|
|
||||||
// RFM98
|
// RFM98
|
||||||
|
@ -2142,7 +2142,6 @@ void LoadConfigFile(void)
|
||||||
RegisterConfigString(MainSection, -1, "MQTTPort", Config.MQTTPort, sizeof(Config.MQTTPort), NULL);
|
RegisterConfigString(MainSection, -1, "MQTTPort", Config.MQTTPort, sizeof(Config.MQTTPort), NULL);
|
||||||
RegisterConfigString(MainSection, -1, "MQTTUser", Config.MQTTUser, sizeof(Config.MQTTUser), NULL);
|
RegisterConfigString(MainSection, -1, "MQTTUser", Config.MQTTUser, sizeof(Config.MQTTUser), NULL);
|
||||||
RegisterConfigString(MainSection, -1, "MQTTPass", Config.MQTTPass, sizeof(Config.MQTTPass), 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);
|
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->user, Config.MQTTUser);
|
||||||
strcpy(mqttConnection->pass, Config.MQTTPass);
|
strcpy(mqttConnection->pass, Config.MQTTPass);
|
||||||
strcpy(mqttConnection->topic, Config.MQTTTopic);
|
strcpy(mqttConnection->topic, Config.MQTTTopic);
|
||||||
strcpy(mqttConnection->clientId, Config.MQTTClient);
|
strcpy(mqttConnection->clientId, Config.Tracker);
|
||||||
|
|
||||||
if ( pthread_create (&MQTTThread, NULL, MQTTLoop, mqttConnection))
|
if ( pthread_create (&MQTTThread, NULL, MQTTLoop, mqttConnection))
|
||||||
{
|
{
|
||||||
|
|
1
global.h
1
global.h
|
@ -151,7 +151,6 @@ struct TConfig
|
||||||
char MQTTPort[8];
|
char MQTTPort[8];
|
||||||
char MQTTUser[16];
|
char MQTTUser[16];
|
||||||
char MQTTPass[32];
|
char MQTTPass[32];
|
||||||
char MQTTClient[16];
|
|
||||||
char MQTTTopic[128];
|
char MQTTTopic[128];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
11
mqtt.c
11
mqtt.c
|
@ -110,17 +110,16 @@ bool UploadMQTTPacket(mqtt_connect_t * mqttConnection, received_t * t )
|
||||||
|
|
||||||
BuildMQTTPath(topic, mqttConnection, t);
|
BuildMQTTPath(topic, mqttConnection, t);
|
||||||
|
|
||||||
MQTTClient_create(&client, address, mqttConnection->clientId,
|
MQTTClient_create(&client, address, mqttConnection->clientId, MQTTCLIENT_PERSISTENCE_NONE, NULL);
|
||||||
MQTTCLIENT_PERSISTENCE_NONE, NULL);
|
|
||||||
conn_opts.keepAliveInterval = 20;
|
conn_opts.keepAliveInterval = 20;
|
||||||
conn_opts.cleansession = 1;
|
conn_opts.cleansession = 1;
|
||||||
conn_opts.username = mqttConnection->user;
|
conn_opts.username = mqttConnection->user;
|
||||||
conn_opts.password = mqttConnection->pass;
|
conn_opts.password = mqttConnection->pass;
|
||||||
MQTTClient_setCallbacks(client, NULL, connlost, msgarrvd, delivered);
|
MQTTClient_setCallbacks(client, NULL, connlost, msgarrvd, delivered);
|
||||||
// LogMessage("Attempting publication on host: %s\n",
|
|
||||||
// address);
|
LogMessage("Attempting publication on host: %s\n", address);
|
||||||
//"on topic %s for client with ClientID: %s\n",
|
LogMessage("on topic %s for client with ClientID: %s\n", topic, mqttConnection->clientId);
|
||||||
//t->Message, address, topic, mqttConnection->clientId);
|
|
||||||
if ((rc = MQTTClient_connect(client, &conn_opts)) != MQTTCLIENT_SUCCESS)
|
if ((rc = MQTTClient_connect(client, &conn_opts)) != MQTTCLIENT_SUCCESS)
|
||||||
{
|
{
|
||||||
LogMessage("MQTT: Failed to connect, return code %d\n", rc);
|
LogMessage("MQTT: Failed to connect, return code %d\n", rc);
|
||||||
|
|
Ładowanie…
Reference in New Issue