mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-22 08:05:49 +08:00
Identify an MMDVM in DMO mode for DMR network reporting.
This commit is contained in:
16
DMRIPSC.cpp
16
DMRIPSC.cpp
@@ -31,7 +31,7 @@ const unsigned int BUFFER_LENGTH = 500U;
|
|||||||
const unsigned int HOMEBREW_DATA_PACKET_LENGTH = 55U;
|
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_address(),
|
||||||
m_port(port),
|
m_port(port),
|
||||||
m_id(NULL),
|
m_id(NULL),
|
||||||
@@ -44,6 +44,7 @@ m_enabled(false),
|
|||||||
m_slot1(slot1),
|
m_slot1(slot1),
|
||||||
m_slot2(slot2),
|
m_slot2(slot2),
|
||||||
m_rssi(rssi),
|
m_rssi(rssi),
|
||||||
|
m_hwType(hwType),
|
||||||
m_status(WAITING_CONNECT),
|
m_status(WAITING_CONNECT),
|
||||||
m_retryTimer(1000U, 10U),
|
m_retryTimer(1000U, 10U),
|
||||||
m_timeoutTimer(1000U, 60U),
|
m_timeoutTimer(1000U, 60U),
|
||||||
@@ -461,8 +462,19 @@ bool CDMRIPSC::writeConfig()
|
|||||||
else if (!m_slot1 && m_slot2)
|
else if (!m_slot1 && m_slot2)
|
||||||
slots = '2';
|
slots = '2';
|
||||||
} else {
|
} else {
|
||||||
software = "MMDVM_DVMega";
|
|
||||||
slots = '4';
|
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];
|
char buffer[400U];
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#include "RingBuffer.h"
|
#include "RingBuffer.h"
|
||||||
#include "DMRData.h"
|
#include "DMRData.h"
|
||||||
|
#include "Defines.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@@ -30,7 +31,7 @@
|
|||||||
class CDMRIPSC
|
class CDMRIPSC
|
||||||
{
|
{
|
||||||
public:
|
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();
|
~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);
|
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_slot1;
|
||||||
bool m_slot2;
|
bool m_slot2;
|
||||||
bool m_rssi;
|
bool m_rssi;
|
||||||
|
HW_TYPE m_hwType;
|
||||||
|
|
||||||
enum STATUS {
|
enum STATUS {
|
||||||
WAITING_CONNECT,
|
WAITING_CONNECT,
|
||||||
|
|||||||
@@ -31,6 +31,12 @@ const unsigned char TAG_DATA = 0x01U;
|
|||||||
const unsigned char TAG_LOST = 0x02U;
|
const unsigned char TAG_LOST = 0x02U;
|
||||||
const unsigned char TAG_EOT = 0x03U;
|
const unsigned char TAG_EOT = 0x03U;
|
||||||
|
|
||||||
|
enum HW_TYPE {
|
||||||
|
HWT_MMDVM,
|
||||||
|
HWT_DVMEGA,
|
||||||
|
HWT_UNKNOWN
|
||||||
|
};
|
||||||
|
|
||||||
enum RPT_RF_STATE {
|
enum RPT_RF_STATE {
|
||||||
RS_RF_LISTENING,
|
RS_RF_LISTENING,
|
||||||
RS_RF_LATE_ENTRY,
|
RS_RF_LATE_ENTRY,
|
||||||
|
|||||||
@@ -759,6 +759,7 @@ bool CMMDVMHost::createDMRNetwork()
|
|||||||
bool slot1 = m_conf.getDMRNetworkSlot1();
|
bool slot1 = m_conf.getDMRNetworkSlot1();
|
||||||
bool slot2 = m_conf.getDMRNetworkSlot2();
|
bool slot2 = m_conf.getDMRNetworkSlot2();
|
||||||
bool rssi = m_conf.getDMRNetworkRSSI();
|
bool rssi = m_conf.getDMRNetworkRSSI();
|
||||||
|
HW_TYPE hwType = m_modem->getHWType();
|
||||||
|
|
||||||
LogInfo("DMR Network Parameters");
|
LogInfo("DMR Network Parameters");
|
||||||
LogInfo(" Address: %s", address.c_str());
|
LogInfo(" Address: %s", address.c_str());
|
||||||
@@ -771,7 +772,7 @@ bool CMMDVMHost::createDMRNetwork()
|
|||||||
LogInfo(" Slot 2: %s", slot2 ? "enabled" : "disabled");
|
LogInfo(" Slot 2: %s", slot2 ? "enabled" : "disabled");
|
||||||
LogInfo(" RSSI: %s", rssi ? "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 rxFrequency = m_conf.getRxFrequency();
|
||||||
unsigned int txFrequency = m_conf.getTxFrequency();
|
unsigned int txFrequency = m_conf.getTxFrequency();
|
||||||
|
|||||||
14
Modem.cpp
14
Modem.cpp
@@ -19,7 +19,6 @@
|
|||||||
#include "DStarDefines.h"
|
#include "DStarDefines.h"
|
||||||
#include "DMRDefines.h"
|
#include "DMRDefines.h"
|
||||||
#include "YSFDefines.h"
|
#include "YSFDefines.h"
|
||||||
#include "Defines.h"
|
|
||||||
#include "Thread.h"
|
#include "Thread.h"
|
||||||
#include "Modem.h"
|
#include "Modem.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
@@ -117,7 +116,8 @@ m_dmrSpace2(0U),
|
|||||||
m_ysfSpace(0U),
|
m_ysfSpace(0U),
|
||||||
m_tx(false),
|
m_tx(false),
|
||||||
m_lockout(false),
|
m_lockout(false),
|
||||||
m_error(false)
|
m_error(false),
|
||||||
|
m_hwType(HWT_UNKNOWN)
|
||||||
{
|
{
|
||||||
assert(!port.empty());
|
assert(!port.empty());
|
||||||
|
|
||||||
@@ -741,6 +741,11 @@ bool CModem::readVersion()
|
|||||||
CThread::sleep(10U);
|
CThread::sleep(10U);
|
||||||
RESP_TYPE_MMDVM resp = getResponse();
|
RESP_TYPE_MMDVM resp = getResponse();
|
||||||
if (resp == RTM_OK && m_buffer[2U] == MMDVM_GET_VERSION) {
|
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);
|
LogInfo("MMDVM protocol version: %u, description: %.*s", m_buffer[3U], m_length - 4U, m_buffer + 4U);
|
||||||
return true;
|
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)
|
bool CModem::setMode(unsigned char mode)
|
||||||
{
|
{
|
||||||
unsigned char buffer[4U];
|
unsigned char buffer[4U];
|
||||||
|
|||||||
4
Modem.h
4
Modem.h
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "SerialController.h"
|
#include "SerialController.h"
|
||||||
#include "RingBuffer.h"
|
#include "RingBuffer.h"
|
||||||
|
#include "Defines.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -71,6 +72,8 @@ public:
|
|||||||
|
|
||||||
bool sendCWId(const std::string& callsign);
|
bool sendCWId(const std::string& callsign);
|
||||||
|
|
||||||
|
HW_TYPE getHWType() const;
|
||||||
|
|
||||||
void clock(unsigned int ms);
|
void clock(unsigned int ms);
|
||||||
|
|
||||||
void close();
|
void close();
|
||||||
@@ -117,6 +120,7 @@ private:
|
|||||||
bool m_tx;
|
bool m_tx;
|
||||||
bool m_lockout;
|
bool m_lockout;
|
||||||
bool m_error;
|
bool m_error;
|
||||||
|
HW_TYPE m_hwType;
|
||||||
|
|
||||||
bool readVersion();
|
bool readVersion();
|
||||||
bool readStatus();
|
bool readStatus();
|
||||||
|
|||||||
Reference in New Issue
Block a user