From f3fb07223807ca6c1f89ec736a9c203eb7bb22e9 Mon Sep 17 00:00:00 2001 From: Max Lapan Date: Fri, 25 Nov 2022 17:52:45 +0100 Subject: [PATCH 1/3] Sending test bcd message after every page command - need this for testing --- MMDVMHost.cpp | 1 + POCSAGControl.cpp | 25 +++++++++++++++++++++++++ POCSAGControl.h | 1 + 3 files changed, 27 insertions(+) diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index 11f3231..dee5d06 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -2639,6 +2639,7 @@ void CMMDVMHost::remoteControl() text += m_remoteControl->getArgString(i); } m_pocsag->sendPage(ric, text); + m_pocsag->sendBCDPage(ric, "01234"); } break; case RCD_CW: diff --git a/POCSAGControl.cpp b/POCSAGControl.cpp index ca34a55..09e7230 100644 --- a/POCSAGControl.cpp +++ b/POCSAGControl.cpp @@ -123,6 +123,31 @@ void CPOCSAGControl::sendPage(unsigned int ric, const std::string& text) m_data.push_back(output); } + +void CPOCSAGControl::sendBCDPage(unsigned int ric, const std::string& text) +{ + if (!m_enabled) + return; + + POCSAGData* output = new POCSAGData; + + output->m_ric = ric; + output->m_text = text; + + addAddress(FUNCTIONAL_NUMERIC, ric, output->m_buffer); + + LogDebug("Local message to %07u, func NUMERIC: \"%s\"", ric, text.c_str()); + + packNumeric(text, output->m_buffer); + + // Ensure data is an even number of words + if ((output->m_buffer.size() % 2U) == 1U) + output->m_buffer.push_back(POCSAG_IDLE_WORD); + + m_data.push_back(output); +} + + bool CPOCSAGControl::readNetwork() { if (m_network == NULL) diff --git a/POCSAGControl.h b/POCSAGControl.h index 1f2a81b..c082f20 100644 --- a/POCSAGControl.h +++ b/POCSAGControl.h @@ -43,6 +43,7 @@ public: ~CPOCSAGControl(); void sendPage(unsigned int ric, const std::string& text); + void sendBCDPage(unsigned int ric, const std::string& text); unsigned int readModem(unsigned char* data); From 8f5ff4ca057eff7ccb67d8ca6caaa31c424a1df4 Mon Sep 17 00:00:00 2001 From: Max Lapan Date: Fri, 25 Nov 2022 20:58:26 +0100 Subject: [PATCH 2/3] Add command page_bcd to send bcd message with pocsag --- MMDVMHost.cpp | 14 +++++++++++++- POCSAGControl.cpp | 2 +- POCSAGControl.h | 2 +- RemoteControl.cpp | 5 +++++ RemoteControl.h | 1 + 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index dee5d06..ae8a13c 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -2639,9 +2639,21 @@ void CMMDVMHost::remoteControl() text += m_remoteControl->getArgString(i); } m_pocsag->sendPage(ric, text); - m_pocsag->sendBCDPage(ric, "01234"); } break; + case RCD_PAGE_BCD: + if (m_pocsag != NULL) { + unsigned int ric = m_remoteControl->getArgUInt(0U); + std::string text; + for (unsigned int i = 1U; i < m_remoteControl->getArgCount(); i++) { + if (i > 1U) + text += " "; + text += m_remoteControl->getArgString(i); + } + m_pocsag->sendPageBCD(ric, text); + } + break; + case RCD_CW: setMode(MODE_IDLE); // Force the modem to go idle so that we can send the CW text. if (!m_modem->hasTX()) { diff --git a/POCSAGControl.cpp b/POCSAGControl.cpp index 09e7230..830b544 100644 --- a/POCSAGControl.cpp +++ b/POCSAGControl.cpp @@ -124,7 +124,7 @@ void CPOCSAGControl::sendPage(unsigned int ric, const std::string& text) } -void CPOCSAGControl::sendBCDPage(unsigned int ric, const std::string& text) +void CPOCSAGControl::sendPageBCD(unsigned int ric, const std::string& text) { if (!m_enabled) return; diff --git a/POCSAGControl.h b/POCSAGControl.h index c082f20..d6c428d 100644 --- a/POCSAGControl.h +++ b/POCSAGControl.h @@ -43,7 +43,7 @@ public: ~CPOCSAGControl(); void sendPage(unsigned int ric, const std::string& text); - void sendBCDPage(unsigned int ric, const std::string& text); + void sendPageBCD(unsigned int ric, const std::string& text); unsigned int readModem(unsigned char* data); diff --git a/RemoteControl.cpp b/RemoteControl.cpp index c67bd29..a99546e 100644 --- a/RemoteControl.cpp +++ b/RemoteControl.cpp @@ -137,6 +137,9 @@ REMOTE_COMMAND CRemoteControl::getCommand() } else if (m_args.at(0U) == "page" && m_args.size() >= PAGE_ARGS) { // Page command is in the form of "page " m_command = RCD_PAGE; + } else if (m_args.at(0U) == "page_bcd" && m_args.size() >= PAGE_ARGS) { + // BCD page command is in the form of "page_bcd " + m_command = RCD_PAGE_BCD; } else if (m_args.at(0U) == "cw" && m_args.size() >= CW_ARGS) { // CW command is in the form of "cw " m_command = RCD_CW; @@ -192,6 +195,7 @@ unsigned int CRemoteControl::getArgCount() const case RCD_MODE_M17: return m_args.size() - SET_MODE_ARGS; case RCD_PAGE: + case RCD_PAGE_BCD: return m_args.size() - 1U; case RCD_CW: return m_args.size() - 1U; @@ -214,6 +218,7 @@ std::string CRemoteControl::getArgString(unsigned int n) const n += SET_MODE_ARGS; break; case RCD_PAGE: + case RCD_PAGE_BCD: n += 1U; break; case RCD_CW: diff --git a/RemoteControl.h b/RemoteControl.h index 5f2610c..3142d57 100644 --- a/RemoteControl.h +++ b/RemoteControl.h @@ -54,6 +54,7 @@ enum REMOTE_COMMAND { RCD_DISABLE_FM, RCD_DISABLE_AX25, RCD_PAGE, + RCD_PAGE_BCD, RCD_CW, RCD_RELOAD, RCD_CONNECTION_STATUS, From 55ba1233a866e9833f666473485a64c61f7df7ab Mon Sep 17 00:00:00 2001 From: Max Lapan Date: Sat, 26 Nov 2022 11:04:01 +0100 Subject: [PATCH 3/3] Page alert commands --- MMDVMHost.cpp | 19 ++++++++++++++++++- POCSAGControl.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ POCSAGControl.h | 2 ++ RemoteControl.cpp | 10 ++++++++++ RemoteControl.h | 2 ++ 5 files changed, 76 insertions(+), 1 deletion(-) diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index ae8a13c..fcd0b39 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -2653,7 +2653,24 @@ void CMMDVMHost::remoteControl() m_pocsag->sendPageBCD(ric, text); } break; - + case RCD_PAGE_A1: + if (m_pocsag != NULL) { + unsigned int ric = m_remoteControl->getArgUInt(0U); + m_pocsag->sendPageAlert1(ric); + } + break; + case RCD_PAGE_A2: + if (m_pocsag != NULL) { + unsigned int ric = m_remoteControl->getArgUInt(0U); + std::string text; + for (unsigned int i = 1U; i < m_remoteControl->getArgCount(); i++) { + if (i > 1U) + text += " "; + text += m_remoteControl->getArgString(i); + } + m_pocsag->sendPageAlert2(ric, text); + } + break; case RCD_CW: setMode(MODE_IDLE); // Force the modem to go idle so that we can send the CW text. if (!m_modem->hasTX()) { diff --git a/POCSAGControl.cpp b/POCSAGControl.cpp index 830b544..5695510 100644 --- a/POCSAGControl.cpp +++ b/POCSAGControl.cpp @@ -148,6 +148,50 @@ void CPOCSAGControl::sendPageBCD(unsigned int ric, const std::string& text) } +void CPOCSAGControl::sendPageAlert1(unsigned int ric) +{ + if (!m_enabled) + return; + + POCSAGData* output = new POCSAGData; + + output->m_ric = ric; + + addAddress(FUNCTIONAL_ALERT1, ric, output->m_buffer); + + LogDebug("Local message to %07u, func Alert1", ric); + + // Ensure data is an even number of words + if ((output->m_buffer.size() % 2U) == 1U) + output->m_buffer.push_back(POCSAG_IDLE_WORD); + + m_data.push_back(output); +} + + +void CPOCSAGControl::sendPageAlert2(unsigned int ric, const std::string& text) +{ + if (!m_enabled) + return; + + POCSAGData* output = new POCSAGData; + + output->m_ric = ric; + output->m_text = text; + + addAddress(FUNCTIONAL_ALERT2, ric, output->m_buffer); + + LogDebug("Local message to %07u, func Alert2: \"%s\"", ric, text.c_str()); + + packASCII(text, output->m_buffer); + + // Ensure data is an even number of words + if ((output->m_buffer.size() % 2U) == 1U) + output->m_buffer.push_back(POCSAG_IDLE_WORD); + + m_data.push_back(output); +} + bool CPOCSAGControl::readNetwork() { if (m_network == NULL) diff --git a/POCSAGControl.h b/POCSAGControl.h index d6c428d..42fed7e 100644 --- a/POCSAGControl.h +++ b/POCSAGControl.h @@ -44,6 +44,8 @@ public: void sendPage(unsigned int ric, const std::string& text); void sendPageBCD(unsigned int ric, const std::string& text); + void sendPageAlert1(unsigned int ric); + void sendPageAlert2(unsigned int ric, const std::string& text); unsigned int readModem(unsigned char* data); diff --git a/RemoteControl.cpp b/RemoteControl.cpp index a99546e..e9f5429 100644 --- a/RemoteControl.cpp +++ b/RemoteControl.cpp @@ -140,6 +140,12 @@ REMOTE_COMMAND CRemoteControl::getCommand() } else if (m_args.at(0U) == "page_bcd" && m_args.size() >= PAGE_ARGS) { // BCD page command is in the form of "page_bcd " m_command = RCD_PAGE_BCD; + } else if (m_args.at(0U) == "page_a1" && m_args.size() == 2) { + // Alert1 page command is in the form of "page_a1 " + m_command = RCD_PAGE_A1; + } else if (m_args.at(0U) == "page_a2" && m_args.size() >= PAGE_ARGS) { + // Alert2 page command is in the form of "page_a2 " + m_command = RCD_PAGE_A2; } else if (m_args.at(0U) == "cw" && m_args.size() >= CW_ARGS) { // CW command is in the form of "cw " m_command = RCD_CW; @@ -196,6 +202,8 @@ unsigned int CRemoteControl::getArgCount() const return m_args.size() - SET_MODE_ARGS; case RCD_PAGE: case RCD_PAGE_BCD: + case RCD_PAGE_A1: + case RCD_PAGE_A2: return m_args.size() - 1U; case RCD_CW: return m_args.size() - 1U; @@ -219,6 +227,8 @@ std::string CRemoteControl::getArgString(unsigned int n) const break; case RCD_PAGE: case RCD_PAGE_BCD: + case RCD_PAGE_A1: + case RCD_PAGE_A2: n += 1U; break; case RCD_CW: diff --git a/RemoteControl.h b/RemoteControl.h index 3142d57..a4b2885 100644 --- a/RemoteControl.h +++ b/RemoteControl.h @@ -55,6 +55,8 @@ enum REMOTE_COMMAND { RCD_DISABLE_AX25, RCD_PAGE, RCD_PAGE_BCD, + RCD_PAGE_A1, + RCD_PAGE_A2, RCD_CW, RCD_RELOAD, RCD_CONNECTION_STATUS,