mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-20 22:45:44 +08:00
Beginnings of allowing for local POCSAG message transmissions.
This commit is contained in:
@@ -1818,6 +1818,17 @@ void CMMDVMHost::remoteControl()
|
|||||||
if (m_nxdn != NULL)
|
if (m_nxdn != NULL)
|
||||||
processModeCommand(MODE_NXDN, m_nxdnRFModeHang);
|
processModeCommand(MODE_NXDN, m_nxdnRFModeHang);
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,6 +96,27 @@ unsigned int CPOCSAGControl::readModem(unsigned char* data)
|
|||||||
return len;
|
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()
|
bool CPOCSAGControl::processData()
|
||||||
{
|
{
|
||||||
if (m_network == NULL)
|
if (m_network == NULL)
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ public:
|
|||||||
CPOCSAGControl(CPOCSAGNetwork* network, CDisplay* display);
|
CPOCSAGControl(CPOCSAGNetwork* network, CDisplay* display);
|
||||||
~CPOCSAGControl();
|
~CPOCSAGControl();
|
||||||
|
|
||||||
|
void sendPage(unsigned int ric, const std::string& text);
|
||||||
|
|
||||||
unsigned int readModem(unsigned char* data);
|
unsigned int readModem(unsigned char* data);
|
||||||
|
|
||||||
void clock(unsigned int ms);
|
void clock(unsigned int ms);
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
const unsigned int SET_MODE_ARGS = 2U;
|
const unsigned int SET_MODE_ARGS = 2U;
|
||||||
|
const unsigned int PAGE_ARGS = 3U;
|
||||||
|
|
||||||
const unsigned int BUFFER_LENGTH = 100U;
|
const unsigned int BUFFER_LENGTH = 100U;
|
||||||
|
|
||||||
@@ -85,6 +86,9 @@ REMOTE_COMMAND CRemoteControl::getCommand()
|
|||||||
m_command = RCD_MODE_P25;
|
m_command = RCD_MODE_P25;
|
||||||
else if (m_args.at(1U) == "nxdn")
|
else if (m_args.at(1U) == "nxdn")
|
||||||
m_command = RCD_MODE_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) {
|
if (m_command == RCD_NONE) {
|
||||||
@@ -109,6 +113,8 @@ unsigned int CRemoteControl::getArgCount() const
|
|||||||
case RCD_MODE_P25:
|
case RCD_MODE_P25:
|
||||||
case RCD_MODE_NXDN:
|
case RCD_MODE_NXDN:
|
||||||
return m_args.size() - SET_MODE_ARGS;
|
return m_args.size() - SET_MODE_ARGS;
|
||||||
|
case RCD_PAGE:
|
||||||
|
return m_args.size() - 1U;
|
||||||
default:
|
default:
|
||||||
return 0U;
|
return 0U;
|
||||||
}
|
}
|
||||||
@@ -126,6 +132,9 @@ std::string CRemoteControl::getArgString(unsigned int n) const
|
|||||||
case RCD_MODE_NXDN:
|
case RCD_MODE_NXDN:
|
||||||
n += SET_MODE_ARGS;
|
n += SET_MODE_ARGS;
|
||||||
break;
|
break;
|
||||||
|
case RCD_PAGE:
|
||||||
|
n += 1U;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ enum REMOTE_COMMAND {
|
|||||||
RCD_MODE_DMR,
|
RCD_MODE_DMR,
|
||||||
RCD_MODE_YSF,
|
RCD_MODE_YSF,
|
||||||
RCD_MODE_P25,
|
RCD_MODE_P25,
|
||||||
RCD_MODE_NXDN
|
RCD_MODE_NXDN,
|
||||||
|
RCD_PAGE
|
||||||
};
|
};
|
||||||
|
|
||||||
class CRemoteControl {
|
class CRemoteControl {
|
||||||
|
|||||||
Reference in New Issue
Block a user