|
|
@ -39,6 +39,7 @@ m_reflector(),
|
|
|
|
m_buffer(1000U, "FCS Network Buffer"),
|
|
|
|
m_buffer(1000U, "FCS Network Buffer"),
|
|
|
|
m_n(0U),
|
|
|
|
m_n(0U),
|
|
|
|
m_pingTimer(1000U, 0U, 800U),
|
|
|
|
m_pingTimer(1000U, 0U, 800U),
|
|
|
|
|
|
|
|
m_resetTimer(1000U, 1U),
|
|
|
|
m_state(FCS_UNLINKED)
|
|
|
|
m_state(FCS_UNLINKED)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_info = new unsigned char[100U];
|
|
|
|
m_info = new unsigned char[100U];
|
|
|
@ -73,6 +74,7 @@ bool CFCSNetwork::open()
|
|
|
|
void CFCSNetwork::clearDestination()
|
|
|
|
void CFCSNetwork::clearDestination()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_pingTimer.stop();
|
|
|
|
m_pingTimer.stop();
|
|
|
|
|
|
|
|
m_resetTimer.stop();
|
|
|
|
|
|
|
|
|
|
|
|
m_state = FCS_UNLINKED;
|
|
|
|
m_state = FCS_UNLINKED;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -134,6 +136,18 @@ void CFCSNetwork::writeUnlink(unsigned int count)
|
|
|
|
|
|
|
|
|
|
|
|
void CFCSNetwork::clock(unsigned int ms)
|
|
|
|
void CFCSNetwork::clock(unsigned int ms)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
m_pingTimer.clock(ms);
|
|
|
|
|
|
|
|
if (m_pingTimer.isRunning() && m_pingTimer.hasExpired()) {
|
|
|
|
|
|
|
|
writePing();
|
|
|
|
|
|
|
|
m_pingTimer.start();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_resetTimer.clock(ms);
|
|
|
|
|
|
|
|
if (m_resetTimer.isRunning() && m_resetTimer.hasExpired()) {
|
|
|
|
|
|
|
|
m_n = 0U;
|
|
|
|
|
|
|
|
m_resetTimer.stop();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unsigned char buffer[BUFFER_LENGTH];
|
|
|
|
unsigned char buffer[BUFFER_LENGTH];
|
|
|
|
|
|
|
|
|
|
|
|
in_addr address;
|
|
|
|
in_addr address;
|
|
|
@ -145,12 +159,6 @@ void CFCSNetwork::clock(unsigned int ms)
|
|
|
|
if (m_state == FCS_UNLINKED)
|
|
|
|
if (m_state == FCS_UNLINKED)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
m_pingTimer.clock(ms);
|
|
|
|
|
|
|
|
if (m_pingTimer.isRunning() && m_pingTimer.hasExpired()) {
|
|
|
|
|
|
|
|
writePing();
|
|
|
|
|
|
|
|
m_pingTimer.start();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (address.s_addr != m_address.s_addr || port != FCS_PORT)
|
|
|
|
if (address.s_addr != m_address.s_addr || port != FCS_PORT)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
@ -197,6 +205,8 @@ unsigned int CFCSNetwork::read(unsigned char* data)
|
|
|
|
return 14U;
|
|
|
|
return 14U;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_resetTimer.start();
|
|
|
|
|
|
|
|
|
|
|
|
unsigned char buffer[130U];
|
|
|
|
unsigned char buffer[130U];
|
|
|
|
m_buffer.getData(buffer, len);
|
|
|
|
m_buffer.getData(buffer, len);
|
|
|
|
|
|
|
|
|
|
|
|