mirror of
https://github.com/g4klx/DMRGateway
synced 2025-12-27 17:35:40 +08:00
Add identification of the DMR Gateway to connected networks.
This commit is contained in:
@@ -997,7 +997,7 @@ bool CDMRGateway::createDMRNetwork1()
|
||||
LogInfo(" Local: random");
|
||||
LogInfo(" Location Data: %s", location ? "yes" : "no");
|
||||
|
||||
m_dmrNetwork1 = new CDMRNetwork(address, port, local, id, password, m_dmr1Name, debug);
|
||||
m_dmrNetwork1 = new CDMRNetwork(address, port, local, id, password, m_dmr1Name, VERSION, debug);
|
||||
|
||||
std::string options = m_conf.getDMRNetwork1Options();
|
||||
if (options.empty())
|
||||
@@ -1124,7 +1124,7 @@ bool CDMRGateway::createDMRNetwork2()
|
||||
LogInfo(" Local: random");
|
||||
LogInfo(" Location Data: %s", location ? "yes" : "no");
|
||||
|
||||
m_dmrNetwork2 = new CDMRNetwork(address, port, local, id, password, m_dmr2Name, debug);
|
||||
m_dmrNetwork2 = new CDMRNetwork(address, port, local, id, password, m_dmr2Name, VERSION, debug);
|
||||
|
||||
std::string options = m_conf.getDMRNetwork2Options();
|
||||
if (options.empty())
|
||||
@@ -1251,7 +1251,7 @@ bool CDMRGateway::createDMRNetwork3()
|
||||
LogInfo(" Local: random");
|
||||
LogInfo(" Location Data: %s", location ? "yes" : "no");
|
||||
|
||||
m_dmrNetwork3 = new CDMRNetwork(address, port, local, id, password, m_dmr3Name, debug);
|
||||
m_dmrNetwork3 = new CDMRNetwork(address, port, local, id, password, m_dmr3Name, VERSION, debug);
|
||||
|
||||
std::string options = m_conf.getDMRNetwork3Options();
|
||||
if (options.empty())
|
||||
@@ -1427,7 +1427,7 @@ bool CDMRGateway::linkXLX(unsigned int number)
|
||||
m_xlxConnected = false;
|
||||
m_xlxRelink.stop();
|
||||
|
||||
m_xlxNetwork = new CDMRNetwork(reflector->m_address, m_xlxPort, m_xlxLocal, m_xlxId, m_xlxPassword, "XLX", m_xlxDebug);
|
||||
m_xlxNetwork = new CDMRNetwork(reflector->m_address, m_xlxPort, m_xlxLocal, m_xlxId, m_xlxPassword, "XLX", VERSION, m_xlxDebug);
|
||||
|
||||
unsigned char config[400U];
|
||||
unsigned int len = getConfig("XLX", config);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -31,12 +31,13 @@ const unsigned int BUFFER_LENGTH = 500U;
|
||||
const unsigned int HOMEBREW_DATA_PACKET_LENGTH = 55U;
|
||||
|
||||
|
||||
CDMRNetwork::CDMRNetwork(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, const std::string& name, bool debug) :
|
||||
CDMRNetwork::CDMRNetwork(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, const std::string& name, const char* version, bool debug) :
|
||||
m_address(),
|
||||
m_port(port),
|
||||
m_id(NULL),
|
||||
m_password(password),
|
||||
m_name(name),
|
||||
m_version(version),
|
||||
m_debug(debug),
|
||||
m_socket(local),
|
||||
m_status(WAITING_CONNECT),
|
||||
@@ -54,6 +55,7 @@ m_beacon(false)
|
||||
assert(port > 0U);
|
||||
assert(id > 1000U);
|
||||
assert(!password.empty());
|
||||
assert(version != NULL);
|
||||
|
||||
m_address = CUDPSocket::lookup(address);
|
||||
|
||||
@@ -473,6 +475,12 @@ bool CDMRNetwork::writeConfig()
|
||||
::memcpy(buffer + 4U, m_id, 4U);
|
||||
::memcpy(buffer + 8U, m_configData, m_configLen);
|
||||
|
||||
char software[40U];
|
||||
::sprintf(software, "DMRGateway-%s", m_version);
|
||||
|
||||
::memset(buffer + 222U, ' ', 40U);
|
||||
::memcpy(buffer + 222U, software, ::strlen(software));
|
||||
|
||||
return write((unsigned char*)buffer, m_configLen + 8U);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2015,2016,2017 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,2016,2017,2018 by Jonathan Naylor G4KLX
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -30,7 +30,7 @@
|
||||
class CDMRNetwork
|
||||
{
|
||||
public:
|
||||
CDMRNetwork(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, const std::string& name, bool debug);
|
||||
CDMRNetwork(const std::string& address, unsigned int port, unsigned int local, unsigned int id, const std::string& password, const std::string& name, const char* version, bool debug);
|
||||
~CDMRNetwork();
|
||||
|
||||
void setOptions(const std::string& options);
|
||||
@@ -61,6 +61,7 @@ private:
|
||||
uint8_t* m_id;
|
||||
std::string m_password;
|
||||
std::string m_name;
|
||||
const char* m_version;
|
||||
bool m_debug;
|
||||
CUDPSocket m_socket;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user