Identify an MMDVM in DMO mode for DMR network reporting.

This commit is contained in:
Jonathan Naylor 2016-09-05 17:40:43 +01:00
parent d6466f6e94
commit d84b3cbd7d
6 changed files with 41 additions and 6 deletions

View file

@ -31,7 +31,7 @@ const unsigned int BUFFER_LENGTH = 500U;
const unsigned int HOMEBREW_DATA_PACKET_LENGTH = 55U;
CDMRIPSC::CDMRIPSC(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, bool duplex, const char* version, bool debug, bool slot1, bool slot2, bool rssi) :
CDMRIPSC::CDMRIPSC(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, bool duplex, const char* version, bool debug, bool slot1, bool slot2, bool rssi, HW_TYPE hwType) :
m_address(),
m_port(port),
m_id(NULL),
@ -44,6 +44,7 @@ m_enabled(false),
m_slot1(slot1),
m_slot2(slot2),
m_rssi(rssi),
m_hwType(hwType),
m_status(WAITING_CONNECT),
m_retryTimer(1000U, 10U),
m_timeoutTimer(1000U, 60U),
@ -461,8 +462,19 @@ bool CDMRIPSC::writeConfig()
else if (!m_slot1 && m_slot2)
slots = '2';
} else {
software = "MMDVM_DVMega";
slots = '4';
switch (m_hwType) {
case HWT_MMDVM:
software = "MMDVM_DMO";
break;
case HWT_DVMEGA:
software = "MMDVM_DVMega";
break;
default:
software = "MMDVM_Unknown";
break;
}
}
char buffer[400U];

View file

@ -23,6 +23,7 @@
#include "Timer.h"
#include "RingBuffer.h"
#include "DMRData.h"
#include "Defines.h"
#include <string>
#include <cstdint>
@ -30,7 +31,7 @@
class CDMRIPSC
{
public:
CDMRIPSC(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, bool duplex, const char* version, bool debug, bool slot1, bool slot2, bool rssi);
CDMRIPSC(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, bool duplex, const char* version, bool debug, bool slot1, bool slot2, bool rssi, HW_TYPE hwType);
~CDMRIPSC();
void setConfig(const std::string& callsign, unsigned int rxFrequency, unsigned int txFrequency, unsigned int power, unsigned int colorCode, float latitude, float longitude, int height, const std::string& location, const std::string& description, const std::string& url);
@ -62,6 +63,7 @@ private:
bool m_slot1;
bool m_slot2;
bool m_rssi;
HW_TYPE m_hwType;
enum STATUS {
WAITING_CONNECT,

View file

@ -31,6 +31,12 @@ const unsigned char TAG_DATA = 0x01U;
const unsigned char TAG_LOST = 0x02U;
const unsigned char TAG_EOT = 0x03U;
enum HW_TYPE {
HWT_MMDVM,
HWT_DVMEGA,
HWT_UNKNOWN
};
enum RPT_RF_STATE {
RS_RF_LISTENING,
RS_RF_LATE_ENTRY,

View file

@ -759,6 +759,7 @@ bool CMMDVMHost::createDMRNetwork()
bool slot1 = m_conf.getDMRNetworkSlot1();
bool slot2 = m_conf.getDMRNetworkSlot2();
bool rssi = m_conf.getDMRNetworkRSSI();
HW_TYPE hwType = m_modem->getHWType();
LogInfo("DMR Network Parameters");
LogInfo(" Address: %s", address.c_str());
@ -771,7 +772,7 @@ bool CMMDVMHost::createDMRNetwork()
LogInfo(" Slot 2: %s", slot2 ? "enabled" : "disabled");
LogInfo(" RSSI: %s", rssi ? "enabled" : "disabled");
m_dmrNetwork = new CDMRIPSC(address, port, local, id, password, m_duplex, VERSION, debug, slot1, slot2, rssi);
m_dmrNetwork = new CDMRIPSC(address, port, local, id, password, m_duplex, VERSION, debug, slot1, slot2, rssi, hwType);
unsigned int rxFrequency = m_conf.getRxFrequency();
unsigned int txFrequency = m_conf.getTxFrequency();

View file

@ -19,7 +19,6 @@
#include "DStarDefines.h"
#include "DMRDefines.h"
#include "YSFDefines.h"
#include "Defines.h"
#include "Thread.h"
#include "Modem.h"
#include "Utils.h"
@ -117,7 +116,8 @@ m_dmrSpace2(0U),
m_ysfSpace(0U),
m_tx(false),
m_lockout(false),
m_error(false)
m_error(false),
m_hwType(HWT_UNKNOWN)
{
assert(!port.empty());
@ -741,6 +741,11 @@ bool CModem::readVersion()
CThread::sleep(10U);
RESP_TYPE_MMDVM resp = getResponse();
if (resp == RTM_OK && m_buffer[2U] == MMDVM_GET_VERSION) {
if (::memcmp(m_buffer + 4U, "MMDVM", 5U) == 0)
m_hwType = HWT_MMDVM;
else if (::memcmp(m_buffer + 4U, "DVMEGA", 6U) == 0)
m_hwType = HWT_DVMEGA;
LogInfo("MMDVM protocol version: %u, description: %.*s", m_buffer[3U], m_length - 4U, m_buffer + 4U);
return true;
}
@ -1016,6 +1021,11 @@ RESP_TYPE_MMDVM CModem::getResponse()
}
}
HW_TYPE CModem::getHWType() const
{
return m_hwType;
}
bool CModem::setMode(unsigned char mode)
{
unsigned char buffer[4U];

View file

@ -21,6 +21,7 @@
#include "SerialController.h"
#include "RingBuffer.h"
#include "Defines.h"
#include "Timer.h"
#include <string>
@ -71,6 +72,8 @@ public:
bool sendCWId(const std::string& callsign);
HW_TYPE getHWType() const;
void clock(unsigned int ms);
void close();
@ -117,6 +120,7 @@ private:
bool m_tx;
bool m_lockout;
bool m_error;
HW_TYPE m_hwType;
bool readVersion();
bool readStatus();