Add new GPS and TA DMR network messages.

This commit is contained in:
Jonathan Naylor
2017-05-17 18:16:08 +01:00
parent 3ab8bdfdc9
commit f9e20cd737
3 changed files with 60 additions and 0 deletions

View File

@@ -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");

View File

@@ -46,6 +46,10 @@ public:
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);

View File

@@ -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)) {
@@ -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;
@@ -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;
@@ -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;
@@ -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;