mirror of
https://github.com/g4klx/DMRGateway
synced 2025-12-21 21:45:39 +08:00
Move the location to the DMR Gateway from the Host.
This commit is contained in:
8
Conf.cpp
8
Conf.cpp
@@ -63,6 +63,7 @@ m_logFileRoot(),
|
|||||||
m_infoLatitude(0.0F),
|
m_infoLatitude(0.0F),
|
||||||
m_infoLongitude(0.0F),
|
m_infoLongitude(0.0F),
|
||||||
m_infoHeight(0),
|
m_infoHeight(0),
|
||||||
|
m_infoLocation(),
|
||||||
m_infoDescription(),
|
m_infoDescription(),
|
||||||
m_infoURL(),
|
m_infoURL(),
|
||||||
m_dmrNetwork1Enabled(false),
|
m_dmrNetwork1Enabled(false),
|
||||||
@@ -287,6 +288,8 @@ bool CConf::read()
|
|||||||
m_infoLongitude = float(::atof(value));
|
m_infoLongitude = float(::atof(value));
|
||||||
else if (::strcmp(key, "Height") == 0)
|
else if (::strcmp(key, "Height") == 0)
|
||||||
m_infoHeight = ::atoi(value);
|
m_infoHeight = ::atoi(value);
|
||||||
|
else if (::strcmp(key, "Location") == 0)
|
||||||
|
m_infoLocation = value;
|
||||||
else if (::strcmp(key, "Description") == 0)
|
else if (::strcmp(key, "Description") == 0)
|
||||||
m_infoDescription = value;
|
m_infoDescription = value;
|
||||||
else if (::strcmp(key, "URL") == 0)
|
else if (::strcmp(key, "URL") == 0)
|
||||||
@@ -1047,6 +1050,11 @@ int CConf::getInfoHeight() const
|
|||||||
return m_infoHeight;
|
return m_infoHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CConf::getInfoLocation() const
|
||||||
|
{
|
||||||
|
return m_infoLocation;
|
||||||
|
}
|
||||||
|
|
||||||
std::string CConf::getInfoDescription() const
|
std::string CConf::getInfoDescription() const
|
||||||
{
|
{
|
||||||
return m_infoDescription;
|
return m_infoDescription;
|
||||||
|
|||||||
2
Conf.h
2
Conf.h
@@ -103,6 +103,7 @@ public:
|
|||||||
float getInfoLatitude() const;
|
float getInfoLatitude() const;
|
||||||
float getInfoLongitude() const;
|
float getInfoLongitude() const;
|
||||||
int getInfoHeight() const;
|
int getInfoHeight() const;
|
||||||
|
std::string getInfoLocation() const;
|
||||||
std::string getInfoDescription() const;
|
std::string getInfoDescription() const;
|
||||||
std::string getInfoURL() const;
|
std::string getInfoURL() const;
|
||||||
|
|
||||||
@@ -256,6 +257,7 @@ private:
|
|||||||
float m_infoLatitude;
|
float m_infoLatitude;
|
||||||
float m_infoLongitude;
|
float m_infoLongitude;
|
||||||
int m_infoHeight;
|
int m_infoHeight;
|
||||||
|
std::string m_infoLocation;
|
||||||
std::string m_infoDescription;
|
std::string m_infoDescription;
|
||||||
std::string m_infoURL;
|
std::string m_infoURL;
|
||||||
|
|
||||||
|
|||||||
@@ -2360,12 +2360,14 @@ unsigned int CDMRGateway::getConfig(const std::string& name, unsigned char* buff
|
|||||||
if (height > 999)
|
if (height > 999)
|
||||||
height = 999;
|
height = 999;
|
||||||
|
|
||||||
|
std::string location = m_conf.getInfoLocation();
|
||||||
std::string description = m_conf.getInfoDescription();
|
std::string description = m_conf.getInfoDescription();
|
||||||
std::string url = m_conf.getInfoURL();
|
std::string url = m_conf.getInfoURL();
|
||||||
|
|
||||||
::sprintf((char*)buffer, "%30.30s%9.9s%9.9s%03d%-20.20s%-19.19s%c%-124.124s%80.80s",
|
::sprintf((char*)buffer, "%8.8s%9.9s%9.9s%2.2s%2.2s%9.9s%9.9s%03d%-20.20s%-19.19s%c%-124.124s%40.40s%40.40s",
|
||||||
m_config + 0U, latitude, longitude, height, m_config + 30U,
|
m_config + 0U, m_config + 8U, m_config + 17U, m_config + 26U, m_config + 28U,
|
||||||
description.c_str(), m_config[50U], url.c_str(), m_config + 51U);
|
latitude, longitude, height, location.c_str(),
|
||||||
|
description.c_str(), m_config[30U], url.c_str(), m_config + 31U, m_config + 71U);
|
||||||
|
|
||||||
LogInfo("%s: configuration message: %s", name.c_str(), buffer);
|
LogInfo("%s: configuration message: %s", name.c_str(), buffer);
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ Directory=./Audio
|
|||||||
Latitude=0.0
|
Latitude=0.0
|
||||||
Longitude=0.0
|
Longitude=0.0
|
||||||
Height=0
|
Height=0
|
||||||
|
Location=Nowhere
|
||||||
Description=Multi-Mode Repeater
|
Description=Multi-Mode Repeater
|
||||||
URL=www.google.co.uk
|
URL=www.google.co.uk
|
||||||
|
|
||||||
|
|||||||
@@ -534,8 +534,8 @@ bool CDMRNetwork::write(const unsigned char* data, unsigned int length)
|
|||||||
assert(data != NULL);
|
assert(data != NULL);
|
||||||
assert(length > 0U);
|
assert(length > 0U);
|
||||||
|
|
||||||
// if (m_debug)
|
if (m_debug)
|
||||||
// CUtils::dump(1U, "Network Transmitted", data, length);
|
CUtils::dump(1U, "Network Transmitted", data, length);
|
||||||
|
|
||||||
bool ret = m_socket.write(data, length, m_address, m_port);
|
bool ret = m_socket.write(data, length, m_address, m_port);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
|
|||||||
@@ -278,9 +278,11 @@ void CMMDVMNetwork::clock(unsigned int ms)
|
|||||||
} else if (::memcmp(m_buffer, "DMRC", 4U) == 0) {
|
} else if (::memcmp(m_buffer, "DMRC", 4U) == 0) {
|
||||||
m_id = (m_buffer[4U] << 24) | (m_buffer[5U] << 16) | (m_buffer[6U] << 8) | (m_buffer[7U] << 0);
|
m_id = (m_buffer[4U] << 24) | (m_buffer[5U] << 16) | (m_buffer[6U] << 8) | (m_buffer[7U] << 0);
|
||||||
|
|
||||||
m_configLen = length - 8U;
|
if (m_configData == NULL) {
|
||||||
m_configData = new unsigned char[m_configLen];
|
m_configLen = length - 8U;
|
||||||
::memcpy(m_configData, m_buffer + 8U, m_configLen);
|
m_configData = new unsigned char[m_configLen];
|
||||||
|
::memcpy(m_configData, m_buffer + 8U, m_configLen);
|
||||||
|
}
|
||||||
|
|
||||||
m_socket.write((unsigned char*)"DMRP", 4U, m_rptAddress, m_rptPort);
|
m_socket.write((unsigned char*)"DMRP", 4U, m_rptAddress, m_rptPort);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user