mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-23 00:35:53 +08:00
Publish the log data via MQTT topics $NAME/log/$LEVEL.
This commit is contained in:
38
Conf.cpp
38
Conf.cpp
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2015-2021 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015-2022 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
|
||||
@@ -32,6 +32,7 @@ enum SECTION {
|
||||
SECTION_GENERAL,
|
||||
SECTION_INFO,
|
||||
SECTION_LOG,
|
||||
SECTION_MQTT,
|
||||
SECTION_CWID,
|
||||
SECTION_DMRID_LOOKUP,
|
||||
SECTION_NXDNID_LOOKUP,
|
||||
@@ -86,6 +87,10 @@ m_logFileLevel(0U),
|
||||
m_logFilePath(),
|
||||
m_logFileRoot(),
|
||||
m_logFileRotate(true),
|
||||
m_mqttHost("127.0.0.1"),
|
||||
m_mqttPort(1883),
|
||||
m_mqttKeepalive(60U),
|
||||
m_mqttName("mmdvm"),
|
||||
m_cwIdEnabled(false),
|
||||
m_cwIdTime(10U),
|
||||
m_cwIdCallsign(),
|
||||
@@ -369,6 +374,8 @@ bool CConf::read()
|
||||
section = SECTION_INFO;
|
||||
else if (::strncmp(buffer, "[Log]", 5U) == 0)
|
||||
section = SECTION_LOG;
|
||||
else if (::strncmp(buffer, "[MQTT]", 6U) == 0)
|
||||
section = SECTION_MQTT;
|
||||
else if (::strncmp(buffer, "[CW Id]", 7U) == 0)
|
||||
section = SECTION_CWID;
|
||||
else if (::strncmp(buffer, "[DMR Id Lookup]", 15U) == 0)
|
||||
@@ -513,6 +520,15 @@ bool CConf::read()
|
||||
m_logDisplayLevel = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "FileRotate") == 0)
|
||||
m_logFileRotate = ::atoi(value) == 1;
|
||||
} else if (section == SECTION_MQTT) {
|
||||
if (::strcmp(key, "Host") == 0)
|
||||
m_mqttHost = value;
|
||||
else if (::strcmp(key, "Port") == 0)
|
||||
m_mqttPort = (unsigned short)::atoi(value);
|
||||
else if (::strcmp(key, "Keepalive") == 0)
|
||||
m_mqttKeepalive = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "Name") == 0)
|
||||
m_mqttName = value;
|
||||
} else if (section == SECTION_CWID) {
|
||||
if (::strcmp(key, "Enable") == 0)
|
||||
m_cwIdEnabled = ::atoi(value) == 1;
|
||||
@@ -1253,6 +1269,26 @@ bool CConf::getLogFileRotate() const
|
||||
return m_logFileRotate;
|
||||
}
|
||||
|
||||
std::string CConf::getMQTTHost() const
|
||||
{
|
||||
return m_mqttHost;
|
||||
}
|
||||
|
||||
unsigned short CConf::getMQTTPort() const
|
||||
{
|
||||
return m_mqttPort;
|
||||
}
|
||||
|
||||
unsigned int CConf::getMQTTKeepalive() const
|
||||
{
|
||||
return m_mqttKeepalive;
|
||||
}
|
||||
|
||||
std::string CConf::getMQTTName() const
|
||||
{
|
||||
return m_mqttName;
|
||||
}
|
||||
|
||||
bool CConf::getCWIdEnabled() const
|
||||
{
|
||||
return m_cwIdEnabled;
|
||||
|
||||
Reference in New Issue
Block a user