mirror of
				https://github.com/ShaYmez/MMDVM_CM.git
				synced 2025-11-03 20:50:21 -05:00 
			
		
		
		
	Add default ID for DMR2NXDN and NXDN2DMR
This commit is contained in:
		
							parent
							
								
									1a1a5f991e
								
							
						
					
					
						commit
						8dc36e0e8c
					
				@ -43,6 +43,7 @@ m_dstAddress(),
 | 
				
			|||||||
m_dstPort(0U),
 | 
					m_dstPort(0U),
 | 
				
			||||||
m_localAddress(),
 | 
					m_localAddress(),
 | 
				
			||||||
m_localPort(0U),
 | 
					m_localPort(0U),
 | 
				
			||||||
 | 
					m_defaultID(65519U),
 | 
				
			||||||
m_daemon(false),
 | 
					m_daemon(false),
 | 
				
			||||||
m_dmrId(0U),
 | 
					m_dmrId(0U),
 | 
				
			||||||
m_dmrRptAddress(),
 | 
					m_dmrRptAddress(),
 | 
				
			||||||
@ -126,6 +127,8 @@ bool CConf::read()
 | 
				
			|||||||
			m_localAddress = value;
 | 
								m_localAddress = value;
 | 
				
			||||||
		else if (::strcmp(key, "LocalPort") == 0)
 | 
							else if (::strcmp(key, "LocalPort") == 0)
 | 
				
			||||||
			m_localPort = (unsigned int)::atoi(value);
 | 
								m_localPort = (unsigned int)::atoi(value);
 | 
				
			||||||
 | 
							else if (::strcmp(key, "DefaultID") == 0)
 | 
				
			||||||
 | 
								m_defaultID = (unsigned int)::atoi(value);
 | 
				
			||||||
		else if (::strcmp(key, "Daemon") == 0)
 | 
							else if (::strcmp(key, "Daemon") == 0)
 | 
				
			||||||
			m_daemon = ::atoi(value) == 1;
 | 
								m_daemon = ::atoi(value) == 1;
 | 
				
			||||||
	} else if (section == SECTION_DMR_NETWORK) {
 | 
						} else if (section == SECTION_DMR_NETWORK) {
 | 
				
			||||||
@ -193,6 +196,11 @@ unsigned int CConf::getLocalPort() const
 | 
				
			|||||||
	return m_localPort;
 | 
						return m_localPort;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					unsigned int CConf::getDefaultID() const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return m_defaultID;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool CConf::getDaemon() const
 | 
					bool CConf::getDaemon() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return m_daemon;
 | 
						return m_daemon;
 | 
				
			||||||
 | 
				
			|||||||
@ -31,12 +31,13 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  bool read();
 | 
					  bool read();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // The YSF Network section
 | 
					  // The NXDN Network section
 | 
				
			||||||
  std::string  getCallsign() const;
 | 
					  std::string  getCallsign() const;
 | 
				
			||||||
  std::string  getDstAddress() const;
 | 
					  std::string  getDstAddress() const;
 | 
				
			||||||
  unsigned int getDstPort() const;
 | 
					  unsigned int getDstPort() const;
 | 
				
			||||||
  std::string  getLocalAddress() const;
 | 
					  std::string  getLocalAddress() const;
 | 
				
			||||||
  unsigned int getLocalPort() const;
 | 
					  unsigned int getLocalPort() const;
 | 
				
			||||||
 | 
					  unsigned int getDefaultID() const;
 | 
				
			||||||
  bool         getDaemon() const;
 | 
					  bool         getDaemon() const;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  // The DMR Network section
 | 
					  // The DMR Network section
 | 
				
			||||||
@ -68,6 +69,7 @@ private:
 | 
				
			|||||||
  unsigned int m_dstPort;
 | 
					  unsigned int m_dstPort;
 | 
				
			||||||
  std::string  m_localAddress;
 | 
					  std::string  m_localAddress;
 | 
				
			||||||
  unsigned int m_localPort;
 | 
					  unsigned int m_localPort;
 | 
				
			||||||
 | 
					  unsigned int m_defaultID;
 | 
				
			||||||
  bool         m_daemon;
 | 
					  bool         m_daemon;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  unsigned int m_dmrId;
 | 
					  unsigned int m_dmrId;
 | 
				
			||||||
 | 
				
			|||||||
@ -121,7 +121,8 @@ m_dmrflco(FLCO_GROUP),
 | 
				
			|||||||
m_dmrinfo(false),
 | 
					m_dmrinfo(false),
 | 
				
			||||||
m_nxdninfo(false),
 | 
					m_nxdninfo(false),
 | 
				
			||||||
m_config(NULL),
 | 
					m_config(NULL),
 | 
				
			||||||
m_configLen(0U)
 | 
					m_configLen(0U),
 | 
				
			||||||
 | 
					m_defaultID(65519U)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	m_nxdnFrame = new unsigned char[200U];
 | 
						m_nxdnFrame = new unsigned char[200U];
 | 
				
			||||||
	m_dmrFrame  = new unsigned char[50U];
 | 
						m_dmrFrame  = new unsigned char[50U];
 | 
				
			||||||
@ -235,6 +236,8 @@ int CDMR2NXDN::run()
 | 
				
			|||||||
	std::string localAddress   = m_conf.getLocalAddress();
 | 
						std::string localAddress   = m_conf.getLocalAddress();
 | 
				
			||||||
	unsigned int localPort     = m_conf.getLocalPort();
 | 
						unsigned int localPort     = m_conf.getLocalPort();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						m_defaultID = m_conf.getDefaultID();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	m_nxdnNetwork = new CNXDNNetwork(localAddress, localPort, gatewayAddress, gatewayPort, false);
 | 
						m_nxdnNetwork = new CNXDNNetwork(localAddress, localPort, gatewayAddress, gatewayPort, false);
 | 
				
			||||||
	m_nxdnNetwork->enable(true);
 | 
						m_nxdnNetwork->enable(true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -755,11 +758,8 @@ unsigned int CDMR2NXDN::truncID(unsigned int id)
 | 
				
			|||||||
	snprintf(temp, 8, "%07d", id);
 | 
						snprintf(temp, 8, "%07d", id);
 | 
				
			||||||
	unsigned int newid = atoi(temp + 2);
 | 
						unsigned int newid = atoi(temp + 2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (newid > 65519)
 | 
						if (newid > 65519 || newid == 0)
 | 
				
			||||||
		newid = 65519;
 | 
							newid = m_defaultID;
 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (newid == 0)
 | 
					 | 
				
			||||||
		newid = 1;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return newid;
 | 
						return newid;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -83,6 +83,7 @@ private:
 | 
				
			|||||||
	bool             m_nxdninfo;
 | 
						bool             m_nxdninfo;
 | 
				
			||||||
	unsigned char*   m_config;
 | 
						unsigned char*   m_config;
 | 
				
			||||||
	unsigned int     m_configLen;
 | 
						unsigned int     m_configLen;
 | 
				
			||||||
 | 
						unsigned int     m_defaultID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	unsigned int findNXDNID(unsigned int dmrid);
 | 
						unsigned int findNXDNID(unsigned int dmrid);
 | 
				
			||||||
	unsigned int findDMRID(unsigned int nxdnid);
 | 
						unsigned int findDMRID(unsigned int nxdnid);
 | 
				
			||||||
 | 
				
			|||||||
@ -3,6 +3,7 @@ GatewayAddress=127.0.0.1
 | 
				
			|||||||
GatewayPort=14020
 | 
					GatewayPort=14020
 | 
				
			||||||
LocalAddress=127.0.0.1
 | 
					LocalAddress=127.0.0.1
 | 
				
			||||||
LocalPort=14021
 | 
					LocalPort=14021
 | 
				
			||||||
 | 
					DefaultID=65519
 | 
				
			||||||
Daemon=0
 | 
					Daemon=0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[DMR Network]
 | 
					[DMR Network]
 | 
				
			||||||
 | 
				
			|||||||
@ -20,6 +20,6 @@
 | 
				
			|||||||
#if !defined(VERSION_H)
 | 
					#if !defined(VERSION_H)
 | 
				
			||||||
#define	VERSION_H
 | 
					#define	VERSION_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char* VERSION = "20180805";
 | 
					const char* VERSION = "20180809";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
@ -45,6 +45,7 @@ m_dstAddress(),
 | 
				
			|||||||
m_dstPort(0U),
 | 
					m_dstPort(0U),
 | 
				
			||||||
m_localAddress(),
 | 
					m_localAddress(),
 | 
				
			||||||
m_localPort(0U),
 | 
					m_localPort(0U),
 | 
				
			||||||
 | 
					m_defaultID(65519U),
 | 
				
			||||||
m_daemon(false),
 | 
					m_daemon(false),
 | 
				
			||||||
m_rxFrequency(0U),
 | 
					m_rxFrequency(0U),
 | 
				
			||||||
m_txFrequency(0U),
 | 
					m_txFrequency(0U),
 | 
				
			||||||
@ -150,6 +151,8 @@ bool CConf::read()
 | 
				
			|||||||
				m_localAddress = value;
 | 
									m_localAddress = value;
 | 
				
			||||||
			else if (::strcmp(key, "LocalPort") == 0)
 | 
								else if (::strcmp(key, "LocalPort") == 0)
 | 
				
			||||||
				m_localPort = (unsigned int)::atoi(value);
 | 
									m_localPort = (unsigned int)::atoi(value);
 | 
				
			||||||
 | 
								else if (::strcmp(key, "DefaultID") == 0)
 | 
				
			||||||
 | 
									m_defaultID = (unsigned int)::atoi(value);
 | 
				
			||||||
			else if (::strcmp(key, "Daemon") == 0)
 | 
								else if (::strcmp(key, "Daemon") == 0)
 | 
				
			||||||
				m_daemon = ::atoi(value) == 1;
 | 
									m_daemon = ::atoi(value) == 1;
 | 
				
			||||||
		} else if (section == SECTION_INFO) {
 | 
							} else if (section == SECTION_INFO) {
 | 
				
			||||||
@ -260,6 +263,11 @@ unsigned int CConf::getLocalPort() const
 | 
				
			|||||||
	return m_localPort;
 | 
						return m_localPort;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					unsigned int CConf::getDefaultID() const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return m_defaultID;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool CConf::getDaemon() const
 | 
					bool CConf::getDaemon() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return m_daemon;
 | 
						return m_daemon;
 | 
				
			||||||
 | 
				
			|||||||
@ -38,6 +38,7 @@ public:
 | 
				
			|||||||
  unsigned int getDstPort() const;
 | 
					  unsigned int getDstPort() const;
 | 
				
			||||||
  std::string  getLocalAddress() const;
 | 
					  std::string  getLocalAddress() const;
 | 
				
			||||||
  unsigned int getLocalPort() const;
 | 
					  unsigned int getLocalPort() const;
 | 
				
			||||||
 | 
					  unsigned int getDefaultID() const;
 | 
				
			||||||
  bool         getDaemon() const;
 | 
					  bool         getDaemon() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // The Info section
 | 
					  // The Info section
 | 
				
			||||||
@ -89,6 +90,7 @@ private:
 | 
				
			|||||||
  unsigned int m_dstPort;
 | 
					  unsigned int m_dstPort;
 | 
				
			||||||
  std::string  m_localAddress;
 | 
					  std::string  m_localAddress;
 | 
				
			||||||
  unsigned int m_localPort;
 | 
					  unsigned int m_localPort;
 | 
				
			||||||
 | 
					  unsigned int m_defaultID;
 | 
				
			||||||
  bool         m_daemon;
 | 
					  bool         m_daemon;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  unsigned int m_rxFrequency;
 | 
					  unsigned int m_rxFrequency;
 | 
				
			||||||
 | 
				
			|||||||
@ -131,7 +131,8 @@ m_nxdninfo(false),
 | 
				
			|||||||
m_xlxmodule(),
 | 
					m_xlxmodule(),
 | 
				
			||||||
m_xlxConnected(false),
 | 
					m_xlxConnected(false),
 | 
				
			||||||
m_xlxReflectors(NULL),
 | 
					m_xlxReflectors(NULL),
 | 
				
			||||||
m_xlxrefl(0U)
 | 
					m_xlxrefl(0U),
 | 
				
			||||||
 | 
					m_defaultID(65519U)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	m_nxdnFrame = new unsigned char[200U];
 | 
						m_nxdnFrame = new unsigned char[200U];
 | 
				
			||||||
	m_dmrFrame  = new unsigned char[50U];
 | 
						m_dmrFrame  = new unsigned char[50U];
 | 
				
			||||||
@ -245,6 +246,8 @@ int CNXDN2DMR::run()
 | 
				
			|||||||
	std::string localAddress = m_conf.getLocalAddress();
 | 
						std::string localAddress = m_conf.getLocalAddress();
 | 
				
			||||||
	unsigned int localPort   = m_conf.getLocalPort();
 | 
						unsigned int localPort   = m_conf.getLocalPort();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						m_defaultID = m_conf.getDefaultID();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	std::string fileName    = m_conf.getDMRXLXFile();
 | 
						std::string fileName    = m_conf.getDMRXLXFile();
 | 
				
			||||||
	m_xlxReflectors = new CReflectors(fileName, 60U);
 | 
						m_xlxReflectors = new CReflectors(fileName, 60U);
 | 
				
			||||||
	m_xlxReflectors->load();
 | 
						m_xlxReflectors->load();
 | 
				
			||||||
@ -786,11 +789,8 @@ unsigned int CNXDN2DMR::truncID(unsigned int id)
 | 
				
			|||||||
	snprintf(temp, 8, "%07d", id);
 | 
						snprintf(temp, 8, "%07d", id);
 | 
				
			||||||
	unsigned int newid = atoi(temp + 2);
 | 
						unsigned int newid = atoi(temp + 2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (newid > 65519)
 | 
						if (newid > 65519 || newid == 0)
 | 
				
			||||||
		newid = 65519;
 | 
							newid = m_defaultID;
 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (newid == 0)
 | 
					 | 
				
			||||||
		newid = 1;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return newid;
 | 
						return newid;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -96,6 +96,7 @@ private:
 | 
				
			|||||||
	bool             m_xlxConnected;
 | 
						bool             m_xlxConnected;
 | 
				
			||||||
	CReflectors*     m_xlxReflectors;
 | 
						CReflectors*     m_xlxReflectors;
 | 
				
			||||||
	unsigned int     m_xlxrefl;
 | 
						unsigned int     m_xlxrefl;
 | 
				
			||||||
 | 
						unsigned int     m_defaultID;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool createDMRNetwork();
 | 
						bool createDMRNetwork();
 | 
				
			||||||
	unsigned int findNXDNID(unsigned int dmrid);
 | 
						unsigned int findNXDNID(unsigned int dmrid);
 | 
				
			||||||
 | 
				
			|||||||
@ -16,6 +16,7 @@ DstAddress=127.0.0.1
 | 
				
			|||||||
DstPort=14050
 | 
					DstPort=14050
 | 
				
			||||||
LocalAddress=127.0.0.1
 | 
					LocalAddress=127.0.0.1
 | 
				
			||||||
LocalPort=42022
 | 
					LocalPort=42022
 | 
				
			||||||
 | 
					DefaultID=65519
 | 
				
			||||||
Daemon=0
 | 
					Daemon=0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[DMR Network]
 | 
					[DMR Network]
 | 
				
			||||||
 | 
				
			|||||||
@ -20,6 +20,6 @@
 | 
				
			|||||||
#if !defined(VERSION_H)
 | 
					#if !defined(VERSION_H)
 | 
				
			||||||
#define	VERSION_H
 | 
					#define	VERSION_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char* VERSION = "20180805";
 | 
					const char* VERSION = "20180809";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user