Add the status ack to D-Star.

This commit is contained in:
Jonathan Naylor
2016-02-01 20:49:52 +00:00
parent 279a709793
commit 2947888cad
10 changed files with 270 additions and 50 deletions

View File

@@ -40,16 +40,21 @@ m_outId(0U),
m_outSeq(0U),
m_inId(0U),
m_buffer(1000U),
m_pollTimer(1000U, 60U)
m_pollTimer(1000U, 60U),
m_linkStatus(LS_NONE),
m_linkReflector(NULL)
{
m_address = CUDPSocket::lookup(gatewayAddress);
m_linkReflector = new unsigned char[DSTAR_LONG_CALLSIGN_LENGTH];
CStopWatch stopWatch;
::srand(stopWatch.start());
}
CDStarNetwork::~CDStarNetwork()
{
delete[] m_linkReflector;
}
bool CDStarNetwork::open()
@@ -200,6 +205,10 @@ void CDStarNetwork::clock(unsigned int ms)
switch (buffer[4]) {
case 0x00U: // NETWORK_TEXT;
m_linkStatus = LINK_STATUS(buffer[25U]);
::memcpy(m_linkReflector, buffer + 26U, DSTAR_LONG_CALLSIGN_LENGTH);
return;
case 0x01U: // NETWORK_TEMPTEXT;
case 0x04U: // NETWORK_STATUS1..5
case 0x24U: // NETWORK_DD_DATA
@@ -296,3 +305,12 @@ void CDStarNetwork::enable(bool enabled)
{
m_enabled = enabled;
}
void CDStarNetwork::getStatus(LINK_STATUS& status, unsigned char* reflector)
{
assert(reflector != NULL);
status = m_linkStatus;
::memcpy(reflector, m_linkReflector, DSTAR_LONG_CALLSIGN_LENGTH);
}