diff --git a/sensors/Tools/SensorExplorer/Constants.cs b/sensors/Tools/SensorExplorer/Constants.cs index 5cf442d..4b57e9e 100644 --- a/sensors/Tools/SensorExplorer/Constants.cs +++ b/sensors/Tools/SensorExplorer/Constants.cs @@ -244,6 +244,7 @@ public static class Constants public static readonly string[] HumanPresenceSensorPropertyTitles = new string[] { "IsPresent", "IsEngaged", + "IsOnlookerPresent", "Distance (mm)" }; diff --git a/sensors/Tools/SensorExplorer/Package.appxmanifest b/sensors/Tools/SensorExplorer/Package.appxmanifest index 412ecc6..1e7d49e 100644 --- a/sensors/Tools/SensorExplorer/Package.appxmanifest +++ b/sensors/Tools/SensorExplorer/Package.appxmanifest @@ -1,6 +1,6 @@  - + SensorExplorer diff --git a/sensors/Tools/SensorExplorer/PeriodicTimer.cs b/sensors/Tools/SensorExplorer/PeriodicTimer.cs index 7efadb7..5d386e1 100644 --- a/sensors/Tools/SensorExplorer/PeriodicTimer.cs +++ b/sensors/Tools/SensorExplorer/PeriodicTimer.cs @@ -12,7 +12,6 @@ static class PeriodicTimer { private static CoreDispatcher cd = Window.Current.CoreWindow.Dispatcher; private static ThreadPoolTimer periodicTimerSensorDisplay = null; - private static ThreadPoolTimer periodicTimerMALTScenario1 = null; private static ThreadPoolTimer periodicTimerMALTScenario2 = null; private static ThreadPoolTimer periodicTimerDEO = null; private static ThreadPoolTimer periodicTimerDistance = null; diff --git a/sensors/Tools/SensorExplorer/Sensor.cs b/sensors/Tools/SensorExplorer/Sensor.cs index 81b23b4..2d98177 100644 --- a/sensors/Tools/SensorExplorer/Sensor.cs +++ b/sensors/Tools/SensorExplorer/Sensor.cs @@ -95,6 +95,7 @@ static class Sensor public static List HumanPresenceSensorList; public static List HumanPresenceSensorDeviceInfo; public static List HumanPresenceSensorPLD; + public static List HumanPresenceSensorCapabilities; public static List InclinometerList; public static List InclinometerDeviceInfo; public static List InclinometerPLD; @@ -476,6 +477,7 @@ private static void InitializeLists() HumanPresenceSensorList= new List(); HumanPresenceSensorDeviceInfo = new List(); HumanPresenceSensorPLD = new List(); + HumanPresenceSensorCapabilities = new List(); InclinometerList = new List(); InclinometerDeviceInfo = new List(); InclinometerPLD = new List(); @@ -842,6 +844,9 @@ public static async Task GetDefault(bool getPLD) { HumanPresenceSensorPLD.Add(pldInfo); } + + int[] capabilities = { humanPresenceSensor.IsPresenceSupported ? 1 : 0, humanPresenceSensor.IsEngagementSupported ? 1 : 0, humanPresenceSensor.MaxDetectablePersons }; + HumanPresenceSensorCapabilities.Add(capabilities); } } } @@ -1867,6 +1872,7 @@ private static async void EnableHumanPresenceSensor(int index, int totalIndex) var deviceProperties = await GetProperties(HumanPresenceSensorDeviceInfo[index]); SensorData[totalIndex].AddProperty(deviceId, 0, 0, -1.00f, 0, deviceProperties); SensorData[totalIndex].AddPLDProperty(HumanPresenceSensorPLD[index]); + SensorData[totalIndex].AddPresenceCapabilities(HumanPresenceSensorCapabilities[index]); HumanPresenceSensorList[index].ReadingChanged += HumanPresenceSensorReadingChanged; } catch { } @@ -1888,7 +1894,8 @@ private async static void HumanPresenceSensorReadingChanged(object sender, Human if (SensorData[CurrentId].SensorType == HUMANPRESENCESENSOR) { HumanPresenceSensorReading reading = e.Reading; - if (SensorData[CurrentId].AddReading(reading.Timestamp.UtcDateTime, new double[] { Convert.ToDouble(reading.Engagement), Convert.ToDouble(reading.Presence), Convert.ToDouble(reading.DistanceInMillimeters) })) + + if (SensorData[CurrentId].AddReading(reading.Timestamp.UtcDateTime, new double[] { Convert.ToDouble(reading.Engagement), Convert.ToDouble(reading.Presence), Convert.ToDouble(reading.OnlookerPresence), Convert.ToDouble(reading.DistanceInMillimeters) })) { await cd.RunAsync(CoreDispatcherPriority.Normal, () => { diff --git a/sensors/Tools/SensorExplorer/SensorData.cs b/sensors/Tools/SensorExplorer/SensorData.cs index ae62807..7b7b61a 100644 --- a/sensors/Tools/SensorExplorer/SensorData.cs +++ b/sensors/Tools/SensorExplorer/SensorData.cs @@ -60,6 +60,10 @@ public Reading(DateTime timestamp, double[] value) public uint ReportLatency = 0; public float LightSensorThreshold = -1.00f; + public bool PresenceSupported = false; + public bool EngagementSupported = false; + public int MaxDetectablePersons = 1; + public SensorData(int sensorType, int totalIndex, string[] property) { SensorType = sensorType; @@ -116,6 +120,16 @@ public void AddPLDProperty(string[] PLD) } } + public void AddPresenceCapabilities(int[] capabilities) + { + if (null != capabilities) + { + PresenceSupported = (capabilities[0] != 0); + EngagementSupported = (capabilities[1] != 0); + MaxDetectablePersons = capabilities[2]; + } + } + public void UpdateReportInterval(uint reportInterval) { if (reportInterval != ReportInterval) diff --git a/sensors/Tools/SensorExplorer/SensorDisplay.cs b/sensors/Tools/SensorExplorer/SensorDisplay.cs index 5647116..fe4c663 100644 --- a/sensors/Tools/SensorExplorer/SensorDisplay.cs +++ b/sensors/Tools/SensorExplorer/SensorDisplay.cs @@ -96,6 +96,12 @@ class SensorDisplay "HumanPresenceDetectionType", "Device ID", }; + private string[] presenceCapabilities = new string[] + { + "PresenceSupported", + "EngagementSupported", + "MaxDetectablePersons", + }; private StackPanel stackPanelBottom = new StackPanel() { Orientation = Orientation.Horizontal }; private StackPanel stackPanelBottomData = new StackPanel() { Orientation = Orientation.Horizontal }; private StackPanel stackPanelBottomRightCol = new StackPanel() { Orientation = Orientation.Vertical }; @@ -124,6 +130,15 @@ class SensorDisplay private TextBlock[] textBlockPLDName; private TextBlock[] textBlockPLDValue; + // Presence Capabilities + private Expander expanderPresenceCap = new Expander() { Header = "Presence Capabilities" }; + private ScrollViewer scrollViewerPresenceCap = new ScrollViewer() { HorizontalScrollBarVisibility = ScrollBarVisibility.Visible, VerticalScrollBarVisibility = ScrollBarVisibility.Visible }; + private StackPanel stackPanelPresenceCap = new StackPanel() { Orientation = Orientation.Horizontal, Margin = new Thickness(20) }; + private StackPanel stackPanelPresenceCapName = new StackPanel() { Orientation = Orientation.Vertical, Margin = new Thickness(10, 10, 0, 10) }; + private StackPanel stackPanelPresenceCapValue = new StackPanel() { Orientation = Orientation.Vertical, Margin = new Thickness(10) }; + private TextBlock[] textBlockPresenceCapName; + private TextBlock[] textBlockPresenceCapValue; + public SensorDisplay(int sensorType, int index, int totalIndex, int minValue, int maxValue, int scale, Color[] color) { SensorType = sensorType; @@ -139,6 +154,9 @@ public SensorDisplay(int sensorType, int index, int totalIndex, int minValue, in expanderPLD.Content = scrollViewerPLD; scrollViewerPLD.Content = stackPanelPLD; + expanderPresenceCap.Content = scrollViewerPresenceCap; + scrollViewerPresenceCap.Content = stackPanelPresenceCap; + for (int i = 0; i <= scale; i++) { if (sensorType == Sensor.ACTIVITYSENSOR) @@ -258,6 +276,11 @@ public SensorDisplay(int sensorType, int index, int totalIndex, int minValue, in stackPanelMaxValue.Children.Add(textBlockMaxValue[i]); } + if (sensorType == Sensor.HUMANPRESENCESENSOR) + { + stackPanelExpander.Children.Add(expanderPresenceCap); + } + stackPanelExpander.Children.Add(expanderProperty); stackPanelExpander.Children.Add(expanderPLD); stackPanelBottom.Children.Add(stackPanelExpander); @@ -343,6 +366,20 @@ public SensorDisplay(int sensorType, int index, int totalIndex, int minValue, in stackPanelPLD.Children.Add(stackPanelPLDName); stackPanelPLD.Children.Add(stackPanelPLDValue); + textBlockPresenceCapName = new TextBlock[presenceCapabilities.Length]; + textBlockPresenceCapValue = new TextBlock[textBlockPresenceCapName.Length]; + + for (int i = 0; i < presenceCapabilities.Length; i++) + { + textBlockPresenceCapName[i] = new TextBlock() { Text = presenceCapabilities[i], HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center }; + textBlockPresenceCapValue[i] = new TextBlock() { Text = (i == 0 ? "\r\n" : "") + " -", HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center }; + stackPanelPresenceCapName.Children.Add(textBlockPresenceCapName[i]); + stackPanelPresenceCapValue.Children.Add(textBlockPresenceCapValue[i]); + } + + stackPanelPresenceCap.Children.Add(stackPanelPresenceCapName); + stackPanelPresenceCap.Children.Add(stackPanelPresenceCapValue); + StackPanelSensor.Children.Add(StackPanelTop); StackPanelSensor.Children.Add(canvasSensor); StackPanelSensor.Children.Add(stackPanelBottom); @@ -370,6 +407,7 @@ public void SetWidth(double width, double height) canvasSensor.Width = width * 0.7; scrollViewerProperty.MaxWidth = width * 0.5; scrollViewerPLD.MaxWidth = width * 0.5; + scrollViewerPresenceCap.MaxWidth = width * 0.5; } private void SetFontSize(double fontSize) @@ -394,6 +432,12 @@ private void SetFontSize(double fontSize) textBlockPLDValue[i].FontSize = fontSize; } + for (int i = 0; i < textBlockPresenceCapName.Length; i++) + { + textBlockPresenceCapName[i].FontSize = fontSize; + textBlockPresenceCapValue[i].FontSize = fontSize; + } + TextBlock textBlock = new TextBlock() { Text = "00000000", FontSize = fontSize }; textBlock.Measure(new Size(200, 200)); // Assuming 200x200 is max size of textblock canvasSensor.Margin = new Thickness(textBlock.DesiredSize.Width, textBlock.DesiredSize.Height, 0, textBlock.DesiredSize.Height * 2); @@ -406,6 +450,7 @@ public void SetHeight(double height) canvasSensor.Width = height; scrollViewerProperty.MaxHeight = height; scrollViewerPLD.MaxHeight = height; + scrollViewerPresenceCap.MaxHeight = height; } public void EnableSensor() @@ -469,6 +514,13 @@ public void UpdatePLDProperty(SensorData sensorData) textBlockPLDValue[14].Text = (sensorData.PanelVisible == null) ? "null" : sensorData.PanelVisible; } + public void UpdatePresenceCapabilities(SensorData sensorData) + { + textBlockPresenceCapValue[0].Text = sensorData.PresenceSupported ? " Yes" : " No"; + textBlockPresenceCapValue[1].Text = sensorData.EngagementSupported ? " Yes" : " No"; + textBlockPresenceCapValue[2].Text = sensorData.MaxDetectablePersons.ToString(); + } + public void UpdateText(SensorData sensorData) { try @@ -478,6 +530,7 @@ public void UpdateText(SensorData sensorData) { UpdateProperty(sensorData); UpdatePLDProperty(sensorData); + UpdatePresenceCapabilities(sensorData); } if (StackPanelSensor.Visibility == Visibility.Visible) @@ -614,26 +667,9 @@ public void UpdateText(SensorData sensorData) } else if (sensorData.SensorType == Sensor.HUMANPRESENCESENSOR && sensorData.Property[i] == "IsEngaged") { - UInt32 engagement = 0; - const UInt32 engagementCapable = 0x02; - - try - { - engagement = (UInt32)Sensor.HumanPresenceSensorDeviceInfo[index].Properties[Constants.Properties["PKEY_Sensor_Proximity_SensorCapabilities"]]; - } - catch { - engagement = 0; - } - - if ((engagement & engagementCapable) != 0) - { - HumanEngagement engagedEnum = (HumanEngagement)sensorData.Readings[index].Value[0]; - textBlockValue[i].Text = string.Format(" {0}", engagedEnum); - } - else - { - textBlockValue[i].Text = string.Format(" {0}", "Not Supported"); - } + HumanEngagement engagedEnum = (HumanEngagement)sensorData.Readings[index].Value[0]; + textBlockValue[i].Text = string.Format(" {0}", engagedEnum); + textBlockMinValue[i].Text = ""; textBlockMaxValue[i].Text = ""; } @@ -644,6 +680,13 @@ public void UpdateText(SensorData sensorData) textBlockMinValue[i].Text = ""; textBlockMaxValue[i].Text = ""; } + else if (sensorData.SensorType == Sensor.HUMANPRESENCESENSOR && sensorData.Property[i] == "IsOnlookerPresent") + { + HumanPresence onlookerEnum = (HumanPresence)sensorData.Readings[index].Value[2]; + textBlockValue[i].Text = string.Format(" {0}", onlookerEnum); + textBlockMinValue[i].Text = ""; + textBlockMaxValue[i].Text = ""; + } else if (sensorData.SensorType == Sensor.ACTIVITYSENSOR) { if (sensorData.Readings[index].Value[i] == Sensor.ACTIVITYNONE) diff --git a/sensors/Tools/SensorExplorer/SensorExplorer.csproj b/sensors/Tools/SensorExplorer/SensorExplorer.csproj index 710d5b2..5ced23c 100644 --- a/sensors/Tools/SensorExplorer/SensorExplorer.csproj +++ b/sensors/Tools/SensorExplorer/SensorExplorer.csproj @@ -11,8 +11,8 @@ SensorExplorer en-US UAP - 10.0.22598.0 - 10.0.22598.0 + 10.0.26100.0 + 10.0.26100.0 14 512 {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} @@ -22,7 +22,7 @@ False Always - x86|x64|arm + x86|x64|arm64 False @@ -59,31 +59,6 @@ true true - - true - bin\ARM\Debug\ - DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP - ;2008 - full - ARM - false - prompt - true - true - - - bin\ARM\Release\ - TRACE;NETFX_CORE;WINDOWS_UWP - true - ;2008 - pdbonly - ARM - false - prompt - true - true - true - true bin\x64\Debug\ @@ -290,15 +265,41 @@ - + - + $(DefineConstants);SENSORWRAPPERS 14.0 + + true + bin\ARM64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS + true + ;2008 + true + full + ARM64 + false + 7.3 + prompt + + + bin\ARM64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS + true + true + ;2008 + true + pdbonly + ARM64 + false + 7.3 + prompt + \ No newline at end of file diff --git a/sensors/Tools/SensorExplorer/SensorExplorer.csproj.user b/sensors/Tools/SensorExplorer/SensorExplorer.csproj.user index 46b3190..9ad1939 100644 --- a/sensors/Tools/SensorExplorer/SensorExplorer.csproj.user +++ b/sensors/Tools/SensorExplorer/SensorExplorer.csproj.user @@ -1,37 +1,12 @@  - - 30f105c9-681e-420b-a277-7c086ead8a4e - true - SideloadOnly False - x86|x64|arm + x86|x64|arm64 False - ShowAllFiles - - - 30f105c9-681e-420b-a277-7c086ead8a4e - true - - - {3B476D35-A401-11D2-AAD4-00C04F990171} - true - {3B476D35-A401-11D2-AAD4-00C04F990171} - - - true - true - 30f105c9-681e-420b-a277-7c086ead8a4e - false - true - - - true - 30f105c9-681e-420b-a277-7c086ead8a4e - true + \ No newline at end of file diff --git a/sensors/Tools/SensorExplorer/SensorExplorer.sln b/sensors/Tools/SensorExplorer/SensorExplorer.sln index 06b3151..6e0324f 100644 --- a/sensors/Tools/SensorExplorer/SensorExplorer.sln +++ b/sensors/Tools/SensorExplorer/SensorExplorer.sln @@ -1,28 +1,30 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.32002.261 +# Visual Studio Version 17 +VisualStudioVersion = 17.10.35004.147 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SensorExplorer", "SensorExplorer.csproj", "{6947E094-45DA-44CA-B94F-36C3414D40F9}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 - Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6947E094-45DA-44CA-B94F-36C3414D40F9}.Debug|ARM.ActiveCfg = Debug|ARM + {6947E094-45DA-44CA-B94F-36C3414D40F9}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {6947E094-45DA-44CA-B94F-36C3414D40F9}.Debug|ARM64.Build.0 = Debug|ARM64 + {6947E094-45DA-44CA-B94F-36C3414D40F9}.Debug|ARM64.Deploy.0 = Debug|ARM64 {6947E094-45DA-44CA-B94F-36C3414D40F9}.Debug|x64.ActiveCfg = Debug|x64 {6947E094-45DA-44CA-B94F-36C3414D40F9}.Debug|x64.Build.0 = Debug|x64 {6947E094-45DA-44CA-B94F-36C3414D40F9}.Debug|x64.Deploy.0 = Debug|x64 {6947E094-45DA-44CA-B94F-36C3414D40F9}.Debug|x86.ActiveCfg = Debug|x86 - {6947E094-45DA-44CA-B94F-36C3414D40F9}.Release|ARM.ActiveCfg = Release|ARM - {6947E094-45DA-44CA-B94F-36C3414D40F9}.Release|ARM.Build.0 = Release|ARM - {6947E094-45DA-44CA-B94F-36C3414D40F9}.Release|ARM.Deploy.0 = Release|ARM + {6947E094-45DA-44CA-B94F-36C3414D40F9}.Release|ARM64.ActiveCfg = Release|ARM64 + {6947E094-45DA-44CA-B94F-36C3414D40F9}.Release|ARM64.Build.0 = Release|ARM64 + {6947E094-45DA-44CA-B94F-36C3414D40F9}.Release|ARM64.Deploy.0 = Release|ARM64 {6947E094-45DA-44CA-B94F-36C3414D40F9}.Release|x64.ActiveCfg = Release|x64 {6947E094-45DA-44CA-B94F-36C3414D40F9}.Release|x64.Build.0 = Release|x64 {6947E094-45DA-44CA-B94F-36C3414D40F9}.Release|x64.Deploy.0 = Release|x64