Add the beginnings of mobile hotspot location.

This commit is contained in:
Jonathan Naylor 2018-10-30 07:53:11 +00:00
parent 52a7f63cdb
commit 66a37d7d25
3 changed files with 23 additions and 3 deletions

View File

@ -283,7 +283,7 @@ bool CDMRNetwork::write(const CDMRData& data)
return true;
}
bool CDMRNetwork::writePosition(unsigned int id, const unsigned char* data)
bool CDMRNetwork::writeRadioPosition(unsigned int id, const unsigned char* data)
{
if (m_status != RUNNING)
return false;
@ -325,6 +325,24 @@ bool CDMRNetwork::writeTalkerAlias(unsigned int id, unsigned char type, const un
return write(buffer, 19U);
}
bool CDMRNetwork::writeHomePosition(float latitude, float longitude)
{
m_latitude = latitude;
m_longitude = longitude;
if (m_status != RUNNING)
return false;
char buffer[50U];
::memcpy(buffer + 0U, "RPTG", 4U);
::memcpy(buffer + 4U, m_id, 4U);
::sprintf(buffer + 8U, "%08f%09f", latitude, longitude);
return write((unsigned char*)buffer, 25U);
}
void CDMRNetwork::close()
{
LogMessage("DMR, Closing DMR Network");

View File

@ -46,10 +46,12 @@ public:
bool write(const CDMRData& data);
bool writePosition(unsigned int id, const unsigned char* data);
bool writeRadioPosition(unsigned int id, const unsigned char* data);
bool writeTalkerAlias(unsigned int id, unsigned char type, const unsigned char* data);
bool writeHomePosition(float latitude, float longitude);
bool wantsBeacon();
void clock(unsigned int ms);

View File

@ -623,7 +623,7 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len)
logGPSPosition(data);
}
if (m_network != NULL)
m_network->writePosition(m_rfLC->getSrcId(), data);
m_network->writeRadioPosition(m_rfLC->getSrcId(), data);
break;
case FLCO_TALKER_ALIAS_HEADER: