diff --git a/DMRNetwork.cpp b/DMRNetwork.cpp index 80ac444..7a62702 100644 --- a/DMRNetwork.cpp +++ b/DMRNetwork.cpp @@ -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; diff --git a/DMRNetwork.h b/DMRNetwork.h index 9d1c52e..52795ce 100644 --- a/DMRNetwork.h +++ b/DMRNetwork.h @@ -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); diff --git a/MMDVMHost.cpp b/MMDVMHost.cpp index bb00f23..07a7d4f 100644 --- a/MMDVMHost.cpp +++ b/MMDVMHost.cpp @@ -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); diff --git a/RemoteControl.cpp b/RemoteControl.cpp index afa1473..5a47b74 100644 --- a/RemoteControl.cpp +++ b/RemoteControl.cpp @@ -24,6 +24,7 @@ #include #include +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 " 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; diff --git a/RemoteControl.h b/RemoteControl.h index 479987a..edb63bd 100644 --- a/RemoteControl.h +++ b/RemoteControl.h @@ -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 {