diff --git a/host/Host.cpp b/host/Host.cpp index e4b53a23..42dcbe0e 100644 --- a/host/Host.cpp +++ b/host/Host.cpp @@ -145,7 +145,7 @@ int Host::run() ::fatal("cannot read the configuration file, %s\n", m_confFile.c_str()); } } - catch (yaml::OperationException e) { + catch (yaml::OperationException const& e) { ::fatal("cannot read the configuration file, %s", e.message()); } @@ -544,6 +544,20 @@ int Host::run() g_killed = true; } + // check if the modem is a hotspot + if (m_modem->isHotspot()) { + if (m_dmrEnabled && m_p25Enabled) { + ::LogError(LOG_HOST, "Dual-mode (DMR and P25) is not supported for hotspots!"); + g_killed = true; + } + else { + if (!m_fixedMode) { + ::LogInfoEx(LOG_HOST, "Host is running on a hotspot modem! Fixed mode is forced."); + m_fixedMode = true; + } + } + } + if (!g_killed) { // fixed more or P25 control channel will force a state change if (m_fixedMode || m_p25CtrlChannel) { diff --git a/modem/Modem.cpp b/modem/Modem.cpp index b06e5801..381810b8 100644 --- a/modem/Modem.cpp +++ b/modem/Modem.cpp @@ -873,6 +873,15 @@ bool Modem::hasP25Space() const return space > 1U; } +/// +/// Helper to test if the modem is a hotspot. +/// +/// True, if the modem is a hotspot, otherwise false. +bool Modem::isHotspot() const +{ + return m_isHotspot; +} + /// /// Flag indicating whether or not the air interface modem is transmitting. /// diff --git a/modem/Modem.h b/modem/Modem.h index 5a39c62a..85b0a783 100644 --- a/modem/Modem.h +++ b/modem/Modem.h @@ -235,6 +235,9 @@ namespace modem bool hasDMRSpace2() const; /// Helper to test if the P25 ring buffer has free space. bool hasP25Space() const; + + /// Helper to test if the modem is a hotspot. + bool isHotspot() const; /// Flag indicating whether or not the air interface modem is transmitting. bool hasTX() const; diff --git a/network/Network.cpp b/network/Network.cpp index f9fe4018..b76a3c5d 100644 --- a/network/Network.cpp +++ b/network/Network.cpp @@ -493,7 +493,7 @@ bool Network::writeAuthorisation() bool Network::writeConfig() { const char* software = "DVM_DMR_P25"; - char buffer[168U]; + char buffer[176U]; ::memcpy(buffer + 0U, TAG_REPEATER_CONFIG, 4U); __SET_UINT32(m_id, buffer, 4U); @@ -532,9 +532,9 @@ bool Network::writeConfig() "", m_rconPassword.c_str(), m_rconPort); if (m_debug) - Utils::dump(1U, "Network Transmitted, Configuration", (uint8_t*)buffer, 168U); + Utils::dump(1U, "Network Transmitted, Configuration", (uint8_t*)buffer, 176U); - return write((uint8_t*)buffer, 168U); + return write((uint8_t*)buffer, 176U); } /// diff --git a/yaml/Yaml.cpp b/yaml/Yaml.cpp index c2c5bf41..4bb44b52 100644 --- a/yaml/Yaml.cpp +++ b/yaml/Yaml.cpp @@ -1597,7 +1597,7 @@ namespace yaml postProcessLines(); parseRoot(root); } - catch (Exception e) + catch (Exception const& e) { root.clear(); throw; @@ -2269,7 +2269,7 @@ namespace yaml delete pImp; return true; } - catch (const Exception e) + catch (Exception const& e) { delete pImp; return false;