Compare commits

...

2 Commits

Author SHA1 Message Date
Jonathan Naylor 3b365f4ce0 Fix a type and some type mismatches. 2019-03-24 12:19:05 +00:00
Jonathan Naylor 5be7ff0ce8 Add the DMR Interrupt command. 2019-03-22 09:13:22 +00:00
7 changed files with 39 additions and 9 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, 13U);
}
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

@ -159,7 +159,7 @@ bool CDStarNetwork::writePoll(const char* text)
buffer[4] = 0x0A; // Poll with text
unsigned int length = ::strlen(text);
unsigned int length = (unsigned int)::strlen(text);
// Include the nul at the end also
::memcpy(buffer + 5U, text, length + 1U);

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

@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2018 by Jonathan Naylor G4KLX
* Copyright (C) 2011-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
@ -1274,7 +1274,7 @@ bool CModem::writePOCSAGInfo(unsigned int ric, const std::string& message)
{
assert(m_serial != NULL);
size_t length = message.size();
unsigned int length = (unsigned int)message.size();
unsigned char buffer[250U];
@ -1297,7 +1297,7 @@ bool CModem::writeIPInfo(const std::string& address)
{
assert(m_serial != NULL);
size_t length = address.size();
unsigned int length = (unsigned int)address.size();
unsigned char buffer[25U];
@ -1722,7 +1722,7 @@ bool CModem::sendCWId(const std::string& callsign)
{
assert(m_serial != NULL);
unsigned int length = callsign.length();
unsigned int length = (unsigned int)callsign.length();
if (length > 200U)
length = 200U;

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_INTERRUPT_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) {
@ -104,6 +109,8 @@ REMOTE_COMMAND CRemoteControl::getCommand()
unsigned int CRemoteControl::getArgCount() const
{
unsigned int argsSize = (unsigned int)m_args.size();
switch (m_command) {
case RCD_MODE_IDLE:
case RCD_MODE_LOCKOUT:
@ -112,9 +119,10 @@ unsigned int CRemoteControl::getArgCount() const
case RCD_MODE_YSF:
case RCD_MODE_P25:
case RCD_MODE_NXDN:
return m_args.size() - SET_MODE_ARGS;
return argsSize - SET_MODE_ARGS;
case RCD_PAGE:
return m_args.size() - 1U;
case RCD_DMR_INTERRUPT:
return argsSize - 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 {