ServiceDevice ServiceDevice ServiceDevice ServiceDevice Class

Provides methods for identifying a device service for a portable device that supports WPD (Windows Portable Devices) for device enumeration.

Syntax

Declaration

public static class ServiceDevicepublic static class ServiceDevicePublic Static Class ServiceDevicepublic static class ServiceDevice

Remarks

To access these services, you must declare the device service in the device capabilities section of the app manifest file. For a list of the GUIDs representing the device services, see Windows.Devices.Portable. To access the device services, you must declare the device service in the capabilities section of the app manifest file. For a list of the GUIDs representing the device services, see Windows.Devices.Portable.

The GetDeviceSelector(ServiceDeviceType) and GetDeviceSelectorFromServiceId(Guid) methods get selector strings that are passed to the Windows.Devices.Enumeration API to find portable device services. The Enumerating Common Devices tutorial explains how to use selector strings to discover available devices.

Examples of device services are the Media Transfer Protocol (MTP) device services that allow access to device status, contacts, calendar, tasks, and ringtones on a device. For more information, see MTP Device Services for Windows.

The Portable Device Services Sample demonstrates how to access the device service once you have discovered it.

Note

Access to a device service using this API is only available to Windows Store device app given privileged access to a device by the device manufacturer. For more information about Windows Store device app, see Windows 8 Device Experience: .

Methods summary

Returns an Advanced Query Syntax (AQS) string that is used to enumerate device services of the specified ServiceDeviceType. This string is passed to the FindAllAsync(String) or CreateWatcher() method.

An Advanced Query Syntax (AQS) string for identifying a device service by its GUIDs. This string is passed to the FindAllAsync(String) or CreateWatcher() method.

Methods

  • GetDeviceSelector(ServiceDeviceType)
    GetDeviceSelector(ServiceDeviceType)
    GetDeviceSelector(ServiceDeviceType)
    GetDeviceSelector(ServiceDeviceType)

    Returns an Advanced Query Syntax (AQS) string that is used to enumerate device services of the specified ServiceDeviceType. This string is passed to the FindAllAsync(String) or CreateWatcher() method.

    public static string GetDeviceSelector(ServiceDeviceType serviceType)public static string GetDeviceSelector(ServiceDeviceType serviceType)Public Static Function GetDeviceSelector(serviceType As ServiceDeviceType) As stringpublic static string GetDeviceSelector(ServiceDeviceType serviceType)

    Parameters

    Returns

    • string
      string
      string
      string

      The AQS string.

  • GetDeviceSelectorFromServiceId(Guid)
    GetDeviceSelectorFromServiceId(Guid)
    GetDeviceSelectorFromServiceId(Guid)
    GetDeviceSelectorFromServiceId(Guid)

    An Advanced Query Syntax (AQS) string for identifying a device service by its GUIDs. This string is passed to the FindAllAsync(String) or CreateWatcher() method.

    public static string GetDeviceSelectorFromServiceId(Guid serviceId)public static string GetDeviceSelectorFromServiceId(Guid serviceId)Public Static Function GetDeviceSelectorFromServiceId(serviceId As Guid) As stringpublic static string GetDeviceSelectorFromServiceId(Guid serviceId)

    Parameters

    • serviceId
      System.Guid
      System.Guid
      System.Guid
      System.Guid

      The service identifier.

    Returns

    • string
      string
      string
      string

      The AQS string.

Device family

Windows Desktop Extension SDK (introduced v10.0.10240.0)

API contract

Windows.Devices.Portable.PortableDeviceContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.Devices.Portable.dll