mirror of
https://github.com/g4klx/DMRGateway
synced 2025-12-22 22:45:36 +08:00
Add extra logging.
This commit is contained in:
@@ -882,7 +882,7 @@ bool CDMRGateway::createDMRNetwork1()
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned char config[400U];
|
unsigned char config[400U];
|
||||||
unsigned int len = getConfig(config);
|
unsigned int len = getConfig(m_dmr1Name, config);
|
||||||
|
|
||||||
if (!location)
|
if (!location)
|
||||||
::memcpy(config + 30U, "0.00000000.000000", 17U);
|
::memcpy(config + 30U, "0.00000000.000000", 17U);
|
||||||
@@ -1009,7 +1009,7 @@ bool CDMRGateway::createDMRNetwork2()
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned char config[400U];
|
unsigned char config[400U];
|
||||||
unsigned int len = getConfig(config);
|
unsigned int len = getConfig(m_dmr2Name, config);
|
||||||
|
|
||||||
if (!location)
|
if (!location)
|
||||||
::memcpy(config + 30U, "0.00000000.000000", 17U);
|
::memcpy(config + 30U, "0.00000000.000000", 17U);
|
||||||
@@ -1176,7 +1176,7 @@ bool CDMRGateway::linkXLX(unsigned int number)
|
|||||||
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", m_xlxDebug);
|
||||||
|
|
||||||
unsigned char config[400U];
|
unsigned char config[400U];
|
||||||
unsigned int len = getConfig(config);
|
unsigned int len = getConfig("XLX", config);
|
||||||
|
|
||||||
m_xlxNetwork->setConfig(config, len);
|
m_xlxNetwork->setConfig(config, len);
|
||||||
|
|
||||||
@@ -1263,17 +1263,20 @@ void CDMRGateway::writeXLXLink(unsigned int srcId, unsigned int dstId, CDMRNetwo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CDMRGateway::getConfig(unsigned char* buffer)
|
unsigned int CDMRGateway::getConfig(const std::string& name, unsigned char* buffer)
|
||||||
{
|
{
|
||||||
assert(buffer != NULL);
|
assert(buffer != NULL);
|
||||||
|
|
||||||
bool enabled = m_conf.getInfoEnabled();
|
bool enabled = m_conf.getInfoEnabled();
|
||||||
|
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
|
LogInfo("%s: Using original configuration message: %*s", name.c_str(), m_configLen, m_config);
|
||||||
::memcpy(buffer, m_config, m_configLen);
|
::memcpy(buffer, m_config, m_configLen);
|
||||||
return m_configLen;
|
return m_configLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LogInfo("%s: Original configuration message: %*s", name.c_str(), m_configLen, m_config);
|
||||||
|
|
||||||
char latitude[20U];
|
char latitude[20U];
|
||||||
float lat = m_conf.getInfoLatitude();
|
float lat = m_conf.getInfoLatitude();
|
||||||
::sprintf(latitude, "%08f", lat);
|
::sprintf(latitude, "%08f", lat);
|
||||||
@@ -1300,5 +1303,7 @@ unsigned int CDMRGateway::getConfig(unsigned char* buffer)
|
|||||||
rxFrequency, txFrequency, power, m_config + 28U, latitude, longitude, height, location.c_str(),
|
rxFrequency, txFrequency, power, m_config + 28U, latitude, longitude, height, location.c_str(),
|
||||||
description.c_str(), m_config[89U], url.c_str(), m_config + 214U, m_config + 254U);
|
description.c_str(), m_config[89U], url.c_str(), m_config + 214U, m_config + 254U);
|
||||||
|
|
||||||
|
LogInfo("%s: New configuration message: %s", name.c_str(), buffer);
|
||||||
|
|
||||||
return (unsigned int)::strlen((char*)buffer);
|
return (unsigned int)::strlen((char*)buffer);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ private:
|
|||||||
void unlinkXLX();
|
void unlinkXLX();
|
||||||
void writeXLXLink(unsigned int srcId, unsigned int dstId, CDMRNetwork* network);
|
void writeXLXLink(unsigned int srcId, unsigned int dstId, CDMRNetwork* network);
|
||||||
|
|
||||||
unsigned int getConfig(unsigned char* buffer);
|
unsigned int getConfig(const std::string& name, unsigned char* buffer);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
4
Log.cpp
4
Log.cpp
@@ -93,7 +93,7 @@ void Log(unsigned int level, const char* fmt, ...)
|
|||||||
{
|
{
|
||||||
assert(fmt != NULL);
|
assert(fmt != NULL);
|
||||||
|
|
||||||
char buffer[300U];
|
char buffer[501U];
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
SYSTEMTIME st;
|
SYSTEMTIME st;
|
||||||
::GetSystemTime(&st);
|
::GetSystemTime(&st);
|
||||||
@@ -111,7 +111,7 @@ void Log(unsigned int level, const char* fmt, ...)
|
|||||||
va_list vl;
|
va_list vl;
|
||||||
va_start(vl, fmt);
|
va_start(vl, fmt);
|
||||||
|
|
||||||
::vsprintf(buffer + ::strlen(buffer), fmt, vl);
|
::vsnprintf(buffer + ::strlen(buffer), 500, fmt, vl);
|
||||||
|
|
||||||
va_end(vl);
|
va_end(vl);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user