From 088a62789fca78a89f56ac062ef3d2315b8fcac6 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Wed, 12 Mar 2025 13:25:26 +0000 Subject: [PATCH] Use a random id for MQTT and change the order of some startup messages. --- MMDVMHost.cpp | 11 ++++------- MQTTConnection.cpp | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index 3b8ae26..dbb3db6 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015-2021,2023,2024 by Jonathan Naylor G4KLX + * Copyright (C) 2015-2021,2023,2024,2025 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -76,7 +76,7 @@ static CMMDVMHost* host = NULL; const char* HEADER1 = "This software is for use on amateur radio networks only,"; const char* HEADER2 = "it is to be used for educational purposes only. Its use on"; const char* HEADER3 = "commercial networks is strictly prohibited."; -const char* HEADER4 = "Copyright(C) 2015-2024 by Jonathan Naylor, G4KLX and others"; +const char* HEADER4 = "Copyright(C) 2015-2025 by Jonathan Naylor, G4KLX and others"; int main(int argc, char** argv) { @@ -391,6 +391,8 @@ int CMMDVMHost::run() LogInfo("MMDVMHost-%s is starting", VERSION); LogInfo("Built %s %s (GitID #%.7s)", __TIME__, __DATE__, gitversion); + writeJSONMessage("MMDVMHost is starting"); + readParams(); ret = createModem(); @@ -902,11 +904,6 @@ int CMMDVMHost::run() setMode(MODE_IDLE); - LogInfo("MMDVMHost-%s is starting", VERSION); - LogInfo("Built %s %s (GitID #%.7s)", __TIME__, __DATE__, gitversion); - - writeJSONMessage("MMDVMHost is starting"); - while (!m_killed) { bool lockout = m_modem->hasLockout(); diff --git a/MQTTConnection.cpp b/MQTTConnection.cpp index 41f4789..beb3e4f 100644 --- a/MQTTConnection.cpp +++ b/MQTTConnection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022,2023 by Jonathan Naylor G4KLX + * Copyright (C) 2022,2023,2025 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -51,7 +51,7 @@ CMQTTConnection::~CMQTTConnection() bool CMQTTConnection::open() { - m_mosq = ::mosquitto_new(m_name.c_str(), true, this); + m_mosq = ::mosquitto_new(NULL, true, this); if (m_mosq == NULL) { ::fprintf(stderr, "MQTT Error newing: Out of memory.\n"); return false;