private BacnetMstpProtocolTransport.GetMessageStatus ProcessRxStatus(byte[] buffer, ref int offset, int rx)
{
if (rx == -BacnetMstpProtocolTransport.ETIMEDOUT)
{
//drop message
BacnetMstpProtocolTransport.GetMessageStatus status = offset == 0 ? BacnetMstpProtocolTransport.GetMessageStatus.Timeout : BacnetMstpProtocolTransport.GetMessageStatus.SubTimeout;
buffer[0] = 0xFF;
RemoveGarbage(buffer, ref offset);
return status;
}
else if (rx < 0)
{
//drop message
buffer[0] = 0xFF;
RemoveGarbage(buffer, ref offset);
return BacnetMstpProtocolTransport.GetMessageStatus.ConnectionError;
}
else if (rx == 0)
{
//drop message
buffer[0] = 0xFF;
RemoveGarbage(buffer, ref offset);
return BacnetMstpProtocolTransport.GetMessageStatus.ConnectionClose;
}
return BacnetMstpProtocolTransport.GetMessageStatus.Good;
}