diff --git a/ADIS_Csharp/RobotLib/Status/DevStatus.cs b/ADIS_Csharp/RobotLib/Status/DevStatus.cs index 44ba3a2..1fe793e 100644 --- a/ADIS_Csharp/RobotLib/Status/DevStatus.cs +++ b/ADIS_Csharp/RobotLib/Status/DevStatus.cs @@ -23,8 +23,14 @@ namespace RobotLib.Status { StatusEventArgs eventArgs = new(message); StatusChanged?.Invoke(this, eventArgs); }else if(fromTopic == TOPIC_STATUS_PRESENT) { - PresentEventArgs presentEventArgs = new(true); - PresentChanged?.Invoke(this, presentEventArgs); + Int16 presentCnt = 0; + if (Int16.TryParse(message, out presentCnt)) { + PresentEventArgs presentEventArgs = new(presentCnt); + PresentChanged?.Invoke(this, presentEventArgs); + } else { + log.Error($"Invalid payload received {message}"); + } + } } diff --git a/ADIS_Csharp/RobotLib/Status/PresentEventArgs.cs b/ADIS_Csharp/RobotLib/Status/PresentEventArgs.cs index c10116f..f6a6054 100644 --- a/ADIS_Csharp/RobotLib/Status/PresentEventArgs.cs +++ b/ADIS_Csharp/RobotLib/Status/PresentEventArgs.cs @@ -6,10 +6,11 @@ using System.Threading.Tasks; namespace RobotLib.Status { public class PresentEventArgs { - public bool Present { get; } + public int Present { get; } - public PresentEventArgs(bool present) { - Present = present; + public PresentEventArgs(int presentCount) { + Present = presentCount; + } } }