diff --git a/RS485 Monitor/src/TelegramParser.cs b/RS485 Monitor/src/TelegramParser.cs index ac4ea5d..470b9c3 100644 --- a/RS485 Monitor/src/TelegramParser.cs +++ b/RS485 Monitor/src/TelegramParser.cs @@ -38,6 +38,7 @@ public class TelegramArgs : EventArgs public TelegramArgs(BaseTelegram t) { Telegram = t; + Telegram.Timestamp = DateTime.Now; } } @@ -200,7 +201,7 @@ private void FinishBlock() } // Check if we can convert - if ( tg.Type == BaseTelegram.TelegramType.READ_RESPONSE) + if (tg.Type == BaseTelegram.TelegramType.READ_RESPONSE) { if (tg.Source == 0xAA && tg.Destination == 0x5A && tg.PDU.Length == 10) { diff --git a/RS485 Monitor/src/Telegrams/BaseTelegram.cs b/RS485 Monitor/src/Telegrams/BaseTelegram.cs index 6b5beb5..f8b3011 100644 --- a/RS485 Monitor/src/Telegrams/BaseTelegram.cs +++ b/RS485 Monitor/src/Telegrams/BaseTelegram.cs @@ -57,6 +57,11 @@ public enum TelegramType /// public TelegramType Type { get => (TelegramType)Start; } + /// + /// Timestamp of the telegram + /// + public DateTime Timestamp { get; set; } + #endregion #region Constants