Skip to content

Commit 66a37d7

Browse files
committed
Add the beginnings of mobile hotspot location.
1 parent 52a7f63 commit 66a37d7

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

DMRNetwork.cpp

+19-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ bool CDMRNetwork::write(const CDMRData& data)
283283
return true;
284284
}
285285

286-
bool CDMRNetwork::writePosition(unsigned int id, const unsigned char* data)
286+
bool CDMRNetwork::writeRadioPosition(unsigned int id, const unsigned char* data)
287287
{
288288
if (m_status != RUNNING)
289289
return false;
@@ -325,6 +325,24 @@ bool CDMRNetwork::writeTalkerAlias(unsigned int id, unsigned char type, const un
325325
return write(buffer, 19U);
326326
}
327327

328+
bool CDMRNetwork::writeHomePosition(float latitude, float longitude)
329+
{
330+
m_latitude = latitude;
331+
m_longitude = longitude;
332+
333+
if (m_status != RUNNING)
334+
return false;
335+
336+
char buffer[50U];
337+
338+
::memcpy(buffer + 0U, "RPTG", 4U);
339+
::memcpy(buffer + 4U, m_id, 4U);
340+
341+
::sprintf(buffer + 8U, "%08f%09f", latitude, longitude);
342+
343+
return write((unsigned char*)buffer, 25U);
344+
}
345+
328346
void CDMRNetwork::close()
329347
{
330348
LogMessage("DMR, Closing DMR Network");

DMRNetwork.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ class CDMRNetwork
4646

4747
bool write(const CDMRData& data);
4848

49-
bool writePosition(unsigned int id, const unsigned char* data);
49+
bool writeRadioPosition(unsigned int id, const unsigned char* data);
5050

5151
bool writeTalkerAlias(unsigned int id, unsigned char type, const unsigned char* data);
5252

53+
bool writeHomePosition(float latitude, float longitude);
54+
5355
bool wantsBeacon();
5456

5557
void clock(unsigned int ms);

DMRSlot.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len)
623623
logGPSPosition(data);
624624
}
625625
if (m_network != NULL)
626-
m_network->writePosition(m_rfLC->getSrcId(), data);
626+
m_network->writeRadioPosition(m_rfLC->getSrcId(), data);
627627
break;
628628

629629
case FLCO_TALKER_ALIAS_HEADER:

0 commit comments

Comments
 (0)