Class DevicePortal
Function used to communicate with Windows 10 devices through the device portal REST APIs.
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit.WindowsDevicePortal
Assembly: cs.temp.dll.dll
Syntax
public static class DevicePortal
Methods
ConnectToWiFiNetworkAsync(DeviceInfo, InterfaceInfo, WirelessNetworkInfo, String)
Connects to the specified WiFi Network.
Declaration
public static Task<Response> ConnectToWiFiNetworkAsync(DeviceInfo targetDevice, InterfaceInfo interfaceInfo, WirelessNetworkInfo wifiNetwork, string password)
Parameters
Type | Name | Description |
---|---|---|
DeviceInfo | targetDevice | |
InterfaceInfo | interfaceInfo | The interface to use to connect. |
WirelessNetworkInfo | wifiNetwork | The network to connect to. |
String | password | Password for network access. |
Returns
Type | Description |
---|---|
Task<Response> | True, if connection successful. |
DownloadLogFileAsync(String, DeviceInfo, ApplicationInfo)
Downloads and launches the Log file for the target application on the target device.
Declaration
public static Task<string> DownloadLogFileAsync(string packageName, DeviceInfo targetDevice, ApplicationInfo appInfo = null)
Parameters
Type | Name | Description |
---|---|---|
String | packageName | |
DeviceInfo | targetDevice | |
ApplicationInfo | appInfo | Optional cached ApplicationInfo. |
Returns
Type | Description |
---|---|
Task<String> | The path of the downloaded log file. |
EnsureAuthenticationAsync(DeviceInfo)
Makes sure the Authentication Headers and CSRF Tokens are set.
Declaration
public static Task<bool> EnsureAuthenticationAsync(DeviceInfo targetDevice)
Parameters
Type | Name | Description |
---|---|---|
DeviceInfo | targetDevice |
Returns
Type | Description |
---|---|
Task<Boolean> | True if Authentication is successful, otherwise false. |
FinalizeUrl(String)
This Utility method finalizes the URL and formats the HTTPS string if needed.
Declaration
public static string FinalizeUrl(string targetUrl)
Parameters
Type | Name | Description |
---|---|---|
String | targetUrl | The target URL i.e. 128.128.128.128 |
Returns
Type | Description |
---|---|
String | The finalized URL with http/https prefix. |
Remarks
Local Machine will be changed to 127.0.0.1:10080 for HoloLens connections.
GetAllInstalledAppsAsync(DeviceInfo)
Declaration
public static Task<InstalledApps> GetAllInstalledAppsAsync(DeviceInfo targetDevice)
Parameters
Type | Name | Description |
---|---|---|
DeviceInfo | targetDevice |
Returns
Type | Description |
---|---|
Task<InstalledApps> |
GetAvailableWiFiNetworksAsync(DeviceInfo, InterfaceInfo)
Gets the AvailableWiFiNetworks of the target device.
Declaration
public static Task<AvailableWiFiNetworks> GetAvailableWiFiNetworksAsync(DeviceInfo targetDevice, InterfaceInfo interfaceInfo)
Parameters
Type | Name | Description |
---|---|---|
DeviceInfo | targetDevice | |
InterfaceInfo | interfaceInfo | The GUID for the network interface to use to search for wireless networks, without brackets. |
Returns
Type | Description |
---|---|
Task<AvailableWiFiNetworks> |
GetBatteryStateAsync(DeviceInfo)
Gets the BatteryInfo of the target device.
Declaration
public static Task<BatteryInfo> GetBatteryStateAsync(DeviceInfo targetDevice)
Parameters
Type | Name | Description |
---|---|---|
DeviceInfo | targetDevice |
Returns
Type | Description |
---|---|
Task<BatteryInfo> |
GetDeviceOsInfoAsync(DeviceInfo)
Gets the DeviceOsInfo of the target device.
Declaration
public static Task<DeviceOsInfo> GetDeviceOsInfoAsync(DeviceInfo targetDevice)
Parameters
Type | Name | Description |
---|---|---|
DeviceInfo | targetDevice |
Returns
Type | Description |
---|---|
Task<DeviceOsInfo> |
GetIpConfigInfoAsync(DeviceInfo)
Gets the IpConfigInfo of the target device.
Declaration
public static Task<IpConfigInfo> GetIpConfigInfoAsync(DeviceInfo targetDevice)
Parameters
Type | Name | Description |
---|---|---|
DeviceInfo | targetDevice |
Returns
Type | Description |
---|---|
Task<IpConfigInfo> |
GetMachineNameAsync(DeviceInfo)
Gets the MachineName of the target device.
Declaration
public static Task<MachineName> GetMachineNameAsync(DeviceInfo targetDevice)
Parameters
Type | Name | Description |
---|---|---|
DeviceInfo | targetDevice |
Returns
Type | Description |
---|---|
Task<MachineName> |
GetPowerStateAsync(DeviceInfo)
Gets the PowerStateInfo of the target device.
Declaration
public static Task<PowerStateInfo> GetPowerStateAsync(DeviceInfo targetDevice)
Parameters
Type | Name | Description |
---|---|---|
DeviceInfo | targetDevice |
Returns
Type | Description |
---|---|
Task<PowerStateInfo> |
GetWiFiNetworkInterfacesAsync(DeviceInfo)
Gets the NetworkInterfaces of the target device.
Declaration
public static Task<NetworkInterfaces> GetWiFiNetworkInterfacesAsync(DeviceInfo targetDevice)
Parameters
Type | Name | Description |
---|---|---|
DeviceInfo | targetDevice |
Returns
Type | Description |
---|---|
Task<NetworkInterfaces> |
InstallAppAsync(String, DeviceInfo, Boolean)
Installs the target application on the target device.
Declaration
public static Task<bool> InstallAppAsync(string appFullPath, DeviceInfo targetDevice, bool waitForDone = true)
Parameters
Type | Name | Description |
---|---|---|
String | appFullPath | |
DeviceInfo | targetDevice | |
Boolean | waitForDone | Should the thread wait until installation is complete? |
Returns
Type | Description |
---|---|
Task<Boolean> | True, if Installation was a success. |
IsAppInstalledAsync(String, DeviceInfo)
Determines if the target application is currently running on the target device.
Declaration
public static Task<bool> IsAppInstalledAsync(string packageName, DeviceInfo targetDevice)
Parameters
Type | Name | Description |
---|---|---|
String | packageName | |
DeviceInfo | targetDevice |
Returns
Type | Description |
---|---|
Task<Boolean> | True, if application is currently installed on device. |
IsAppRunningAsync(String, DeviceInfo, ApplicationInfo)
Determines if the target application is running on the target device.
Declaration
public static Task<bool> IsAppRunningAsync(string packageName, DeviceInfo targetDevice, ApplicationInfo appInfo = null)
Parameters
Type | Name | Description |
---|---|---|
String | packageName | |
DeviceInfo | targetDevice | |
ApplicationInfo | appInfo | Optional cached ApplicationInfo. |
Returns
Type | Description |
---|---|
Task<Boolean> | True, if the application is running. |
LaunchAppAsync(String, DeviceInfo, ApplicationInfo)
Launches the target application on the target device.
Declaration
public static Task<bool> LaunchAppAsync(string packageName, DeviceInfo targetDevice, ApplicationInfo appInfo = null)
Parameters
Type | Name | Description |
---|---|---|
String | packageName | |
DeviceInfo | targetDevice | |
ApplicationInfo | appInfo | Optional cached ApplicationInfo. |
Returns
Type | Description |
---|---|
Task<Boolean> | True, if application was successfully launched and is currently running on the target device. |
OpenWebPortal(DeviceInfo)
Opens the Device Portal for the target device.
Declaration
public static void OpenWebPortal(DeviceInfo targetDevice)
Parameters
Type | Name | Description |
---|---|---|
DeviceInfo | targetDevice |
RefreshCsrfTokenAsync(DeviceInfo)
Refreshes the CSRF Token in case the device or its portal was restarted.
Declaration
public static Task<bool> RefreshCsrfTokenAsync(DeviceInfo targetDevice)
Parameters
Type | Name | Description |
---|---|---|
DeviceInfo | targetDevice |
Returns
Type | Description |
---|---|
Task<Boolean> | True, if refresh was successful. |
RestartAsync(DeviceInfo)
Restart the target device.
Declaration
public static Task<bool> RestartAsync(DeviceInfo targetDevice)
Parameters
Type | Name | Description |
---|---|---|
DeviceInfo | targetDevice |
Returns
Type | Description |
---|---|
Task<Boolean> | True, if the device has successfully restarted. |
ShutdownAsync(DeviceInfo)
Shuts down the target device.
Declaration
public static Task<bool> ShutdownAsync(DeviceInfo targetDevice)
Parameters
Type | Name | Description |
---|---|---|
DeviceInfo | targetDevice |
Returns
Type | Description |
---|---|
Task<Boolean> | True, if the device is shitting down. |
StopAppAsync(String, DeviceInfo, ApplicationInfo)
Stops the target application on the target device.
Declaration
public static Task<bool> StopAppAsync(string packageName, DeviceInfo targetDevice, ApplicationInfo appInfo = null)
Parameters
Type | Name | Description |
---|---|---|
String | packageName | |
DeviceInfo | targetDevice | |
ApplicationInfo | appInfo | Optional cached ApplicationInfo. |
Returns
Type | Description |
---|---|
Task<Boolean> | true, if application was successfully stopped. |
UninstallAppAsync(String, DeviceInfo, ApplicationInfo)
Uninstalls the target application on the target device
Declaration
public static Task<bool> UninstallAppAsync(string packageName, DeviceInfo targetDevice, ApplicationInfo appInfo = null)
Parameters
Type | Name | Description |
---|---|---|
String | packageName | |
DeviceInfo | targetDevice | |
ApplicationInfo | appInfo | Optional cached ApplicationInfo. |
Returns
Type | Description |
---|---|
Task<Boolean> | True, if uninstall was a success. |