From ed87b9e7f658262050d26a0637a84a22801cf85b Mon Sep 17 00:00:00 2001 From: Tom Early Date: Sat, 20 Nov 2021 08:53:58 -0700 Subject: [PATCH] cleaning up --- reflector/BMClient.h | 2 +- reflector/Callsign.cpp | 2 +- reflector/Callsign.h | 2 +- reflector/DPlusProtocol.cpp | 2 +- reflector/G3Protocol.cpp | 2 +- reflector/Main.h | 2 +- reflector/Protocol.cpp | 2 +- reflector/URFClient.h | 11 ++++------- reflector/URFPeer.cpp | 4 ++-- reflector/URFPeer.h | 7 ------- reflector/XLXClient.h | 14 +------------- reflector/XLXPeer.cpp | 12 +----------- 12 files changed, 15 insertions(+), 47 deletions(-) diff --git a/reflector/BMClient.h b/reflector/BMClient.h index 875abbb..4576368 100644 --- a/reflector/BMClient.h +++ b/reflector/BMClient.h @@ -34,7 +34,7 @@ public: // identity EProtocol GetProtocol(void) const { return EProtocol::xlx; } - EProtoRev GetProtocolRevision(void) const { return EProtoRev::m17; } + EProtoRev GetProtocolRevision(void) const { return EProtoRev::ambe; } const char *GetProtocolName(void) const { return "XLX"; } ECodecType GetCodec(void) const { return ECodecType::dmr; } bool IsPeer(void) const { return true; } diff --git a/reflector/Callsign.cpp b/reflector/Callsign.cpp index 24438e1..2ce6047 100644 --- a/reflector/Callsign.cpp +++ b/reflector/Callsign.cpp @@ -243,7 +243,7 @@ void CCallsign::SetSuffix(const uint8_t *buffer, int len) //////////////////////////////////////////////////////////////////////////////////////// // modify -void CCallsign::PatchCallsign(int off, const uint8_t *patch, int len) +void CCallsign::PatchCallsign(int off, const char *patch, int len) { if ( off < CALLSIGN_LEN ) { diff --git a/reflector/Callsign.h b/reflector/Callsign.h index 8b0412f..ae69ad2 100644 --- a/reflector/Callsign.h +++ b/reflector/Callsign.h @@ -53,7 +53,7 @@ public: void SetSuffix(const uint8_t *, int); // modify - void PatchCallsign(int, const uint8_t *, int); + void PatchCallsign(int, const char *, int); // get void GetCallsign(uint8_t *) const; diff --git a/reflector/DPlusProtocol.cpp b/reflector/DPlusProtocol.cpp index e217be3..260467e 100644 --- a/reflector/DPlusProtocol.cpp +++ b/reflector/DPlusProtocol.cpp @@ -307,7 +307,7 @@ void CDplusProtocol::SendDvHeader(CDvHeaderPacket *packet, CDplusClient *client) // clone the packet and patch it CDvHeaderPacket packet2(*((CDvHeaderPacket *)packet)); CCallsign rpt2 = packet2.GetRpt2Callsign(); - rpt2.PatchCallsign(0, (const uint8_t *)"XRF", 3); + rpt2.PatchCallsign(0, "XRF", 3); packet2.SetRpt2Callsign(rpt2); // encode it diff --git a/reflector/G3Protocol.cpp b/reflector/G3Protocol.cpp index 5c947c8..dc5a821 100644 --- a/reflector/G3Protocol.cpp +++ b/reflector/G3Protocol.cpp @@ -43,7 +43,7 @@ bool CG3Protocol::Initialize(const char */*type*/, const EProtocol /*type*/, con keep_running = true; // update the reflector callsign - //m_ReflectorCallsign.PatchCallsign(0, (const uint8_t *)"XLX", 3); + //m_ReflectorCallsign.PatchCallsign(0, "XLX", 3); // create our sockets CIp ip(AF_INET, G3_DV_PORT, LISTEN_IPV4); diff --git a/reflector/Main.h b/reflector/Main.h index 09127ba..ce0a832 100644 --- a/reflector/Main.h +++ b/reflector/Main.h @@ -107,7 +107,7 @@ enum class EProtocol { any, none, dextra, dplus, dcs, xlx, urf, dmrplus, dmrmmdv // URF #define URF_PORT 10017 // UDP port #define URF_KEEPALIVE_PERIOD 1 // in seconds -#define URF_KEEPALIVE_TIMEOUT (XLX_KEEPALIVE_PERIOD*30) // in seconds +#define URF_KEEPALIVE_TIMEOUT (URF_KEEPALIVE_PERIOD*30) // in seconds #define URF_RECONNECT_PERIOD 5 // in seconds // DMRPlus (dongle) diff --git a/reflector/Protocol.cpp b/reflector/Protocol.cpp index 9f66a7f..bd7d660 100644 --- a/reflector/Protocol.cpp +++ b/reflector/Protocol.cpp @@ -59,7 +59,7 @@ bool CProtocol::Initialize(const char *type, const EProtocol ptype, const uint16 // update the reflector callsign if (type) - m_ReflectorCallsign.PatchCallsign(0, (const uint8_t *)type, 3); + m_ReflectorCallsign.PatchCallsign(0, type, 3); // create our sockets #ifdef LISTEN_IPV4 diff --git a/reflector/URFClient.h b/reflector/URFClient.h index 89d70ac..99471d3 100644 --- a/reflector/URFClient.h +++ b/reflector/URFClient.h @@ -18,11 +18,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . - #include "Client.h" -enum class EURFProtocol { original }; - class CURFClient : public CClient { public: @@ -35,11 +32,11 @@ public: virtual ~CURFClient() {}; // identity - EProtocol GetProtocol(void) const { return EProtocol::urf; } + EProtocol GetProtocol(void) const { return EProtocol::urf; } EProtoRev GetProtocolRevision(void) const { return m_ProtRev; } - const char *GetProtocolName(void) const { return "URF"; } - ECodecType GetCodec(void) const { return ECodecType::none; }; - bool IsPeer(void) const { return true; } + const char *GetProtocolName(void) const { return "URF"; } + ECodecType GetCodec(void) const { return ECodecType::none; } + bool IsPeer(void) const { return true; } // status bool IsAlive(void) const; diff --git a/reflector/URFPeer.cpp b/reflector/URFPeer.cpp index 970882c..d3a2634 100644 --- a/reflector/URFPeer.cpp +++ b/reflector/URFPeer.cpp @@ -16,13 +16,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "Main.h" #include + +#include "Main.h" #include "Reflector.h" #include "URFPeer.h" #include "URFClient.h" - //////////////////////////////////////////////////////////////////////////////////////// // constructor diff --git a/reflector/URFPeer.h b/reflector/URFPeer.h index cabe679..3f47acc 100644 --- a/reflector/URFPeer.h +++ b/reflector/URFPeer.h @@ -21,13 +21,6 @@ #include "Peer.h" #include "URFClient.h" -//////////////////////////////////////////////////////////////////////////////////////// -// define - - -//////////////////////////////////////////////////////////////////////////////////////// -// class - class CURFPeer : public CPeer { public: diff --git a/reflector/XLXClient.h b/reflector/XLXClient.h index 7bc96c3..79e8ba6 100644 --- a/reflector/XLXClient.h +++ b/reflector/XLXClient.h @@ -18,26 +18,14 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . - #include "Client.h" -//////////////////////////////////////////////////////////////////////////////////////// -// define - -#define XLX_PROTOCOL_REVISION_0 0 // AMBE only, original connect mechanism -#define XLX_PROTOCOL_REVISION_1 1 // AMBE only, revised connect mechanism -#define XLX_PROTOCOL_REVISION_2 2 // Transcoded AMBE+AMBE2 interlink - - -//////////////////////////////////////////////////////////////////////////////////////// -// class - class CXlxClient : public CClient { public: // constructors CXlxClient(); - CXlxClient(const CCallsign &, const CIp &, char = ' ', EProtoRev = EProtoRev::original); + CXlxClient(const CCallsign &, const CIp &, char = ' ', EProtoRev = EProtoRev::ambe); CXlxClient(const CXlxClient &); // destructor diff --git a/reflector/XLXPeer.cpp b/reflector/XLXPeer.cpp index d0eeee8..625436c 100644 --- a/reflector/XLXPeer.cpp +++ b/reflector/XLXPeer.cpp @@ -60,15 +60,5 @@ bool CXlxPeer::IsAlive(void) const EProtoRev CXlxPeer::GetProtocolRevision(const CVersion &version) { - EProtoRev protrev = EProtoRev::original; - - if ( version.IsEqualOrHigherTo(CVersion(2,2,0)) ) - { - protrev = EProtoRev::ambe; - } - else if ( version.IsEqualOrHigherTo(CVersion(1,4,0)) ) - { - protrev = EProtoRev::revised; - } - return protrev; + return EProtoRev::ambe; }