Skip to content

Commit

Permalink
Add the beginnings of mobile hotspot location.
Browse files Browse the repository at this point in the history
  • Loading branch information
g4klx committed Oct 30, 2018
1 parent 52a7f63 commit 66a37d7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
20 changes: 19 additions & 1 deletion DMRNetwork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down
4 changes: 3 additions & 1 deletion DMRNetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ class CDMRNetwork

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);
Expand Down
2 changes: 1 addition & 1 deletion DMRSlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 66a37d7

Please sign in to comment.