assume better defaults when the controlCh block is missing; split logic checks for ignoring a notifyCC_* call for clarity; add extra logging messages for whether or not CC notify is enabled, and whether or not CC REST API parameters were passed;

pull/32/head
Bryan Biedenkapp 3 years ago
parent b99ecefd6a
commit c9f74e7abf

@ -333,14 +333,14 @@ system:
# control channel to give the control channel "real time" traffic channel updates.
#
controlCh:
# REST API IP Address for control channel.
restAddress: 127.0.0.1
# REST API Port number for control channel.
restPort: 9990
# REST API IP Address for control channel. (If blank, notifications are disabled.)
restAddress:
# REST API Port number for control channel. (If 0, notifications are disabled.)
restPort: 0
# REST API access password for control channel.
restPassword: "PASSWORD"
# Flag indicating voice channels will notify the control channel of traffic status.
notifyEnable: true
notifyEnable: false
#
# Voice Channels

@ -181,7 +181,7 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::vector<ui
yaml::Node rfssConfig = systemConf["config"];
yaml::Node controlCh = rfssConfig["controlCh"];
bool notifyCC = controlCh["notifyEnable"].as<bool>(true);
bool notifyCC = controlCh["notifyEnable"].as<bool>(false);
m_slot1->setNotifyCC(notifyCC);
m_slot2->setNotifyCC(notifyCC);
@ -210,6 +210,7 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::vector<ui
}
}
LogInfo(" Notify Control: %s", notifyCC ? "yes" : "no");
LogInfo(" Silence Threshold: %u (%.1f%%)", silenceThreshold, float(silenceThreshold) / 1.41F);
LogInfo(" Verify Registration: %s", Slot::m_verifyReg ? "yes" : "no");

@ -944,12 +944,19 @@ void Slot::addFrame(const uint8_t *data, bool net, bool imm)
/// <param name="dstId"></param>
void Slot::notifyCC_ReleaseGrant(uint32_t dstId)
{
// callback REST API to release the granted TG on the specified control channel
if (!m_controlChData.address().empty() && m_controlChData.port() > 0) {
if (m_controlChData.address().empty()) {
return;
}
if (m_controlChData.port() == 0) {
return;
}
if (!m_notifyCC) {
return;
}
// callback REST API to release the granted TG on the specified control channel
json::object req = json::object();
int state = modem::DVM_STATE::STATE_DMR;
req["state"].set<int>(state);
@ -963,7 +970,6 @@ void Slot::notifyCC_ReleaseGrant(uint32_t dstId)
::LogError(LOG_DMR, "DMR Slot %u, failed to notify the CC %s:%u of the release of, dstId = %u", m_slotNo, m_controlChData.address().c_str(), m_controlChData.port(), dstId);
}
}
}
/// <summary>
/// Helper to send a REST API request to the CC to "touch" a channel grant to refresh grant timers.
@ -971,12 +977,19 @@ void Slot::notifyCC_ReleaseGrant(uint32_t dstId)
/// <param name="dstId"></param>
void Slot::notifyCC_TouchGrant(uint32_t dstId)
{
// callback REST API to touch the granted TG on the specified control channel
if (!m_controlChData.address().empty() && m_controlChData.port() > 0) {
if (m_controlChData.address().empty()) {
return;
}
if (m_controlChData.port() == 0) {
return;
}
if (!m_notifyCC) {
return;
}
// callback REST API to touch the granted TG on the specified control channel
json::object req = json::object();
int state = modem::DVM_STATE::STATE_DMR;
req["state"].set<int>(state);
@ -990,7 +1003,6 @@ void Slot::notifyCC_TouchGrant(uint32_t dstId)
::LogError(LOG_DMR, "DMR Slot %u, failed to notify the CC %s:%u of the touch of, dstId = %u", m_slotNo, m_controlChData.address().c_str(), m_controlChData.port(), dstId);
}
}
}
/// <summary>
/// Write data frame to the network.

@ -1833,14 +1833,18 @@ bool Host::readParams()
{
yaml::Node controlCh = rfssConfig["controlCh"];
std::string restApiAddress = controlCh["restAddress"].as<std::string>("127.0.0.1");
std::string restApiAddress = controlCh["restAddress"].as<std::string>("");
uint16_t restApiPort = (uint16_t)controlCh["restPort"].as<uint32_t>(REST_API_DEFAULT_PORT);
std::string restApiPassword = controlCh["restPassword"].as<std::string>();
VoiceChData data = VoiceChData(0U, restApiAddress, restApiPort, restApiPassword);
m_controlChData = data;
if (!m_controlChData.address().empty() && m_controlChData.port() > 0) {
::LogInfoEx(LOG_HOST, "Control Channel REST API Adddress %s:%u", m_controlChData.address().c_str(), m_controlChData.port());
} else {
::LogInfoEx(LOG_HOST, "No Control Channel REST API Configured, CC notify disabled");
}
}
/*

@ -322,7 +322,7 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::string cw
yaml::Node rfssConfig = systemConf["config"];
yaml::Node controlCh = rfssConfig["controlCh"];
m_notifyCC = controlCh["notifyEnable"].as<bool>(true);
m_notifyCC = controlCh["notifyEnable"].as<bool>(false);
if (printOptions) {
LogInfo(" Silence Threshold: %u (%.1f%%)", m_voice->m_silenceThreshold, float(m_voice->m_silenceThreshold) / 12.33F);
@ -334,6 +334,7 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::string cw
}
}
LogInfo(" Notify Control: %s", m_notifyCC ? "yes" : "no");
LogInfo(" Verify Affiliation: %s", m_trunk->m_verifyAff ? "yes" : "no");
LogInfo(" Verify Registration: %s", m_trunk->m_verifyReg ? "yes" : "no");
}
@ -920,12 +921,20 @@ void Control::processNetwork()
/// <param name="dstId"></param>
void Control::notifyCC_ReleaseGrant(uint32_t dstId)
{
// callback REST API to release the granted TG on the specified control channel
if (!m_controlChData.address().empty() && m_controlChData.port() > 0) {
if (m_controlChData.address().empty()) {
return;
}
if (m_controlChData.port() == 0) {
return;
}
if (!m_notifyCC) {
return;
}
// callback REST API to release the granted TG on the specified control channel
json::object req = json::object();
int state = modem::DVM_STATE::STATE_NXDN;
req["state"].set<int>(state);
@ -937,7 +946,6 @@ void Control::notifyCC_ReleaseGrant(uint32_t dstId)
::LogError(LOG_NXDN, "failed to notify the CC %s:%u of the release of, dstId = %u", m_controlChData.address().c_str(), m_controlChData.port(), dstId);
}
}
}
/// <summary>
/// Helper to send a REST API request to the CC to "touch" a channel grant to refresh grant timers.
@ -945,12 +953,19 @@ void Control::notifyCC_ReleaseGrant(uint32_t dstId)
/// <param name="dstId"></param>
void Control::notifyCC_TouchGrant(uint32_t dstId)
{
// callback REST API to touch the granted TG on the specified control channel
if (!m_controlChData.address().empty() && m_controlChData.port() > 0) {
if (m_controlChData.address().empty()) {
return;
}
if (m_controlChData.port() == 0) {
return;
}
if (!m_notifyCC) {
return;
}
// callback REST API to touch the granted TG on the specified control channel
json::object req = json::object();
int state = modem::DVM_STATE::STATE_NXDN;
req["state"].set<int>(state);
@ -962,7 +977,6 @@ void Control::notifyCC_TouchGrant(uint32_t dstId)
::LogError(LOG_NXDN, "failed to notify the CC %s:%u of the touch of, dstId = %u", m_controlChData.address().c_str(), m_controlChData.port(), dstId);
}
}
}
/// <summary>
/// Helper to write control channel frame data.

@ -366,7 +366,7 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::string cw
yaml::Node rfssConfig = systemConf["config"];
yaml::Node controlCh = rfssConfig["controlCh"];
m_notifyCC = controlCh["notifyEnable"].as<bool>(true);
m_notifyCC = controlCh["notifyEnable"].as<bool>(false);
// voice on control forcibly disables CC notification
if (m_voiceOnControl) {
@ -384,6 +384,7 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::string cw
}
}
LogInfo(" Notify Control: %s", m_notifyCC ? "yes" : "no");
LogInfo(" Disable Network HDUs: %s", m_disableNetworkHDU ? "yes" : "no");
if (!m_trunk->m_ctrlTSDUMBF) {
LogInfo(" Disable Multi-Block TSDUs: yes");
@ -1299,12 +1300,19 @@ void Control::processNetwork()
/// <param name="dstId"></param>
void Control::notifyCC_ReleaseGrant(uint32_t dstId)
{
// callback REST API to release the granted TG on the specified control channel
if (!m_controlChData.address().empty() && m_controlChData.port() > 0) {
if (m_controlChData.address().empty()) {
return;
}
if (m_controlChData.port() == 0) {
return;
}
if (!m_notifyCC) {
return;
}
// callback REST API to release the granted TG on the specified control channel
json::object req = json::object();
int state = modem::DVM_STATE::STATE_P25;
req["state"].set<int>(state);
@ -1316,7 +1324,6 @@ void Control::notifyCC_ReleaseGrant(uint32_t dstId)
::LogError(LOG_P25, "failed to notify the CC %s:%u of the release of, dstId = %u", m_controlChData.address().c_str(), m_controlChData.port(), dstId);
}
}
}
/// <summary>
/// Helper to send a REST API request to the CC to "touch" a channel grant to refresh grant timers.
@ -1324,12 +1331,19 @@ void Control::notifyCC_ReleaseGrant(uint32_t dstId)
/// <param name="dstId"></param>
void Control::notifyCC_TouchGrant(uint32_t dstId)
{
// callback REST API to touch the granted TG on the specified control channel
if (!m_controlChData.address().empty() && m_controlChData.port() > 0) {
if (m_controlChData.address().empty()) {
return;
}
if (m_controlChData.port() == 0) {
return;
}
if (!m_notifyCC) {
return;
}
// callback REST API to touch the granted TG on the specified control channel
json::object req = json::object();
int state = modem::DVM_STATE::STATE_P25;
req["state"].set<int>(state);
@ -1341,7 +1355,6 @@ void Control::notifyCC_TouchGrant(uint32_t dstId)
::LogError(LOG_P25, "failed to notify the CC %s:%u of the touch of, dstId = %u", m_controlChData.address().c_str(), m_controlChData.port(), dstId);
}
}
}
/// <summary>
/// Helper to write control channel frame data.

Loading…
Cancel
Save

Powered by TurnKey Linux.