Skip to content

Commit 0f7f95c

Browse files
authored
v9.2 release (#204)
* DeviceLab sample * fix GetMrcFileDataAsync * completes implementation of the mixed reality capture api (issue 71) * complete implementation of Holographic Perception Simulation Playback API * implement holographic services API * increase wrapper version to 0.9.2 * Fix failing MRC test
1 parent a01ada0 commit 0f7f95c

File tree

9 files changed

+714
-60
lines changed

9 files changed

+714
-60
lines changed

WindowsDevicePortalWrapper/UnitTestProject/Device-VersionTests/HoloLens/HoloLens_rs1_release.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public void GetMrcStatus_HoloLens_1607()
194194

195195
// Check some known things about this response.
196196
MrcProcessStatus processStatus = getTask.Result.Status;
197-
Assert.AreEqual("Running", processStatus.MrcProcess);
197+
Assert.AreEqual(ProcessStatus.Running, processStatus.MrcProcess);
198198
}
199199

200200
/// <summary>

WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/HoloLens/HolographicOs.cs

Lines changed: 138 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,42 @@ public partial class DevicePortal
2929
/// </summary>
3030
public static readonly string HolographicWebManagementHttpSettingsApi = "api/holographic/os/webmanagement/settings/https";
3131

32+
/// <summary>
33+
/// Enumeration describing the status of a process
34+
/// </summary>
35+
public enum ProcessStatus
36+
{
37+
/// <summary>
38+
/// The process is running
39+
/// </summary>
40+
Running = 0,
41+
42+
/// <summary>
43+
/// The process is stopped
44+
/// </summary>
45+
Stopped
46+
}
47+
48+
/// <summary>
49+
/// Gets the status of the Holographic Services on this HoloLens.
50+
/// </summary>
51+
/// <returns>HolographicServices object describing the state of the Holographic services.</returns>
52+
/// <remarks>This method is only supported on HoloLens.</remarks>
53+
public async Task<HolographicServices> GetHolographicServiceState()
54+
{
55+
if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
56+
{
57+
throw new NotSupportedException("This method is only supported on HoloLens.");
58+
}
59+
60+
return await this.GetAsync<HolographicServices>(HolographicServicesApi);
61+
}
62+
3263
/// <summary>
3364
/// Gets the interpupilary distance registered on the device.
3465
/// </summary>
3566
/// <returns>Interpupilary distance, in millimeters.</returns>
36-
/// <remarks>This method is only supported on HoloLens devices.</remarks>
67+
/// <remarks>This method is only supported on HoloLens.</remarks>
3768
public async Task<float> GetInterPupilaryDistanceAsync()
3869
{
3970
if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -50,7 +81,7 @@ public async Task<float> GetInterPupilaryDistanceAsync()
5081
/// </summary>
5182
/// <param name="httpsRequired">Desired value for HTTPS communication</param>
5283
/// <returns>True if WiFi based communication requires a secure connection, false otherwise.</returns>
53-
/// <remarks>This method is only supported on HoloLens devices.</remarks>
84+
/// <remarks>This method is only supported on HoloLens.</remarks>
5485
public async Task SetIsHttpsRequiredAsync(bool httpsRequired)
5586
{
5687
if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -70,7 +101,7 @@ await this.PostAsync(
70101
/// </summary>
71102
/// <param name="ipd">Interpupilary distance, in millimeters.</param>
72103
/// <returns>Task for tracking the POST call</returns>
73-
/// <remarks>This method is only supported on HoloLens devices.</remarks>
104+
/// <remarks>This method is only supported on HoloLens.</remarks>
74105
public async Task SetInterPupilaryDistanceAsync(float ipd)
75106
{
76107
if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -89,7 +120,7 @@ await this.PostAsync(
89120
/// Gets the WiFi http security requirements for communication with the device.
90121
/// </summary>
91122
/// <returns>True if WiFi based communication requires a secure connection, false otherwise.</returns>
92-
/// <remarks>This method is only supported on HoloLens devices.</remarks>
123+
/// <remarks>This method is only supported on HoloLens.</remarks>
93124
public async Task<bool> GetIsHttpsRequiredAsync()
94125
{
95126
if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -103,16 +134,59 @@ public async Task<bool> GetIsHttpsRequiredAsync()
103134

104135
#region Data contract
105136
/// <summary>
106-
/// Object representation for HTTP settings
137+
/// Object reporesentation of the status of the Holographic services
107138
/// </summary>
108139
[DataContract]
109-
public class WebManagementHttpSettings
140+
public class HolographicServices
110141
{
111142
/// <summary>
112-
/// Gets a value indicating whether HTTPS is required
143+
/// Gets the status for the collection of holographic services
113144
/// </summary>
114-
[DataMember(Name = "httpsRequired")]
115-
public bool IsHttpsRequired { get; private set; }
145+
[DataMember(Name = "SoftwareStatus")]
146+
public HolographicSoftwareStatus Status { get; private set; }
147+
}
148+
149+
/// <summary>
150+
/// Object representation of the collection of holographic services.
151+
/// </summary>
152+
[DataContract]
153+
public class HolographicSoftwareStatus
154+
{
155+
/// <summary>
156+
/// Gets the status of dwm.exe
157+
/// </summary>
158+
[DataMember(Name = "dwm.exe")]
159+
public ServiceStatus Dwm { get; private set; }
160+
161+
/// <summary>
162+
/// Gets the status of holoshellapp.exe
163+
/// </summary>
164+
[DataMember(Name = "holoshellapp.exe")]
165+
public ServiceStatus HoloShellApp { get; private set; }
166+
167+
/// <summary>
168+
/// Gets the status of holosi.exe
169+
/// </summary>
170+
[DataMember(Name = "holosi.exe")]
171+
public ServiceStatus HoloSi { get; private set; }
172+
173+
/// <summary>
174+
/// Gets the status of mixedrealitycapture.exe
175+
/// </summary>
176+
[DataMember(Name = "mixedrealitycapture.exe")]
177+
public ServiceStatus MixedRealitytCapture { get; private set; }
178+
179+
/// <summary>
180+
/// Gets the status of sihost.exe
181+
/// </summary>
182+
[DataMember(Name = "sihost.exe")]
183+
public ServiceStatus SiHost { get; private set; }
184+
185+
/// <summary>
186+
/// Gets the status of spectrum.exe
187+
/// </summary>
188+
[DataMember(Name = "spectrum.exe")]
189+
public ServiceStatus Spectrum { get; private set; }
116190
}
117191

118192
/// <summary>
@@ -136,6 +210,61 @@ public float Ipd
136210
set { this.IpdRaw = (int)(value * 1000); }
137211
}
138212
}
213+
214+
/// <summary>
215+
/// Object representation of the status of a service
216+
/// </summary>
217+
[DataContract]
218+
public class ServiceStatus
219+
{
220+
/// <summary>
221+
/// Gets the raw value returned for the expected service status
222+
/// </summary>
223+
[DataMember(Name = "Expected")]
224+
public string ExpectedRaw { get; private set; }
225+
226+
/// <summary>
227+
/// Gets the raw value returned for the observed service status
228+
/// </summary>
229+
[DataMember(Name = "Observed")]
230+
public string ObservedRaw { get; private set; }
231+
232+
/// <summary>
233+
/// Gets the the expected service status
234+
/// </summary>
235+
public ProcessStatus Expected
236+
{
237+
get
238+
{
239+
return (this.ExpectedRaw == "Running") ? ProcessStatus.Running : ProcessStatus.Stopped;
240+
}
241+
}
242+
243+
/// <summary>
244+
/// Gets the the observed service status
245+
/// </summary>
246+
public ProcessStatus Observed
247+
{
248+
get
249+
{
250+
return (this.ObservedRaw == "Running") ? ProcessStatus.Running : ProcessStatus.Stopped;
251+
}
252+
}
253+
}
254+
255+
/// <summary>
256+
/// Object representation for HTTP settings
257+
/// </summary>
258+
[DataContract]
259+
public class WebManagementHttpSettings
260+
{
261+
/// <summary>
262+
/// Gets a value indicating whether HTTPS is required
263+
/// </summary>
264+
[DataMember(Name = "httpsRequired")]
265+
public bool IsHttpsRequired { get; private set; }
266+
}
267+
139268
#endregion // Data contract
140269
}
141270
}

WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/HoloLens/HolographicPerception.cs

Lines changed: 94 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public partial class DevicePortal
2828
/// <summary>
2929
/// API for controlling the Holographic Perception Simulation control stream.
3030
/// </summary>
31-
public static readonly string HolographicSimulationStreamApi = "api/holographic/simulation/control/Stream";
31+
public static readonly string HolographicSimulationStreamApi = "api/holographic/simulation/control/stream";
3232

3333
/// <summary>
3434
/// Enumeration defining the control modes used by the Holographic Perception Simulation.
@@ -43,24 +43,86 @@ public enum SimulationControlMode
4343
/// <summary>
4444
/// Simulation mode.
4545
/// </summary>
46-
Simulation,
46+
Simulation
47+
}
4748

49+
/// <summary>
50+
/// Enumeration defining the priority levels for the Holographic Perception Simulation control stream.
51+
/// </summary>
52+
public enum SimulationControlStreamPriority
53+
{
4854
/// <summary>
49-
/// Remote mode.
55+
/// Low priority.
5056
/// </summary>
51-
Remote,
57+
Low = 0,
5258

5359
/// <summary>
54-
/// Legacy mode.
60+
/// Normal priority.
5561
/// </summary>
56-
Legacy
62+
Normal
63+
}
64+
65+
/// <summary>
66+
/// Creates a simulation control stream.
67+
/// </summary>
68+
/// <param name="priority">The control stream priority.</param>
69+
/// <returns>The identifier of the created stream.</returns>
70+
/// <remarks>This method is only supported on HoloLens.</remarks>
71+
public async Task<string> CreatePerceptionSimulationControlStreamAsync(SimulationControlStreamPriority priority)
72+
{
73+
if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
74+
{
75+
throw new NotSupportedException("This method is only supported on HoloLens.");
76+
}
77+
78+
if (!(await VerifySimulationControlModeAsync(SimulationControlMode.Simulation)))
79+
{
80+
throw new InvalidOperationException("The simulation control mode on the target HoloLens must be 'Simulation'.");
81+
}
82+
83+
string payload = string.Format(
84+
"priority={0}",
85+
(int)priority);
86+
87+
PerceptionSimulationControlStreamId controlStreamId = await this.GetAsync<PerceptionSimulationControlStreamId>(
88+
HolographicSimulationStreamApi,
89+
payload);
90+
91+
return controlStreamId.StreamId;
92+
}
93+
94+
/// <summary>
95+
/// Deletes a simulation control stream.
96+
/// </summary>
97+
/// <param name="streamId">The identifier of the stream to be deleted.</param>
98+
/// <returns>Task tracking completion of the REST call.</returns>
99+
/// <remarks>This method is only supported on HoloLens.</remarks>
100+
public async Task DeletePerceptionSimulationControlStreamAsync(string streamId)
101+
{
102+
if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
103+
{
104+
throw new NotSupportedException("This method is only supported on HoloLens.");
105+
}
106+
107+
if (!(await VerifySimulationControlModeAsync(SimulationControlMode.Simulation)))
108+
{
109+
throw new InvalidOperationException("The simulation control mode on the target HoloLens must be 'Simulation'.");
110+
}
111+
112+
string payload = string.Format(
113+
"streamId={0}",
114+
streamId);
115+
116+
await this.DeleteAsync(
117+
HolographicSimulationStreamApi,
118+
payload);
57119
}
58120

59121
/// <summary>
60122
/// Gets the perception simulation control mode.
61123
/// </summary>
62124
/// <returns>The simulation control mode.</returns>
63-
/// <remarks>This method is only supported on HoloLens devices.</remarks>
125+
/// <remarks>This method is only supported on HoloLens.</remarks>
64126
public async Task<SimulationControlMode> GetPerceptionSimulationControlModeAsync()
65127
{
66128
if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -76,8 +138,8 @@ public async Task<SimulationControlMode> GetPerceptionSimulationControlModeAsync
76138
/// Sets the perception simulation control mode.
77139
/// </summary>
78140
/// <param name="mode">The simulation control mode.</param>
79-
/// <remarks>This method is only supported on HoloLens devices.</remarks>
80141
/// <returns>Task tracking completion of the REST call.</returns>
142+
/// <remarks>This method is only supported on HoloLens.</remarks>
81143
public async Task SetPerceptionSimulationControlModeAsync(SimulationControlMode mode)
82144
{
83145
if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))
@@ -91,6 +153,17 @@ public async Task SetPerceptionSimulationControlModeAsync(SimulationControlMode
91153
await this.PostAsync(HolographicSimulationModeApi, payload);
92154
}
93155

156+
/// <summary>
157+
/// Compares the current simulation control mode with the expected mode.
158+
/// </summary>
159+
/// <param name="expectedMode">The simulation control mode that we expect the device to be in.</param>
160+
/// <returns>The simulation control mode.</returns>
161+
private async Task<bool> VerifySimulationControlModeAsync(SimulationControlMode expectedMode)
162+
{
163+
SimulationControlMode simMode = await this.GetPerceptionSimulationControlModeAsync();
164+
return (simMode == expectedMode);
165+
}
166+
94167
#region Data contract
95168
/// <summary>
96169
/// Object representation of Perception Simulation control mode.
@@ -104,6 +177,19 @@ public class PerceptionSimulationControlMode
104177
[DataMember(Name = "mode")]
105178
public SimulationControlMode Mode { get; private set; }
106179
}
180+
181+
/// <summary>
182+
/// Object representation of the response recevied when creating a Perception Simulation control stream.
183+
/// </summary>
184+
[DataContract]
185+
public class PerceptionSimulationControlStreamId
186+
{
187+
/// <summary>
188+
/// Gets the stream identifier.
189+
/// </summary>
190+
[DataMember(Name = "streamId")]
191+
public string StreamId { get; private set; }
192+
}
107193
#endregion // Data contract
108194
}
109195
}

WindowsDevicePortalWrapper/WindowsDevicePortalWrapper.Shared/HoloLens/HolographicThermal.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public partial class DevicePortal
5050
/// Gets the current thermal stage reading from the device.
5151
/// </summary>
5252
/// <returns>ThermalStages enum value.</returns>
53-
/// <remarks>This method is only supported on HoloLens devices.</remarks>
53+
/// <remarks>This method is only supported on HoloLens.</remarks>
5454
public async Task<ThermalStages> GetThermalStageAsync()
5555
{
5656
if (!Utilities.IsHoloLens(this.Platform, this.DeviceFamily))

0 commit comments

Comments
 (0)