Beginnings of allowing for local POCSAG message transmissions.

This commit is contained in:
Jonathan Naylor 2019-01-22 21:33:49 +00:00
parent ec986d97ee
commit 9b2352c877
5 changed files with 45 additions and 1 deletions

View File

@ -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;
}

View File

@ -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)

View File

@ -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);

View File

@ -25,6 +25,7 @@
#include <cstring>
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 <ric> <message>"
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 "";
}

View File

@ -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 {