Jaa


GattDeviceService Class

Definition

Represents a GATT Primary Service on a Bluetooth device. The GattDeviceService class represents a GATT service on a Bluetooth LE device. It is instantiated by using a device service instance path, obtained by finding a device using the Windows.Devices.Enumeration API.

public ref class GattDeviceService sealed : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class GattDeviceService final : IClosable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class GattDeviceService final : IClosable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class GattDeviceService : System.IDisposable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class GattDeviceService : System.IDisposable
Public NotInheritable Class GattDeviceService
Implements IDisposable
Inheritance
Object Platform::Object IInspectable GattDeviceService
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)
App capabilities
bluetooth

Remarks

Version history

Windows version SDK version Value added
1703 15063 DeviceAccessInformation
1703 15063 FromIdAsync(String,GattSharingMode)
1703 15063 GetCharacteristicsAsync
1703 15063 GetCharacteristicsAsync(BluetoothCacheMode)
1703 15063 GetCharacteristicsForUuidAsync(Guid)
1703 15063 GetCharacteristicsForUuidAsync(Guid,BluetoothCacheMode)
1703 15063 GetDeviceSelectorForBluetoothDeviceId(BluetoothDeviceId)
1703 15063 GetDeviceSelectorForBluetoothDeviceId(BluetoothDeviceId,BluetoothCacheMode)
1703 15063 GetDeviceSelectorForBluetoothDeviceIdAndUuid(BluetoothDeviceId,Guid)
1703 15063 GetDeviceSelectorForBluetoothDeviceIdAndUuid(BluetoothDeviceId,Guid,BluetoothCacheMode)
1703 15063 GetIncludedServicesAsync
1703 15063 GetIncludedServicesAsync(BluetoothCacheMode)
1703 15063 GetIncludedServicesForUuidAsync(Guid)
1703 15063 GetIncludedServicesForUuidAsync(Guid,BluetoothCacheMode)
1703 15063 OpenAsync
1703 15063 RequestAccessAsync
1703 15063 Session
1703 15063 SharingMode

Properties

AttributeHandle

Gets the handle used to uniquely identify GATT-based service attributes as declared on the Bluetooth LE device.

Device

Gets the BluetoothLEDevice object describing the device associated with the current GattDeviceService object.

Important

The Device API is deprecated, and it may not be available in future versions of Windows. Instead, use Session.

DeviceAccessInformation

Gets the device access information associated with the current GattDeviceService object.

DeviceId

Get the string that represents the GATT service instance path used to instantiate the GattDeviceService.

ParentServices

Gets the read-only list of parent services for this service.

Important

The ParentServices API is deprecated, and it may not be available in future versions of Windows.

Session

Gets the session for this GATT device service instance.

SharingMode

Gets the sharing mode for this GATT device service instance.

Uuid

Gets the GATT Service UUID associated with this GattDeviceService.

Methods

Close()

Releases the resources associated with the GattDeviceService class. This allows other apps to access the resources of the GattDeviceService in question. Don't use a GattDeviceService object after you've invoked Close on it; instead, instantiate a new GattDeviceService object by using the FromIdAsync method.

For C++, call Close. For .NET languages, this Close method is projected into Dispose.

ConvertShortIdToUuid(UInt16)

Converts a Bluetooth SIG defined short Id to a full GATT UUID.

Important

The ConvertShortIdToUuid API is deprecated, and it may not be available in future versions of Windows. Instead, use BluetoothUuidHelper.FromShortId.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

FromIdAsync(String, GattSharingMode)

Instantiates a new GattDeviceService object from the device ID.

FromIdAsync(String)

Instantiates a new GattDeviceService from the device ID.

GetAllCharacteristics()

Gets the collection of all characteristics belonging to this GattDeviceService instance.

Important

The GetAllCharacteristics API is deprecated, and it may not be available in future versions of Windows. Instead, use GetCharacteristicsAsync.

GetAllIncludedServices()

Gets the collection of all included services belonging to this GattDeviceService instance.

Important

The GetAllCharacteristics API is deprecated, and it may not be available in future versions of Windows. Instead, use GetIncludedServicesAsync.

GetCharacteristics(Guid)

Returns a vector of characteristics, that are identified by the specified UUID and belong to this GattDeviceService instance.

Important

The GetCharacteristics API is deprecated, and it may not be available in future versions of Windows. Instead, use GetCharacteristicsForUuidAsync.

GetCharacteristicsAsync()

Gets the characteristics that are part of this GattDeviceService instance.

GetCharacteristicsAsync(BluetoothCacheMode)

Gets the characteristics that are part of this GattDeviceService instance.

GetCharacteristicsForUuidAsync(Guid, BluetoothCacheMode)

Gets the characterisitics that are part of this GattDeviceService instance and associated with the characteristicUuid.

GetCharacteristicsForUuidAsync(Guid)

Gets the characterisitics that are part of this GattDeviceService instance and associated with the characteristicUuid.

GetDeviceSelectorForBluetoothDeviceId(BluetoothDeviceId, BluetoothCacheMode)

Creates a suitable AQS Filter string for use with the CreateWatcher method, from a BluetoothDeviceId.

GetDeviceSelectorForBluetoothDeviceId(BluetoothDeviceId)

Creates a suitable AQS Filter string for use with the CreateWatcher method, from a BluetoothDeviceId.

GetDeviceSelectorForBluetoothDeviceIdAndUuid(BluetoothDeviceId, Guid, BluetoothCacheMode)

Creates a suitable AQS Filter string for use with the CreateWatcher method, from a BluetoothDeviceId and serviceUuid.

GetDeviceSelectorForBluetoothDeviceIdAndUuid(BluetoothDeviceId, Guid)

Creates a suitable AQS Filter string for use with the CreateWatcher method, from a BluetoothDeviceId and serviceUuid.

GetDeviceSelectorFromShortId(UInt16)

Creates a suitable AQS Filter string for use with the CreateWatcher method, from a 16-bit Bluetooth GATT Service UUID.

Important

The GetDeviceSelectorFromShortId API is deprecated, and it may not be available in future versions of Windows. Instead, use GetDeviceSelectorFromUuid.

GetDeviceSelectorFromUuid(Guid)

Creates a suitable AQS Filter string for use with the CreateWatcher method, from a Bluetooth service UUID.

GetIncludedServices(Guid)

Returns a vector of included services, that are identified by the specified UUID and belong to this GattDeviceService instance.

Important

The GetIncludedServices API is deprecated, and it may not be available in future versions of Windows. Instead, use GetIncludedServicesForUuidAsync.

GetIncludedServicesAsync()

Gets the included services that are associated with this GattDeviceService instance.

GetIncludedServicesAsync(BluetoothCacheMode)

Gets the included services that are associated with this GattDeviceService instance.

GetIncludedServicesForUuidAsync(Guid, BluetoothCacheMode)

Gets the included services from the serviceUuid that is associated with this GattDeviceService instance.

GetIncludedServicesForUuidAsync(Guid)

Gets the included services from the serviceUuid that is associated with this GattDeviceService instance.

OpenAsync(GattSharingMode)

Opens the GATT device service with the specified sharingMode.

RequestAccessAsync()

Requests access to the GattDeviceService.

Applies to

See also