Skip to content

Commit 1e03fab

Browse files
committed
Updating SensorExplorer to version 2.8.0
1 parent ca189c5 commit 1e03fab

9 files changed

Lines changed: 130 additions & 88 deletions

File tree

sensors/Tools/SensorExplorer/Constants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ public static class Constants
244244
public static readonly string[] HumanPresenceSensorPropertyTitles = new string[] {
245245
"IsPresent",
246246
"IsEngaged",
247+
"IsOnlookerPresent",
247248
"Distance (mm)"
248249
};
249250

sensors/Tools/SensorExplorer/Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
3-
<Identity Name="Microsoft.SensorExplorer" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" Version="2.7.0.0" />
3+
<Identity Name="Microsoft.SensorExplorer" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" Version="2.8.0.0" />
44
<mp:PhoneIdentity PhoneProductId="6fc3f92f-5e15-4c38-ac82-1232213dee4c" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
55
<Properties>
66
<DisplayName>SensorExplorer</DisplayName>

sensors/Tools/SensorExplorer/PeriodicTimer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ static class PeriodicTimer
1212
{
1313
private static CoreDispatcher cd = Window.Current.CoreWindow.Dispatcher;
1414
private static ThreadPoolTimer periodicTimerSensorDisplay = null;
15-
private static ThreadPoolTimer periodicTimerMALTScenario1 = null;
1615
private static ThreadPoolTimer periodicTimerMALTScenario2 = null;
1716
private static ThreadPoolTimer periodicTimerDEO = null;
1817
private static ThreadPoolTimer periodicTimerDistance = null;

sensors/Tools/SensorExplorer/Sensor.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ static class Sensor
9595
public static List<HumanPresenceSensor> HumanPresenceSensorList;
9696
public static List<DeviceInformation> HumanPresenceSensorDeviceInfo;
9797
public static List<string[]> HumanPresenceSensorPLD;
98+
public static List<int[]> HumanPresenceSensorCapabilities;
9899
public static List<Inclinometer> InclinometerList;
99100
public static List<DeviceInformation> InclinometerDeviceInfo;
100101
public static List<string[]> InclinometerPLD;
@@ -476,6 +477,7 @@ private static void InitializeLists()
476477
HumanPresenceSensorList= new List<HumanPresenceSensor>();
477478
HumanPresenceSensorDeviceInfo = new List<DeviceInformation>();
478479
HumanPresenceSensorPLD = new List<string[]>();
480+
HumanPresenceSensorCapabilities = new List<int[]>();
479481
InclinometerList = new List<Inclinometer>();
480482
InclinometerDeviceInfo = new List<DeviceInformation>();
481483
InclinometerPLD = new List<string[]>();
@@ -842,6 +844,9 @@ public static async Task<bool> GetDefault(bool getPLD)
842844
{
843845
HumanPresenceSensorPLD.Add(pldInfo);
844846
}
847+
848+
int[] capabilities = { humanPresenceSensor.IsPresenceSupported ? 1 : 0, humanPresenceSensor.IsEngagementSupported ? 1 : 0, humanPresenceSensor.MaxDetectablePersons };
849+
HumanPresenceSensorCapabilities.Add(capabilities);
845850
}
846851
}
847852
}
@@ -1867,6 +1872,7 @@ private static async void EnableHumanPresenceSensor(int index, int totalIndex)
18671872
var deviceProperties = await GetProperties(HumanPresenceSensorDeviceInfo[index]);
18681873
SensorData[totalIndex].AddProperty(deviceId, 0, 0, -1.00f, 0, deviceProperties);
18691874
SensorData[totalIndex].AddPLDProperty(HumanPresenceSensorPLD[index]);
1875+
SensorData[totalIndex].AddPresenceCapabilities(HumanPresenceSensorCapabilities[index]);
18701876
HumanPresenceSensorList[index].ReadingChanged += HumanPresenceSensorReadingChanged;
18711877
}
18721878
catch { }
@@ -1888,7 +1894,8 @@ private async static void HumanPresenceSensorReadingChanged(object sender, Human
18881894
if (SensorData[CurrentId].SensorType == HUMANPRESENCESENSOR)
18891895
{
18901896
HumanPresenceSensorReading reading = e.Reading;
1891-
if (SensorData[CurrentId].AddReading(reading.Timestamp.UtcDateTime, new double[] { Convert.ToDouble(reading.Engagement), Convert.ToDouble(reading.Presence), Convert.ToDouble(reading.DistanceInMillimeters) }))
1897+
1898+
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) }))
18921899
{
18931900
await cd.RunAsync(CoreDispatcherPriority.Normal, () =>
18941901
{

sensors/Tools/SensorExplorer/SensorData.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ public Reading(DateTime timestamp, double[] value)
6060
public uint ReportLatency = 0;
6161
public float LightSensorThreshold = -1.00f;
6262

63+
public bool PresenceSupported = false;
64+
public bool EngagementSupported = false;
65+
public int MaxDetectablePersons = 1;
66+
6367
public SensorData(int sensorType, int totalIndex, string[] property)
6468
{
6569
SensorType = sensorType;
@@ -116,6 +120,16 @@ public void AddPLDProperty(string[] PLD)
116120
}
117121
}
118122

123+
public void AddPresenceCapabilities(int[] capabilities)
124+
{
125+
if (null != capabilities)
126+
{
127+
PresenceSupported = (capabilities[0] != 0);
128+
EngagementSupported = (capabilities[1] != 0);
129+
MaxDetectablePersons = capabilities[2];
130+
}
131+
}
132+
119133
public void UpdateReportInterval(uint reportInterval)
120134
{
121135
if (reportInterval != ReportInterval)

sensors/Tools/SensorExplorer/SensorDisplay.cs

Lines changed: 63 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ class SensorDisplay
9696
"HumanPresenceDetectionType",
9797
"Device ID",
9898
};
99+
private string[] presenceCapabilities = new string[]
100+
{
101+
"PresenceSupported",
102+
"EngagementSupported",
103+
"MaxDetectablePersons",
104+
};
99105
private StackPanel stackPanelBottom = new StackPanel() { Orientation = Orientation.Horizontal };
100106
private StackPanel stackPanelBottomData = new StackPanel() { Orientation = Orientation.Horizontal };
101107
private StackPanel stackPanelBottomRightCol = new StackPanel() { Orientation = Orientation.Vertical };
@@ -124,6 +130,15 @@ class SensorDisplay
124130
private TextBlock[] textBlockPLDName;
125131
private TextBlock[] textBlockPLDValue;
126132

133+
// Presence Capabilities
134+
private Expander expanderPresenceCap = new Expander() { Header = "Presence Capabilities" };
135+
private ScrollViewer scrollViewerPresenceCap = new ScrollViewer() { HorizontalScrollBarVisibility = ScrollBarVisibility.Visible, VerticalScrollBarVisibility = ScrollBarVisibility.Visible };
136+
private StackPanel stackPanelPresenceCap = new StackPanel() { Orientation = Orientation.Horizontal, Margin = new Thickness(20) };
137+
private StackPanel stackPanelPresenceCapName = new StackPanel() { Orientation = Orientation.Vertical, Margin = new Thickness(10, 10, 0, 10) };
138+
private StackPanel stackPanelPresenceCapValue = new StackPanel() { Orientation = Orientation.Vertical, Margin = new Thickness(10) };
139+
private TextBlock[] textBlockPresenceCapName;
140+
private TextBlock[] textBlockPresenceCapValue;
141+
127142
public SensorDisplay(int sensorType, int index, int totalIndex, int minValue, int maxValue, int scale, Color[] color)
128143
{
129144
SensorType = sensorType;
@@ -139,6 +154,9 @@ public SensorDisplay(int sensorType, int index, int totalIndex, int minValue, in
139154
expanderPLD.Content = scrollViewerPLD;
140155
scrollViewerPLD.Content = stackPanelPLD;
141156

157+
expanderPresenceCap.Content = scrollViewerPresenceCap;
158+
scrollViewerPresenceCap.Content = stackPanelPresenceCap;
159+
142160
for (int i = 0; i <= scale; i++)
143161
{
144162
if (sensorType == Sensor.ACTIVITYSENSOR)
@@ -258,6 +276,11 @@ public SensorDisplay(int sensorType, int index, int totalIndex, int minValue, in
258276
stackPanelMaxValue.Children.Add(textBlockMaxValue[i]);
259277
}
260278

279+
if (sensorType == Sensor.HUMANPRESENCESENSOR)
280+
{
281+
stackPanelExpander.Children.Add(expanderPresenceCap);
282+
}
283+
261284
stackPanelExpander.Children.Add(expanderProperty);
262285
stackPanelExpander.Children.Add(expanderPLD);
263286
stackPanelBottom.Children.Add(stackPanelExpander);
@@ -343,6 +366,20 @@ public SensorDisplay(int sensorType, int index, int totalIndex, int minValue, in
343366
stackPanelPLD.Children.Add(stackPanelPLDName);
344367
stackPanelPLD.Children.Add(stackPanelPLDValue);
345368

369+
textBlockPresenceCapName = new TextBlock[presenceCapabilities.Length];
370+
textBlockPresenceCapValue = new TextBlock[textBlockPresenceCapName.Length];
371+
372+
for (int i = 0; i < presenceCapabilities.Length; i++)
373+
{
374+
textBlockPresenceCapName[i] = new TextBlock() { Text = presenceCapabilities[i], HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center };
375+
textBlockPresenceCapValue[i] = new TextBlock() { Text = (i == 0 ? "\r\n" : "") + " -", HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center };
376+
stackPanelPresenceCapName.Children.Add(textBlockPresenceCapName[i]);
377+
stackPanelPresenceCapValue.Children.Add(textBlockPresenceCapValue[i]);
378+
}
379+
380+
stackPanelPresenceCap.Children.Add(stackPanelPresenceCapName);
381+
stackPanelPresenceCap.Children.Add(stackPanelPresenceCapValue);
382+
346383
StackPanelSensor.Children.Add(StackPanelTop);
347384
StackPanelSensor.Children.Add(canvasSensor);
348385
StackPanelSensor.Children.Add(stackPanelBottom);
@@ -370,6 +407,7 @@ public void SetWidth(double width, double height)
370407
canvasSensor.Width = width * 0.7;
371408
scrollViewerProperty.MaxWidth = width * 0.5;
372409
scrollViewerPLD.MaxWidth = width * 0.5;
410+
scrollViewerPresenceCap.MaxWidth = width * 0.5;
373411
}
374412

375413
private void SetFontSize(double fontSize)
@@ -394,6 +432,12 @@ private void SetFontSize(double fontSize)
394432
textBlockPLDValue[i].FontSize = fontSize;
395433
}
396434

435+
for (int i = 0; i < textBlockPresenceCapName.Length; i++)
436+
{
437+
textBlockPresenceCapName[i].FontSize = fontSize;
438+
textBlockPresenceCapValue[i].FontSize = fontSize;
439+
}
440+
397441
TextBlock textBlock = new TextBlock() { Text = "00000000", FontSize = fontSize };
398442
textBlock.Measure(new Size(200, 200)); // Assuming 200x200 is max size of textblock
399443
canvasSensor.Margin = new Thickness(textBlock.DesiredSize.Width, textBlock.DesiredSize.Height, 0, textBlock.DesiredSize.Height * 2);
@@ -406,6 +450,7 @@ public void SetHeight(double height)
406450
canvasSensor.Width = height;
407451
scrollViewerProperty.MaxHeight = height;
408452
scrollViewerPLD.MaxHeight = height;
453+
scrollViewerPresenceCap.MaxHeight = height;
409454
}
410455

411456
public void EnableSensor()
@@ -469,6 +514,13 @@ public void UpdatePLDProperty(SensorData sensorData)
469514
textBlockPLDValue[14].Text = (sensorData.PanelVisible == null) ? "null" : sensorData.PanelVisible;
470515
}
471516

517+
public void UpdatePresenceCapabilities(SensorData sensorData)
518+
{
519+
textBlockPresenceCapValue[0].Text = sensorData.PresenceSupported ? " Yes" : " No";
520+
textBlockPresenceCapValue[1].Text = sensorData.EngagementSupported ? " Yes" : " No";
521+
textBlockPresenceCapValue[2].Text = sensorData.MaxDetectablePersons.ToString();
522+
}
523+
472524
public void UpdateText(SensorData sensorData)
473525
{
474526
try
@@ -478,6 +530,7 @@ public void UpdateText(SensorData sensorData)
478530
{
479531
UpdateProperty(sensorData);
480532
UpdatePLDProperty(sensorData);
533+
UpdatePresenceCapabilities(sensorData);
481534
}
482535

483536
if (StackPanelSensor.Visibility == Visibility.Visible)
@@ -614,26 +667,9 @@ public void UpdateText(SensorData sensorData)
614667
}
615668
else if (sensorData.SensorType == Sensor.HUMANPRESENCESENSOR && sensorData.Property[i] == "IsEngaged")
616669
{
617-
UInt32 engagement = 0;
618-
const UInt32 engagementCapable = 0x02;
619-
620-
try
621-
{
622-
engagement = (UInt32)Sensor.HumanPresenceSensorDeviceInfo[index].Properties[Constants.Properties["PKEY_Sensor_Proximity_SensorCapabilities"]];
623-
}
624-
catch {
625-
engagement = 0;
626-
}
627-
628-
if ((engagement & engagementCapable) != 0)
629-
{
630-
HumanEngagement engagedEnum = (HumanEngagement)sensorData.Readings[index].Value[0];
631-
textBlockValue[i].Text = string.Format(" {0}", engagedEnum);
632-
}
633-
else
634-
{
635-
textBlockValue[i].Text = string.Format(" {0}", "Not Supported");
636-
}
670+
HumanEngagement engagedEnum = (HumanEngagement)sensorData.Readings[index].Value[0];
671+
textBlockValue[i].Text = string.Format(" {0}", engagedEnum);
672+
637673
textBlockMinValue[i].Text = "";
638674
textBlockMaxValue[i].Text = "";
639675
}
@@ -644,6 +680,13 @@ public void UpdateText(SensorData sensorData)
644680
textBlockMinValue[i].Text = "";
645681
textBlockMaxValue[i].Text = "";
646682
}
683+
else if (sensorData.SensorType == Sensor.HUMANPRESENCESENSOR && sensorData.Property[i] == "IsOnlookerPresent")
684+
{
685+
HumanPresence onlookerEnum = (HumanPresence)sensorData.Readings[index].Value[2];
686+
textBlockValue[i].Text = string.Format(" {0}", onlookerEnum);
687+
textBlockMinValue[i].Text = "";
688+
textBlockMaxValue[i].Text = "";
689+
}
647690
else if (sensorData.SensorType == Sensor.ACTIVITYSENSOR)
648691
{
649692
if (sensorData.Readings[index].Value[i] == Sensor.ACTIVITYNONE)

sensors/Tools/SensorExplorer/SensorExplorer.csproj

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<AssemblyName>SensorExplorer</AssemblyName>
1212
<DefaultLanguage>en-US</DefaultLanguage>
1313
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
14-
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.22598.0</TargetPlatformVersion>
15-
<TargetPlatformMinVersion>10.0.22598.0</TargetPlatformMinVersion>
14+
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.26100.0</TargetPlatformVersion>
15+
<TargetPlatformMinVersion>10.0.26100.0</TargetPlatformMinVersion>
1616
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
1717
<FileAlignment>512</FileAlignment>
1818
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
@@ -22,7 +22,7 @@
2222
</NuGetPackageImportStamp>
2323
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
2424
<AppxBundle>Always</AppxBundle>
25-
<AppxBundlePlatforms>x86|x64|arm</AppxBundlePlatforms>
25+
<AppxBundlePlatforms>x86|x64|arm64</AppxBundlePlatforms>
2626
<PackageCertificateThumbprint>
2727
</PackageCertificateThumbprint>
2828
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
@@ -59,31 +59,6 @@
5959
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
6060
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
6161
</PropertyGroup>
62-
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
63-
<DebugSymbols>true</DebugSymbols>
64-
<OutputPath>bin\ARM\Debug\</OutputPath>
65-
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
66-
<NoWarn>;2008</NoWarn>
67-
<DebugType>full</DebugType>
68-
<PlatformTarget>ARM</PlatformTarget>
69-
<UseVSHostingProcess>false</UseVSHostingProcess>
70-
<ErrorReport>prompt</ErrorReport>
71-
<Prefer32Bit>true</Prefer32Bit>
72-
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
73-
</PropertyGroup>
74-
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
75-
<OutputPath>bin\ARM\Release\</OutputPath>
76-
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
77-
<Optimize>true</Optimize>
78-
<NoWarn>;2008</NoWarn>
79-
<DebugType>pdbonly</DebugType>
80-
<PlatformTarget>ARM</PlatformTarget>
81-
<UseVSHostingProcess>false</UseVSHostingProcess>
82-
<ErrorReport>prompt</ErrorReport>
83-
<Prefer32Bit>true</Prefer32Bit>
84-
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
85-
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
86-
</PropertyGroup>
8762
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
8863
<DebugSymbols>true</DebugSymbols>
8964
<OutputPath>bin\x64\Debug\</OutputPath>
@@ -290,15 +265,41 @@
290265
<Choose>
291266
<When Condition="'$(Platform)' == 'x64'" />
292267
<When Condition="'$(Platform)' == 'x86'" />
293-
<When Condition="'$(Platform)' == 'ARM'" />
268+
<When Condition="'$(Platform)' == 'ARM64'" />
294269
</Choose>
295270
<Target Name="SensorWrappersInclusion" AfterTargets="ResolveNuGetPackageAssets">
296-
<PropertyGroup Condition="'$(PkgSensorWrappers_x64)' != '' or '$(PkgSensorWrappers_x86)' != '' or '$(PkgSensorWrappers_ARM)' != ''">
271+
<PropertyGroup Condition="'$(PkgSensorWrappers_x64)' != '' or '$(PkgSensorWrappers_x86)' != '' or '$(PkgSensorWrappers_ARM64)' != ''">
297272
<DefineConstants>$(DefineConstants);SENSORWRAPPERS</DefineConstants>
298273
</PropertyGroup>
299274
</Target>
300275
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
301276
<VisualStudioVersion>14.0</VisualStudioVersion>
302277
</PropertyGroup>
278+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'">
279+
<DebugSymbols>true</DebugSymbols>
280+
<OutputPath>bin\ARM64\Debug\</OutputPath>
281+
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS</DefineConstants>
282+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
283+
<NoWarn>;2008</NoWarn>
284+
<NoStdLib>true</NoStdLib>
285+
<DebugType>full</DebugType>
286+
<PlatformTarget>ARM64</PlatformTarget>
287+
<UseVSHostingProcess>false</UseVSHostingProcess>
288+
<LangVersion>7.3</LangVersion>
289+
<ErrorReport>prompt</ErrorReport>
290+
</PropertyGroup>
291+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM64'">
292+
<OutputPath>bin\ARM64\Release\</OutputPath>
293+
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;CODE_ANALYSIS</DefineConstants>
294+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
295+
<Optimize>true</Optimize>
296+
<NoWarn>;2008</NoWarn>
297+
<NoStdLib>true</NoStdLib>
298+
<DebugType>pdbonly</DebugType>
299+
<PlatformTarget>ARM64</PlatformTarget>
300+
<UseVSHostingProcess>false</UseVSHostingProcess>
301+
<LangVersion>7.3</LangVersion>
302+
<ErrorReport>prompt</ErrorReport>
303+
</PropertyGroup>
303304
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
304305
</Project>

0 commit comments

Comments
 (0)