{
executeThread = false;
}
else
{
ModbusPalRecord record = new ModbusPalRecord(line);
if( record.getType()==ModbusPalRecord.RECORD_IN )
{
long timestamp = record.getTimestamp();
System.out.println("sleep "+(timestamp-prev_timestamp)+" ms");
if( prev_timestamp != 0 )
{
Thread.sleep( timestamp - prev_timestamp );
}
prev_timestamp = timestamp;
ModbusSlaveAddress slaveId = record.getSlaveID();
byte[] data = record.getData();
int pduLength = processPDU(slaveId, data, 0, record.getDataLength() );
}
}
}
catch (Exception ex)
{