Skip to content

Commit

Permalink
Add new GPS and TA DMR network messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
g4klx committed May 17, 2017
1 parent 3ab8bdf commit f9e20cd
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
42 changes: 42 additions & 0 deletions DMRNetwork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,48 @@ bool CDMRNetwork::write(const CDMRData& data)
return true;
}

bool CDMRNetwork::writePosition(unsigned int id, const unsigned char* data)
{
if (m_status != RUNNING)
return false;

unsigned char buffer[20U];

::memcpy(buffer + 0U, "DMRG", 4U);

::memcpy(buffer + 4U, m_id, 4U);

buffer[8U] = id >> 16;
buffer[9U] = id >> 8;
buffer[10U] = id >> 0;

::memcpy(buffer + 11U, data + 2U, 7U);

return write(buffer, 18U);
}

bool CDMRNetwork::writeTalkerAlias(unsigned int id, unsigned char type, const unsigned char* data)
{
if (m_status != RUNNING)
return false;

unsigned char buffer[20U];

::memcpy(buffer + 0U, "DMRA", 4U);

::memcpy(buffer + 4U, m_id, 4U);

buffer[8U] = id >> 16;
buffer[9U] = id >> 8;
buffer[10U] = id >> 0;

buffer[11U] = type;

::memcpy(buffer + 12U, data + 2U, 7U);

return write(buffer, 19U);
}

void CDMRNetwork::close()
{
LogMessage("DMR, Closing DMR Network");
Expand Down
4 changes: 4 additions & 0 deletions DMRNetwork.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ class CDMRNetwork

bool write(const CDMRData& data);

bool writePosition(unsigned int id, const unsigned char* data);

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

bool wantsBeacon();

void clock(unsigned int ms);
Expand Down
14 changes: 14 additions & 0 deletions DMRSlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,8 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len)
::sprintf(text, "DMR Slot %u, Embedded GPS Info", m_slotNo);
CUtils::dump(2U, text, data, 9U);
}
if (m_network != NULL)
m_network->writePosition(m_rfLC->getSrcId(), data);
break;
case FLCO_TALKER_ALIAS_HEADER:
if (!(m_rfTalkerId & TALKER_ID_HEADER)) {
Expand All @@ -610,6 +612,9 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len)
CUtils::dump(2U, text, data, 9U);
}

if (m_network != NULL)
m_network->writeTalkerAlias(m_rfLC->getSrcId(), 0U, data);

m_rfTalkerId |= TALKER_ID_HEADER;
}
break;
Expand All @@ -620,6 +625,9 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len)
CUtils::dump(2U, text, data, 9U);
}

if (m_network != NULL)
m_network->writeTalkerAlias(m_rfLC->getSrcId(), 1U, data);

m_rfTalkerId |= TALKER_ID_BLOCK1;
}
break;
Expand All @@ -630,6 +638,9 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len)
CUtils::dump(2U, text, data, 9U);
}

if (m_network != NULL)
m_network->writeTalkerAlias(m_rfLC->getSrcId(), 2U, data);

m_rfTalkerId |= TALKER_ID_BLOCK2;
}
break;
Expand All @@ -640,6 +651,9 @@ bool CDMRSlot::writeModem(unsigned char *data, unsigned int len)
CUtils::dump(2U, text, data, 9U);
}

if (m_network != NULL)
m_network->writeTalkerAlias(m_rfLC->getSrcId(), 3U, data);

m_rfTalkerId |= TALKER_ID_BLOCK3;
}
break;
Expand Down

0 comments on commit f9e20cd

Please sign in to comment.