Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions reflector/Configure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
#define JIPADDRESSES "IP Addresses"
#define JIPV4BINDING "IPv4Binding"
#define JIPV4EXTERNAL "IPv4External"
#define JIMRS "IMRS"
#define JIPV6BINDING "IPv6Binding"
#define JIPV6EXTERNAL "IPv6External"
#define JJSONPATH "JsonPath"
Expand Down Expand Up @@ -191,6 +192,8 @@ bool CConfigure::ReadData(const std::string &path)
section = ESection::dextra;
else if (0 == hname.compare(JG3))
section = ESection::g3;
else if (0 == hname.compare(JIMRS))
section = ESection::imrs;
else if (0 == hname.compare(JDMRPLUS))
section = ESection::dmrplus;
else if (0 == hname.compare(JMMDVM))
Expand Down Expand Up @@ -353,6 +356,14 @@ bool CConfigure::ReadData(const std::string &path)
else
badParam(key);
break;
case ESection::imrs:
if (0 == key.compare(JENABLE))
data[g_Keys.imrs.enable] = IS_TRUE(value[0]);
else if (0 == key.compare(JPORT))
data[g_Keys.imrs.port] = getUnsigned(value, "IMRS Port", 1024, 65535, 21110);
else
badParam(key);
break;
case ESection::dmrplus:
if (0 == key.compare(JPORT))
data[g_Keys.dmrplus.port] = getUnsigned(value, "DMRPlus Port", 1024, 65535, 8880);
Expand Down
2 changes: 1 addition & 1 deletion reflector/Configure.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

enum class ErrorLevel { fatal, mild };
enum class ERefreshType { file, http, both };
enum class ESection { none, names, ip, modules, urf, dplus, dextra, dcs, g3, dmrplus, mmdvm, nxdn, bm, ysf, p25, m17, usrp, dmrid, nxdnid, ysffreq, files, tc };
enum class ESection { none, names, ip, modules, urf, dplus, dextra, dcs, g3, imrs, dmrplus, mmdvm, nxdn, bm, ysf, p25, m17, usrp, dmrid, nxdnid, ysffreq, files, tc };

#define IS_TRUE(a) ((a)=='t' || (a)=='T' || (a)=='1')

Expand Down
8 changes: 7 additions & 1 deletion reflector/Defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

// protocols ---------------------------------------------------

enum class EProtocol { any, none, dextra, dplus, dcs, g3, bm, urf, dmrplus, dmrmmdvm, nxdn, p25, usrp, ysf, m17 };
enum class EProtocol { any, none, dextra, dplus, dcs, g3, imrs, bm, urf, dmrplus, dmrmmdvm, nxdn, p25, usrp, ysf, m17 };

// DExtra
#define DEXTRA_KEEPALIVE_PERIOD 3 // in seconds
Expand Down Expand Up @@ -130,6 +130,12 @@ enum class EProtocol { any, none, dextra, dplus, dcs, g3, bm, urf, dmrplus, dmrm
#define G3_KEEPALIVE_PERIOD 10 // in seconds
#define G3_KEEPALIVE_TIMEOUT 3600 // in seconds, 1 hour

// IMRS
#define IMRS_PORT 21110 // UDP port
#define IMRS_KEEPALIVE_PERIOD 30 // in seconds
#define IMRS_KEEPALIVE_TIMEOUT (IMRS_KEEPALIVE_PERIOD*5) // in seconds
#define IMRS_DEFAULT_MODULE 'B' // default module to link in


////////////////////////////////////////////////////////////////////////////////////////
// macros
Expand Down
26 changes: 26 additions & 0 deletions reflector/ImrsClient.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include "ImrsClient.h"

////////////////////////////////////////////////////////////////////////////////////////
// constructors

CImrsClient::CImrsClient()
{
}

CImrsClient::CImrsClient(const CCallsign &callsign, const CIp &ip, char reflectorModule)
: CClient(callsign, ip, reflectorModule)
{
}

CImrsClient::CImrsClient(const CImrsClient &client)
: CClient(client)
{
}

////////////////////////////////////////////////////////////////////////////////////////
// status

bool CImrsClient::IsAlive(void) const
{
return (m_LastKeepaliveTime.time() < IMRS_KEEPALIVE_TIMEOUT);
}
18 changes: 18 additions & 0 deletions reflector/ImrsClient.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once

#include "Client.h"

////////////////////////////////////////////////////////////////////////////////////////
// class

class CImrsClient : public CClient
{
public:
// constructors
CImrsClient();
CImrsClient(const CCallsign &callsign, const CIp &ip, char reflectorModule = ' ');
CImrsClient(const CImrsClient &client);

// status
virtual bool IsAlive(void) const;
};
Loading