code cleanup; add whether or not the channel is VOC enabled in status REST response;

pull/32/head
Bryan Biedenkapp 3 years ago
parent 77ff4a551b
commit 2b73c0539c

@ -511,6 +511,14 @@ void RESTAPI::restAPI_GetStatus(const HTTPPayload& request, HTTPPayload& reply,
response["dmrCC"].set<bool>(m_host->m_dmrCtrlChannel); response["dmrCC"].set<bool>(m_host->m_dmrCtrlChannel);
response["p25CC"].set<bool>(m_host->m_p25CtrlChannel); response["p25CC"].set<bool>(m_host->m_p25CtrlChannel);
response["nxdnCC"].set<bool>(m_host->m_nxdnCtrlChannel); response["nxdnCC"].set<bool>(m_host->m_nxdnCtrlChannel);
yaml::Node p25Protocol = m_host->m_conf["protocols"]["p25"];
bool p25VOC = p25Protocol["voiceOnControl"].as<bool>(false);
yaml::Node nxdnProtocol = m_host->m_conf["protocols"]["nxdn"];
bool nxdnVOC = nxdnProtocol["voiceOnControl"].as<bool>(false);
response["p25VOC"].set<bool>(p25VOC);
response["nxdnVOC"].set<bool>(nxdnVOC);
} }
{ {

@ -132,12 +132,21 @@ static bool g_debug = false;
// Global Functions // Global Functions
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/// <summary>
/// Helper to print a fatal error message and exit.
/// </summary>
/// <param name="msg">Message.</param>
void fatal(const char* message) void fatal(const char* message)
{ {
::fprintf(stderr, "%s: %s\n", g_progExe.c_str(), message); ::fprintf(stderr, "%s: %s\n", g_progExe.c_str(), message);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/// <summary>
/// Helper to pring usage the command line arguments. (And optionally an error.)
/// </summary>
/// <param name="message">Error message.</param>
/// <param name="arg">Error message arguments.</param>
void usage(const char* message, const char* arg) void usage(const char* message, const char* arg)
{ {
::fprintf(stdout, __PROG_NAME__ " %s (built %s)\r\n", __VER__, __BUILD__); ::fprintf(stdout, __PROG_NAME__ " %s (built %s)\r\n", __VER__, __BUILD__);
@ -221,6 +230,12 @@ void usage(const char* message, const char* arg)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/// <summary>
/// Helper to validate the command line arguments.
/// </summary>
/// <param name="argc">Argument count.</param>
/// <param name="argv">Array of argument strings.</param>
/// <returns>Count of remaining unprocessed arguments.</returns>
int checkArgs(int argc, char* argv[]) int checkArgs(int argc, char* argv[])
{ {
int i, p = 0; int i, p = 0;

Loading…
Cancel
Save

Powered by TurnKey Linux.