Add log and screen data from the data when header data is missing.
This commit is contained in:
parent
b2fd2e47b8
commit
e843115928
2 changed files with 49 additions and 57 deletions
105
YSFControl.cpp
105
YSFControl.cpp
|
@ -998,18 +998,13 @@ void CYSFControl::writeNetwork()
|
||||||
if (end)
|
if (end)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (::memcmp(data + 14U, " ", YSF_CALLSIGN_LENGTH) != 0)
|
::memcpy(m_netSource, data + 14U, YSF_CALLSIGN_LENGTH);
|
||||||
::memcpy(m_netSource, data + 14U, YSF_CALLSIGN_LENGTH);
|
::memcpy(m_netDest, data + 24U, YSF_CALLSIGN_LENGTH);
|
||||||
else
|
|
||||||
::memcpy(m_netSource, "??????????", YSF_CALLSIGN_LENGTH);
|
|
||||||
|
|
||||||
if (::memcmp(data + 24U, " ", YSF_CALLSIGN_LENGTH) != 0)
|
if (::memcmp(m_netSource, " ", 10U) != 0 && ::memcmp(m_netDest, " ", 10U) != 0) {
|
||||||
::memcpy(m_netDest, data + 24U, YSF_CALLSIGN_LENGTH);
|
m_display->writeFusion((char*)m_netSource, (char*)m_netDest, "N", (char*)(data + 4U));
|
||||||
else
|
LogMessage("YSF, received network data from %10.10s to %10.10s at %10.10s", m_netSource, m_netDest, data + 4U);
|
||||||
::memcpy(m_netDest, "??????????", YSF_CALLSIGN_LENGTH);
|
}
|
||||||
|
|
||||||
m_display->writeFusion((char*)m_netSource, (char*)m_netDest, "N", (char*)(data + 4U));
|
|
||||||
LogMessage("YSF, received network data from %10.10s to %10.10s at %10.10s", m_netSource, m_netDest, data + 4U);
|
|
||||||
|
|
||||||
m_netTimeoutTimer.start();
|
m_netTimeoutTimer.start();
|
||||||
m_netPayload.reset();
|
m_netPayload.reset();
|
||||||
|
@ -1025,23 +1020,6 @@ void CYSFControl::writeNetwork()
|
||||||
// Check for duplicate frames, if we can
|
// Check for duplicate frames, if we can
|
||||||
if (m_netN == n)
|
if (m_netN == n)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool changed = false;
|
|
||||||
|
|
||||||
if (::memcmp(data + 14U, " ", YSF_CALLSIGN_LENGTH) != 0 && ::memcmp(m_netSource, "??????????", YSF_CALLSIGN_LENGTH) == 0) {
|
|
||||||
::memcpy(m_netSource, data + 14U, YSF_CALLSIGN_LENGTH);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (::memcmp(data + 24U, " ", YSF_CALLSIGN_LENGTH) != 0 && ::memcmp(m_netDest, "??????????", YSF_CALLSIGN_LENGTH) == 0) {
|
|
||||||
::memcpy(m_netDest, data + 24U, YSF_CALLSIGN_LENGTH);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (changed) {
|
|
||||||
m_display->writeFusion((char*)m_netSource, (char*)m_netDest, "N", (char*)(data + 4U));
|
|
||||||
LogMessage("YSF, received network data from %10.10s to %10.10s at %10.10s", m_netSource, m_netDest, data + 4U);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data[33U] = end ? TAG_EOT : TAG_DATA;
|
data[33U] = end ? TAG_EOT : TAG_DATA;
|
||||||
|
@ -1054,6 +1032,12 @@ void CYSFControl::writeNetwork()
|
||||||
unsigned char fn = fich.getFN();
|
unsigned char fn = fich.getFN();
|
||||||
unsigned char ft = fich.getFT();
|
unsigned char ft = fich.getFT();
|
||||||
unsigned char fi = fich.getFI();
|
unsigned char fi = fich.getFI();
|
||||||
|
unsigned char cm = fich.getCM();
|
||||||
|
|
||||||
|
if (::memcmp(m_netDest, " ", YSF_CALLSIGN_LENGTH) == 0) {
|
||||||
|
if (cm == YSF_CM_GROUP1 || cm == YSF_CM_GROUP2)
|
||||||
|
::memcpy(m_netDest, "ALL ", YSF_CALLSIGN_LENGTH);
|
||||||
|
}
|
||||||
|
|
||||||
// Add any DSQ information
|
// Add any DSQ information
|
||||||
fich.setSQL(m_sqlEnabled);
|
fich.setSQL(m_sqlEnabled);
|
||||||
|
@ -1066,15 +1050,10 @@ void CYSFControl::writeNetwork()
|
||||||
|
|
||||||
// Set the downlink callsign
|
// Set the downlink callsign
|
||||||
switch (fi) {
|
switch (fi) {
|
||||||
case YSF_FI_HEADER:
|
case YSF_FI_HEADER: {
|
||||||
m_netPayload.processHeaderData(data + 35U);
|
bool ok = m_netPayload.processHeaderData(data + 35U);
|
||||||
if (::memcmp(m_netSource, "??????????", YSF_CALLSIGN_LENGTH) == 0) {
|
if (ok)
|
||||||
unsigned char* source = m_netPayload.getSource();
|
processNetCallsigns(data);
|
||||||
if (source != NULL) {
|
|
||||||
::memcpy(m_netSource, source, YSF_CALLSIGN_LENGTH);
|
|
||||||
m_display->writeFusion((char*)m_netSource, (char*)m_netDest, "N", (char*)(data + 4U));
|
|
||||||
LogMessage("YSF, received network data from %10.10s to %10.10s at %10.10s", m_netSource, m_netDest, data + 4U);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1085,36 +1064,24 @@ void CYSFControl::writeNetwork()
|
||||||
case YSF_FI_COMMUNICATIONS:
|
case YSF_FI_COMMUNICATIONS:
|
||||||
switch (dt) {
|
switch (dt) {
|
||||||
case YSF_DT_VD_MODE1: {
|
case YSF_DT_VD_MODE1: {
|
||||||
m_netPayload.processVDMode1Data(data + 35U, fn, gateway);
|
bool ok = m_netPayload.processVDMode1Data(data + 35U, fn, gateway);
|
||||||
|
if (ok)
|
||||||
|
processNetCallsigns(data);
|
||||||
|
|
||||||
unsigned int errors = m_netPayload.processVDMode1Audio(data + 35U);
|
unsigned int errors = m_netPayload.processVDMode1Audio(data + 35U);
|
||||||
m_netErrs += errors;
|
m_netErrs += errors;
|
||||||
m_netBits += 235U;
|
m_netBits += 235U;
|
||||||
|
|
||||||
if (::memcmp(m_netSource, "??????????", YSF_CALLSIGN_LENGTH) == 0) {
|
|
||||||
unsigned char* source = m_netPayload.getSource();
|
|
||||||
if (source != NULL) {
|
|
||||||
::memcpy(m_netSource, source, YSF_CALLSIGN_LENGTH);
|
|
||||||
m_display->writeFusion((char*)m_netSource, (char*)m_netDest, "N", (char*)(data + 4U));
|
|
||||||
LogMessage("YSF, received network data from %10.10s to %10.10s at %10.10s", m_netSource, m_netDest, data + 4U);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case YSF_DT_VD_MODE2: {
|
case YSF_DT_VD_MODE2: {
|
||||||
m_netPayload.processVDMode2Data(data + 35U, fn, gateway);
|
bool ok = m_netPayload.processVDMode2Data(data + 35U, fn, gateway);
|
||||||
|
if (ok)
|
||||||
|
processNetCallsigns(data);
|
||||||
|
|
||||||
unsigned int errors = m_netPayload.processVDMode2Audio(data + 35U);
|
unsigned int errors = m_netPayload.processVDMode2Audio(data + 35U);
|
||||||
m_netErrs += errors;
|
m_netErrs += errors;
|
||||||
m_netBits += 135U;
|
m_netBits += 135U;
|
||||||
|
|
||||||
if (::memcmp(m_netSource, "??????????", YSF_CALLSIGN_LENGTH) == 0) {
|
|
||||||
unsigned char* source = m_netPayload.getSource();
|
|
||||||
if (source != NULL) {
|
|
||||||
::memcpy(m_netSource, source, YSF_CALLSIGN_LENGTH);
|
|
||||||
m_display->writeFusion((char*)m_netSource, (char*)m_netDest, "N", (char*)(data + 4U));
|
|
||||||
LogMessage("YSF, received network data from %10.10s to %10.10s at %10.10s", m_netSource, m_netDest, data + 4U);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1271,3 +1238,27 @@ bool CYSFControl::checkCallsign(const unsigned char* callsign) const
|
||||||
{
|
{
|
||||||
return ::memcmp(callsign, m_selfCallsign, ::strlen((char*)m_selfCallsign)) == 0;
|
return ::memcmp(callsign, m_selfCallsign, ::strlen((char*)m_selfCallsign)) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CYSFControl::processNetCallsigns(const unsigned char* data)
|
||||||
|
{
|
||||||
|
assert(data != NULL);
|
||||||
|
|
||||||
|
if (::memcmp(m_netSource, " ", 10U) == 0 || ::memcmp(m_netDest, " ", 10U) == 0) {
|
||||||
|
if (::memcmp(m_netSource, " ", YSF_CALLSIGN_LENGTH) == 0) {
|
||||||
|
unsigned char* source = m_netPayload.getSource();
|
||||||
|
if (source != NULL)
|
||||||
|
::memcpy(m_netSource, source, YSF_CALLSIGN_LENGTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (::memcmp(m_netDest, " ", YSF_CALLSIGN_LENGTH) == 0) {
|
||||||
|
unsigned char* dest = m_netPayload.getDest();
|
||||||
|
if (dest != NULL)
|
||||||
|
::memcpy(m_netDest, dest, YSF_CALLSIGN_LENGTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (::memcmp(m_netSource, " ", 10U) != 0 && ::memcmp(m_netDest, " ", 10U) != 0) {
|
||||||
|
m_display->writeFusion((char*)m_netSource, (char*)m_netDest, "N", (char*)(data + 4U));
|
||||||
|
LogMessage("YSF, received network data from %10.10s to %10.10s at %10.10s", m_netSource, m_netDest, data + 4U);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -105,6 +105,7 @@ private:
|
||||||
void closeFile();
|
void closeFile();
|
||||||
|
|
||||||
bool checkCallsign(const unsigned char* callsign) const;
|
bool checkCallsign(const unsigned char* callsign) const;
|
||||||
|
void processNetCallsigns(const unsigned char* data);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue