diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index 0c9bcb4..a0520da 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -1818,6 +1818,17 @@ void CMMDVMHost::remoteControl() if (m_nxdn != NULL) processModeCommand(MODE_NXDN, m_nxdnRFModeHang); break; + case RCD_PAGE: + 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->sendPage(ric, text); + } default: break; } diff --git a/POCSAGControl.cpp b/POCSAGControl.cpp index ff7ec2f..8287f7f 100644 --- a/POCSAGControl.cpp +++ b/POCSAGControl.cpp @@ -96,6 +96,27 @@ unsigned int CPOCSAGControl::readModem(unsigned char* data) return len; } +void CPOCSAGControl::sendPage(unsigned int ric, const std::string& text) +{ + if (!m_enabled) + return; + + m_ric = ric; + m_text = text; + + m_buffer.clear(); + + addAddress(FUNCTIONAL_ALPHANUMERIC); + + LogDebug("Local message to %07u, func Alphanumeric: \"%s\"", m_ric, m_text.c_str()); + + packASCII(); + + // Ensure data is an even number of words + if ((m_buffer.size() % 2U) == 1U) + m_buffer.push_back(POCSAG_IDLE_WORD); +} + bool CPOCSAGControl::processData() { if (m_network == NULL) diff --git a/POCSAGControl.h b/POCSAGControl.h index 844644a..dd04141 100644 --- a/POCSAGControl.h +++ b/POCSAGControl.h @@ -35,6 +35,8 @@ public: CPOCSAGControl(CPOCSAGNetwork* network, CDisplay* display); ~CPOCSAGControl(); + void sendPage(unsigned int ric, const std::string& text); + unsigned int readModem(unsigned char* data); void clock(unsigned int ms); diff --git a/RemoteControl.cpp b/RemoteControl.cpp index e90e159..afa1473 100644 --- a/RemoteControl.cpp +++ b/RemoteControl.cpp @@ -25,6 +25,7 @@ #include const unsigned int SET_MODE_ARGS = 2U; +const unsigned int PAGE_ARGS = 3U; const unsigned int BUFFER_LENGTH = 100U; @@ -85,6 +86,9 @@ REMOTE_COMMAND CRemoteControl::getCommand() m_command = RCD_MODE_P25; else if (m_args.at(1U) == "nxdn") m_command = RCD_MODE_NXDN; + } else if (m_args.at(0U) == "page" && m_args.size() >= PAGE_ARGS) { + // Page command is in the form of "page " + m_command = RCD_PAGE; } if (m_command == RCD_NONE) { @@ -109,6 +113,8 @@ unsigned int CRemoteControl::getArgCount() const case RCD_MODE_P25: case RCD_MODE_NXDN: return m_args.size() - SET_MODE_ARGS; + case RCD_PAGE: + return m_args.size() - 1U; default: return 0U; } @@ -126,6 +132,9 @@ std::string CRemoteControl::getArgString(unsigned int n) const case RCD_MODE_NXDN: n += SET_MODE_ARGS; break; + case RCD_PAGE: + n += 1U; + break; default: return ""; } diff --git a/RemoteControl.h b/RemoteControl.h index 4730aa8..479987a 100644 --- a/RemoteControl.h +++ b/RemoteControl.h @@ -32,7 +32,8 @@ enum REMOTE_COMMAND { RCD_MODE_DMR, RCD_MODE_YSF, RCD_MODE_P25, - RCD_MODE_NXDN + RCD_MODE_NXDN, + RCD_PAGE }; class CRemoteControl {