Add the DMR Interrupt command.

This commit is contained in:
Jonathan Naylor 2019-03-22 09:13:22 +00:00
parent 5acef270d1
commit 5be7ff0ce8
5 changed files with 30 additions and 2 deletions

View file

@ -647,6 +647,21 @@ bool CDMRNetwork::writePing()
return write(buffer, 11U);
}
bool CDMRNetwork::writeInterrupt(unsigned int slotNo)
{
if (slotNo > 2U)
return false;
unsigned char buffer[20U];
::memcpy(buffer + 0U, "RPTINTR", 7U);
::memcpy(buffer + 7U, m_id, 4U);
::sprintf((char*)buffer + 11U, ":%u", slotNo);
return write(buffer, ::strlen((char*)buffer));
}
bool CDMRNetwork::wantsBeacon()
{
bool beacon = m_beacon;

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
* Copyright (C) 2015-2019 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -52,6 +52,8 @@ public:
bool writeHomePosition(float latitude, float longitude);
bool writeInterrupt(unsigned int slotNo);
bool wantsBeacon();
void clock(unsigned int ms);

View file

@ -1818,6 +1818,10 @@ void CMMDVMHost::remoteControl()
if (m_nxdn != NULL)
processModeCommand(MODE_NXDN, m_nxdnRFModeHang);
break;
case RCD_DMR_INTERRUPT:
if (m_dmrNetwork != NULL)
m_dmrNetwork->writeInterrupt(m_remoteControl->getArgUInt(2U));
break;
case RCD_PAGE:
if (m_pocsag != NULL) {
unsigned int ric = m_remoteControl->getArgUInt(0U);

View file

@ -24,6 +24,7 @@
#include <cassert>
#include <cstring>
const unsigned int DMR_INTERRUPT_ARGS = 2U;
const unsigned int SET_MODE_ARGS = 2U;
const unsigned int PAGE_ARGS = 3U;
@ -89,6 +90,10 @@ REMOTE_COMMAND CRemoteControl::getCommand()
} 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;
} else if (m_args.at(0U) == "dmr" && m_args.size() >= DMR_ARGS) {
// DMR commands are in the form of "dmr interrupt <0|1|2>"
if (m_args.at(1U) == "interupt")
m_command = RCD_DMR_INTERRUPT;
}
if (m_command == RCD_NONE) {
@ -114,6 +119,7 @@ unsigned int CRemoteControl::getArgCount() const
case RCD_MODE_NXDN:
return m_args.size() - SET_MODE_ARGS;
case RCD_PAGE:
case RCD_DMR_INTERRUPT:
return m_args.size() - 1U;
default:
return 0U;

View file

@ -33,7 +33,8 @@ enum REMOTE_COMMAND {
RCD_MODE_YSF,
RCD_MODE_P25,
RCD_MODE_NXDN,
RCD_PAGE
RCD_PAGE,
RCD_DMR_INTERRUPT
};
class CRemoteControl {