mirror of
https://github.com/g4klx/DMRGateway.git
synced 2026-04-06 23:13:48 +00:00
Add optional MQTT authentication.
This commit is contained in:
parent
a2e2ea3675
commit
538108b192
9 changed files with 68 additions and 10 deletions
24
Conf.cpp
24
Conf.cpp
|
|
@ -183,6 +183,9 @@ m_mqttAddress("127.0.0.1"),
|
|||
m_mqttPort(1883U),
|
||||
m_mqttKeepalive(60U),
|
||||
m_mqttName("dmr-gateway"),
|
||||
m_mqttAuthEnabled(false),
|
||||
m_mqttUsername(),
|
||||
m_mqttPassword(),
|
||||
m_dynamicTGControlEnabled(false),
|
||||
m_remoteCommandsEnabled(false)
|
||||
{
|
||||
|
|
@ -989,6 +992,12 @@ bool CConf::read()
|
|||
m_mqttKeepalive = (unsigned int)::atoi(value);
|
||||
else if (::strcmp(key, "Name") == 0)
|
||||
m_mqttName = value;
|
||||
else if (::strcmp(key, "Auth") == 0)
|
||||
m_mqttAuthEnabled = ::atoi(value) == 1;
|
||||
else if (::strcmp(key, "Username") == 0)
|
||||
m_mqttUsername = value;
|
||||
else if (::strcmp(key, "Password") == 0)
|
||||
m_mqttPassword = value;
|
||||
} else if (section == SECTION::DYNAMIC_TG_CONTROL) {
|
||||
if (::strcmp(key, "Enable") == 0)
|
||||
m_dynamicTGControlEnabled = ::atoi(value) == 1;
|
||||
|
|
@ -1696,6 +1705,21 @@ std::string CConf::getMQTTName() const
|
|||
return m_mqttName;
|
||||
}
|
||||
|
||||
bool CConf::getMQTTAuthEnabled() const
|
||||
{
|
||||
return m_mqttAuthEnabled;
|
||||
}
|
||||
|
||||
std::string CConf::getMQTTUsername() const
|
||||
{
|
||||
return m_mqttUsername;
|
||||
}
|
||||
|
||||
std::string CConf::getMQTTPassword() const
|
||||
{
|
||||
return m_mqttPassword;
|
||||
}
|
||||
|
||||
bool CConf::getDynamicTGControlEnabled() const
|
||||
{
|
||||
return m_dynamicTGControlEnabled;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue