1
0
Fork 0

Simplify the YCS packet selection logic.

ycs232-kbc
Jonathan Naylor 4 years ago
parent d25f13822d
commit 4c59b42c20

@ -200,15 +200,8 @@ void CYCSNetwork::clock(unsigned int ms)
if (m_debug)
CUtils::dump(1U, "YCS Network Data Received", buffer, length);
// Throw away any options messages
if (::memcmp(buffer, "YSFO", 4U) == 0)
return;
// Throw away any info messages
if (::memcmp(buffer, "YSFI", 4U) == 0)
return;
if (::memcmp(buffer, "YSFP", 4U) == 0 && m_state == DS_LINKING) {
if (::memcmp(buffer, "YSFP", 4U) == 0) {
if (m_state == DS_LINKING) {
LogMessage("Linked to %s", m_name.c_str());
m_state = DS_LINKED;
@ -224,6 +217,12 @@ void CYCSNetwork::clock(unsigned int ms)
m_socket.write(m_info, 80U, m_addr, m_addrLen);
}
unsigned char len = length;
m_buffer.addData(&len, 1U);
m_buffer.addData(buffer, length);
}
if (::memcmp(buffer, "YSFD", 4U) == 0) {
CYSFFICH fich;
bool valid = fich.decode(buffer + 35U);
@ -234,13 +233,13 @@ void CYCSNetwork::clock(unsigned int ms)
unsigned char dgId = fich.getDGId();
if (dgId != m_dgId)
return;
}
unsigned char len = length;
m_buffer.addData(&len, 1U);
m_buffer.addData(buffer, length);
}
}
unsigned int CYCSNetwork::read(unsigned int dgid, unsigned char* data)
{

Loading…
Cancel
Save