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. # control channel to give the control channel "real time" traffic channel updates.
# #
controlCh: controlCh:
# REST API IP Address for control channel. # REST API IP Address for control channel. (If blank, notifications are disabled.)
restAddress: 127.0.0.1 restAddress:
# REST API Port number for control channel. # REST API Port number for control channel. (If 0, notifications are disabled.)
restPort: 9990 restPort: 0
# REST API access password for control channel. # REST API access password for control channel.
restPassword: "PASSWORD" restPassword: "PASSWORD"
# Flag indicating voice channels will notify the control channel of traffic status. # Flag indicating voice channels will notify the control channel of traffic status.
notifyEnable: true notifyEnable: false
# #
# Voice Channels # 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 rfssConfig = systemConf["config"];
yaml::Node controlCh = rfssConfig["controlCh"]; yaml::Node controlCh = rfssConfig["controlCh"];
bool notifyCC = controlCh["notifyEnable"].as<bool>(true); bool notifyCC = controlCh["notifyEnable"].as<bool>(false);
m_slot1->setNotifyCC(notifyCC); m_slot1->setNotifyCC(notifyCC);
m_slot2->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(" Silence Threshold: %u (%.1f%%)", silenceThreshold, float(silenceThreshold) / 1.41F);
LogInfo(" Verify Registration: %s", Slot::m_verifyReg ? "yes" : "no"); 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> /// <param name="dstId"></param>
void Slot::notifyCC_ReleaseGrant(uint32_t dstId) 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()) {
if (!m_controlChData.address().empty() && m_controlChData.port() > 0) { return;
}
if (m_controlChData.port() == 0) {
return;
}
if (!m_notifyCC) { if (!m_notifyCC) {
return; return;
} }
// callback REST API to release the granted TG on the specified control channel
json::object req = json::object(); json::object req = json::object();
int state = modem::DVM_STATE::STATE_DMR; int state = modem::DVM_STATE::STATE_DMR;
req["state"].set<int>(state); req["state"].set<int>(state);
@ -962,7 +969,6 @@ void Slot::notifyCC_ReleaseGrant(uint32_t dstId)
if (ret != network::rest::http::HTTPPayload::StatusType::OK) { if (ret != network::rest::http::HTTPPayload::StatusType::OK) {
::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); ::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> /// <summary>
@ -971,12 +977,19 @@ void Slot::notifyCC_ReleaseGrant(uint32_t dstId)
/// <param name="dstId"></param> /// <param name="dstId"></param>
void Slot::notifyCC_TouchGrant(uint32_t dstId) 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()) {
if (!m_controlChData.address().empty() && m_controlChData.port() > 0) { return;
}
if (m_controlChData.port() == 0) {
return;
}
if (!m_notifyCC) { if (!m_notifyCC) {
return; return;
} }
// callback REST API to touch the granted TG on the specified control channel
json::object req = json::object(); json::object req = json::object();
int state = modem::DVM_STATE::STATE_DMR; int state = modem::DVM_STATE::STATE_DMR;
req["state"].set<int>(state); req["state"].set<int>(state);
@ -989,7 +1002,6 @@ void Slot::notifyCC_TouchGrant(uint32_t dstId)
if (ret != network::rest::http::HTTPPayload::StatusType::OK) { if (ret != network::rest::http::HTTPPayload::StatusType::OK) {
::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); ::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> /// <summary>

@ -1833,14 +1833,18 @@ bool Host::readParams()
{ {
yaml::Node controlCh = rfssConfig["controlCh"]; 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); uint16_t restApiPort = (uint16_t)controlCh["restPort"].as<uint32_t>(REST_API_DEFAULT_PORT);
std::string restApiPassword = controlCh["restPassword"].as<std::string>(); std::string restApiPassword = controlCh["restPassword"].as<std::string>();
VoiceChData data = VoiceChData(0U, restApiAddress, restApiPort, restApiPassword); VoiceChData data = VoiceChData(0U, restApiAddress, restApiPort, restApiPassword);
m_controlChData = data; 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()); ::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 rfssConfig = systemConf["config"];
yaml::Node controlCh = rfssConfig["controlCh"]; yaml::Node controlCh = rfssConfig["controlCh"];
m_notifyCC = controlCh["notifyEnable"].as<bool>(true); m_notifyCC = controlCh["notifyEnable"].as<bool>(false);
if (printOptions) { if (printOptions) {
LogInfo(" Silence Threshold: %u (%.1f%%)", m_voice->m_silenceThreshold, float(m_voice->m_silenceThreshold) / 12.33F); 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 Affiliation: %s", m_trunk->m_verifyAff ? "yes" : "no");
LogInfo(" Verify Registration: %s", m_trunk->m_verifyReg ? "yes" : "no"); LogInfo(" Verify Registration: %s", m_trunk->m_verifyReg ? "yes" : "no");
} }
@ -920,12 +921,20 @@ void Control::processNetwork()
/// <param name="dstId"></param> /// <param name="dstId"></param>
void Control::notifyCC_ReleaseGrant(uint32_t dstId) 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()) {
if (!m_controlChData.address().empty() && m_controlChData.port() > 0) { return;
}
if (m_controlChData.port() == 0) {
return;
}
if (!m_notifyCC) { if (!m_notifyCC) {
return; return;
} }
// callback REST API to release the granted TG on the specified control channel
json::object req = json::object(); json::object req = json::object();
int state = modem::DVM_STATE::STATE_NXDN; int state = modem::DVM_STATE::STATE_NXDN;
req["state"].set<int>(state); req["state"].set<int>(state);
@ -936,7 +945,6 @@ void Control::notifyCC_ReleaseGrant(uint32_t dstId)
if (ret != network::rest::http::HTTPPayload::StatusType::OK) { if (ret != network::rest::http::HTTPPayload::StatusType::OK) {
::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); ::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> /// <summary>
@ -945,12 +953,19 @@ void Control::notifyCC_ReleaseGrant(uint32_t dstId)
/// <param name="dstId"></param> /// <param name="dstId"></param>
void Control::notifyCC_TouchGrant(uint32_t dstId) 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()) {
if (!m_controlChData.address().empty() && m_controlChData.port() > 0) { return;
}
if (m_controlChData.port() == 0) {
return;
}
if (!m_notifyCC) { if (!m_notifyCC) {
return; return;
} }
// callback REST API to touch the granted TG on the specified control channel
json::object req = json::object(); json::object req = json::object();
int state = modem::DVM_STATE::STATE_NXDN; int state = modem::DVM_STATE::STATE_NXDN;
req["state"].set<int>(state); req["state"].set<int>(state);
@ -961,7 +976,6 @@ void Control::notifyCC_TouchGrant(uint32_t dstId)
if (ret != network::rest::http::HTTPPayload::StatusType::OK) { if (ret != network::rest::http::HTTPPayload::StatusType::OK) {
::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); ::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> /// <summary>

@ -366,7 +366,7 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::string cw
yaml::Node rfssConfig = systemConf["config"]; yaml::Node rfssConfig = systemConf["config"];
yaml::Node controlCh = rfssConfig["controlCh"]; 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 // voice on control forcibly disables CC notification
if (m_voiceOnControl) { 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"); LogInfo(" Disable Network HDUs: %s", m_disableNetworkHDU ? "yes" : "no");
if (!m_trunk->m_ctrlTSDUMBF) { if (!m_trunk->m_ctrlTSDUMBF) {
LogInfo(" Disable Multi-Block TSDUs: yes"); LogInfo(" Disable Multi-Block TSDUs: yes");
@ -1299,12 +1300,19 @@ void Control::processNetwork()
/// <param name="dstId"></param> /// <param name="dstId"></param>
void Control::notifyCC_ReleaseGrant(uint32_t dstId) 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()) {
if (!m_controlChData.address().empty() && m_controlChData.port() > 0) { return;
}
if (m_controlChData.port() == 0) {
return;
}
if (!m_notifyCC) { if (!m_notifyCC) {
return; return;
} }
// callback REST API to release the granted TG on the specified control channel
json::object req = json::object(); json::object req = json::object();
int state = modem::DVM_STATE::STATE_P25; int state = modem::DVM_STATE::STATE_P25;
req["state"].set<int>(state); req["state"].set<int>(state);
@ -1315,7 +1323,6 @@ void Control::notifyCC_ReleaseGrant(uint32_t dstId)
if (ret != network::rest::http::HTTPPayload::StatusType::OK) { if (ret != network::rest::http::HTTPPayload::StatusType::OK) {
::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); ::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> /// <summary>
@ -1324,12 +1331,19 @@ void Control::notifyCC_ReleaseGrant(uint32_t dstId)
/// <param name="dstId"></param> /// <param name="dstId"></param>
void Control::notifyCC_TouchGrant(uint32_t dstId) 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()) {
if (!m_controlChData.address().empty() && m_controlChData.port() > 0) { return;
}
if (m_controlChData.port() == 0) {
return;
}
if (!m_notifyCC) { if (!m_notifyCC) {
return; return;
} }
// callback REST API to touch the granted TG on the specified control channel
json::object req = json::object(); json::object req = json::object();
int state = modem::DVM_STATE::STATE_P25; int state = modem::DVM_STATE::STATE_P25;
req["state"].set<int>(state); req["state"].set<int>(state);
@ -1340,7 +1354,6 @@ void Control::notifyCC_TouchGrant(uint32_t dstId)
if (ret != network::rest::http::HTTPPayload::StatusType::OK) { if (ret != network::rest::http::HTTPPayload::StatusType::OK) {
::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); ::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> /// <summary>

Loading…
Cancel
Save

Powered by TurnKey Linux.