Add DMR network virtualisation.
This commit is contained in:
parent
99d57bf102
commit
72bae08c87
|
@ -21,7 +21,7 @@
|
|||
#include <cassert>
|
||||
#include <algorithm>
|
||||
|
||||
CDMRControl::CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, bool embeddedLCOnly, bool dumpTAData, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blacklist, const std::vector<unsigned int>& whitelist, const std::vector<unsigned int>& slot1TGWhitelist, const std::vector<unsigned int>& slot2TGWhitelist, unsigned int timeout, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssi, unsigned int jitter) :
|
||||
CDMRControl::CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, bool embeddedLCOnly, bool dumpTAData, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blacklist, const std::vector<unsigned int>& whitelist, const std::vector<unsigned int>& slot1TGWhitelist, const std::vector<unsigned int>& slot2TGWhitelist, unsigned int timeout, CModem* modem, IDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssi, unsigned int jitter) :
|
||||
m_id(id),
|
||||
m_colorCode(colorCode),
|
||||
m_modem(modem),
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
class CDMRControl {
|
||||
public:
|
||||
CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, bool embeddedLCOnly, bool dumpTAData, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blacklist, const std::vector<unsigned int>& whitelist, const std::vector<unsigned int>& slot1TGWhitelist, const std::vector<unsigned int>& slot2TGWhitelist, unsigned int timeout, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssi, unsigned int jitter);
|
||||
CDMRControl(unsigned int id, unsigned int colorCode, unsigned int callHang, bool selfOnly, bool embeddedLCOnly, bool dumpTAData, const std::vector<unsigned int>& prefixes, const std::vector<unsigned int>& blacklist, const std::vector<unsigned int>& whitelist, const std::vector<unsigned int>& slot1TGWhitelist, const std::vector<unsigned int>& slot2TGWhitelist, unsigned int timeout, CModem* modem, IDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssi, unsigned int jitter);
|
||||
~CDMRControl();
|
||||
|
||||
bool processWakeup(const unsigned char* data);
|
||||
|
@ -48,7 +48,7 @@ private:
|
|||
unsigned int m_id;
|
||||
unsigned int m_colorCode;
|
||||
CModem* m_modem;
|
||||
CDMRNetwork* m_network;
|
||||
IDMRNetwork* m_network;
|
||||
CDMRSlot m_slot1;
|
||||
CDMRSlot m_slot2;
|
||||
CDMRLookup* m_lookup;
|
||||
|
|
|
@ -30,6 +30,9 @@ const unsigned int BUFFER_LENGTH = 500U;
|
|||
|
||||
const unsigned int HOMEBREW_DATA_PACKET_LENGTH = 55U;
|
||||
|
||||
IDMRNetwork::~IDMRNetwork()
|
||||
{
|
||||
}
|
||||
|
||||
CDMRNetwork::CDMRNetwork(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, HW_TYPE hwType) :
|
||||
m_address(),
|
||||
|
|
48
DMRNetwork.h
48
DMRNetwork.h
|
@ -28,29 +28,53 @@
|
|||
#include <string>
|
||||
#include <cstdint>
|
||||
|
||||
class CDMRNetwork
|
||||
{
|
||||
class IDMRNetwork {
|
||||
public:
|
||||
virtual ~IDMRNetwork() = 0;
|
||||
|
||||
virtual void setOptions(const std::string& options) = 0;
|
||||
|
||||
virtual 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) = 0;
|
||||
|
||||
virtual bool open() = 0;
|
||||
|
||||
virtual void enable(bool enabled) = 0;
|
||||
|
||||
virtual bool read(CDMRData& data) = 0;
|
||||
|
||||
virtual bool write(const CDMRData& data) = 0;
|
||||
|
||||
virtual bool wantsBeacon() = 0;
|
||||
|
||||
virtual void clock(unsigned int ms) = 0;
|
||||
|
||||
virtual void close() = 0;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
class CDMRNetwork : public IDMRNetwork {
|
||||
public:
|
||||
CDMRNetwork(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, HW_TYPE hwType);
|
||||
~CDMRNetwork();
|
||||
virtual ~CDMRNetwork();
|
||||
|
||||
void setOptions(const std::string& options);
|
||||
virtual void setOptions(const std::string& options);
|
||||
|
||||
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);
|
||||
virtual 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);
|
||||
|
||||
bool open();
|
||||
virtual bool open();
|
||||
|
||||
void enable(bool enabled);
|
||||
virtual void enable(bool enabled);
|
||||
|
||||
bool read(CDMRData& data);
|
||||
virtual bool read(CDMRData& data);
|
||||
|
||||
bool write(const CDMRData& data);
|
||||
virtual bool write(const CDMRData& data);
|
||||
|
||||
bool wantsBeacon();
|
||||
virtual bool wantsBeacon();
|
||||
|
||||
void clock(unsigned int ms);
|
||||
virtual void clock(unsigned int ms);
|
||||
|
||||
void close();
|
||||
virtual void close();
|
||||
|
||||
private:
|
||||
in_addr m_address;
|
||||
|
|
|
@ -35,7 +35,7 @@ bool CDMRSlot::m_embeddedLCOnly = false;
|
|||
bool CDMRSlot::m_dumpTAData = true;
|
||||
|
||||
CModem* CDMRSlot::m_modem = NULL;
|
||||
CDMRNetwork* CDMRSlot::m_network = NULL;
|
||||
IDMRNetwork* CDMRSlot::m_network = NULL;
|
||||
CDisplay* CDMRSlot::m_display = NULL;
|
||||
bool CDMRSlot::m_duplex = true;
|
||||
CDMRLookup* CDMRSlot::m_lookup = NULL;
|
||||
|
@ -1683,7 +1683,7 @@ void CDMRSlot::writeQueueNet(const unsigned char *data)
|
|||
m_queue.addData(data, len);
|
||||
}
|
||||
|
||||
void CDMRSlot::init(unsigned int colorCode, bool embeddedLCOnly, bool dumpTAData, unsigned int callHang, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper, unsigned int jitter)
|
||||
void CDMRSlot::init(unsigned int colorCode, bool embeddedLCOnly, bool dumpTAData, unsigned int callHang, CModem* modem, IDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper, unsigned int jitter)
|
||||
{
|
||||
assert(modem != NULL);
|
||||
assert(display != NULL);
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
|
||||
void clock();
|
||||
|
||||
static void init(unsigned int colorCode, bool embeddedLCOnly, bool dumpTAData, unsigned int callHang, CModem* modem, CDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper, unsigned int jitter);
|
||||
static void init(unsigned int colorCode, bool embeddedLCOnly, bool dumpTAData, unsigned int callHang, CModem* modem, IDMRNetwork* network, CDisplay* display, bool duplex, CDMRLookup* lookup, CRSSIInterpolator* rssiMapper, unsigned int jitter);
|
||||
|
||||
private:
|
||||
unsigned int m_slotNo;
|
||||
|
@ -106,7 +106,7 @@ private:
|
|||
static bool m_dumpTAData;
|
||||
|
||||
static CModem* m_modem;
|
||||
static CDMRNetwork* m_network;
|
||||
static IDMRNetwork* m_network;
|
||||
static CDisplay* m_display;
|
||||
static bool m_duplex;
|
||||
static CDMRLookup* m_lookup;
|
||||
|
|
|
@ -44,7 +44,7 @@ private:
|
|||
CConf m_conf;
|
||||
CModem* m_modem;
|
||||
CDStarNetwork* m_dstarNetwork;
|
||||
CDMRNetwork* m_dmrNetwork;
|
||||
IDMRNetwork* m_dmrNetwork;
|
||||
CYSFNetwork* m_ysfNetwork;
|
||||
CP25Network* m_p25Network;
|
||||
CDisplay* m_display;
|
||||
|
|
Loading…
Reference in a new issue