1
0
Fork 0

Simplify the YCS packet selection logic.

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

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

Loading…
Cancel
Save