mirror of
https://github.com/g4klx/DMRGateway
synced 2025-12-21 13:35:40 +08:00
Reformat the latitude and longitude values.
This commit is contained in:
@@ -2360,13 +2360,9 @@ unsigned int CDMRGateway::getConfig(const std::string& name, unsigned char* buff
|
|||||||
{
|
{
|
||||||
assert(buffer != NULL);
|
assert(buffer != NULL);
|
||||||
|
|
||||||
char latitude[20U];
|
|
||||||
float lat = m_conf.getInfoLatitude();
|
float lat = m_conf.getInfoLatitude();
|
||||||
::sprintf(latitude, "%08f", lat);
|
|
||||||
|
|
||||||
char longitude[20U];
|
|
||||||
float lon = m_conf.getInfoLongitude();
|
float lon = m_conf.getInfoLongitude();
|
||||||
::sprintf(longitude, "%09f", lon);
|
|
||||||
|
|
||||||
int height = m_conf.getInfoHeight();
|
int height = m_conf.getInfoHeight();
|
||||||
if (height > 999)
|
if (height > 999)
|
||||||
@@ -2376,9 +2372,9 @@ unsigned int CDMRGateway::getConfig(const std::string& name, unsigned char* buff
|
|||||||
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, "%8.8s%9.9s%9.9s%2.2s%2.2s%8.8s%9.9s%03d%-20.20s%-19.19s%c%-124.124s%40.40s%40.40s",
|
::sprintf((char*)buffer, "%8.8s%9.9s%9.9s%2.2s%2.2s%+08.4f%+09.4f%03d%-20.20s%-19.19s%c%-124.124s%40.40s%40.40s",
|
||||||
m_config + 0U, m_config + 8U, m_config + 17U, m_config + 26U, m_config + 28U,
|
m_config + 0U, m_config + 8U, m_config + 17U, m_config + 26U, m_config + 28U,
|
||||||
latitude, longitude, height, location.c_str(),
|
lat, lon, height, location.c_str(),
|
||||||
description.c_str(), m_config[30U], url.c_str(), m_config + 31U, m_config + 71U);
|
description.c_str(), m_config[30U], url.c_str(), m_config + 31U, m_config + 71U);
|
||||||
|
|
||||||
m_callsign = std::string((char*)m_config + 0U, 8U);
|
m_callsign = std::string((char*)m_config + 0U, 8U);
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ bool CDMRNetwork::writeHomePosition(float latitude, float longitude)
|
|||||||
|
|
||||||
::memcpy(buffer + 4U, m_id, 4U);
|
::memcpy(buffer + 4U, m_id, 4U);
|
||||||
|
|
||||||
::sprintf(buffer + 8U, "%08f%09f", latitude, longitude);
|
::sprintf(buffer + 8U, "%+08.4f%+09.4f", latitude, longitude);
|
||||||
|
|
||||||
return write((unsigned char*)buffer, 25U);
|
return write((unsigned char*)buffer, 25U);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user