GattCharacteristic Class

Definition

Represents a Characteristic of a GATT service. The GattCharacteristic object represents a GATT Characteristic of a particular service, and is obtained from the Characteristics property of the GattDeviceService object.

public ref class GattCharacteristic sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class GattCharacteristic final
/// [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 GattCharacteristic final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class GattCharacteristic
[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 GattCharacteristic
Public NotInheritable Class GattCharacteristic
Inheritance
Object Platform::Object IInspectable GattCharacteristic
Attributes

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 GetDescriptorsAsync
1703 15063 GetDescriptorsAsync(BluetoothCacheMode)
1703 15063 GetDescriptorsForUuidAsync(Guid)
1703 15063 GetDescriptorsForUuidAsync(Guid,BluetoothCacheMode)
1703 15063 WriteClientCharacteristicConfigurationDescriptorWithResultAsync
1703 15063 WriteValueWithResultAsync(IBuffer)
1703 15063 WriteValueWithResultAsync(IBuffer,GattWriteOption)

Properties

AttributeHandle

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

CharacteristicProperties

Gets the GATT characteristic properties, as defined by the GATT profile.

If the ExtendedProperties flag is present it also represents the properties of the Extended Characteristic Properties Descriptor.

PresentationFormats

Gets the list of presentation format descriptors associated with this GattCharacteristic, in the order specified by the Aggregate Format Descriptor.

The list shall be empty if no PresentationFormat or Aggregate Format descriptors are found.

ProtectionLevel

Gets or sets the desired GATT security options for over the air communication with the device.

Windows will negotiate the maximum security possible with the device as part of the pairing process, and specifying a lower level of security won’t degrade the existing security level.

Service

Gets the GattDeviceService of which this characteristic is a member.

UserDescription

Get the user friendly description for this GattCharacteristic, if the User Description Descriptor is present, otherwise this will be an empty string.

Uuid

Gets the GATT Characteristic UUID for this GattCharacteristic.

Methods

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.

GetAllDescriptors()

Gets the collection of all descriptors belonging to this GattCharacteristic instance.

Important

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

GetDescriptors(Guid)

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

Important

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

GetDescriptorsAsync()

Returns the descriptors for this GattCharacteristic instance.

GetDescriptorsAsync(BluetoothCacheMode)

Returns the descriptors with the specified cache mode for this GattCharacteristic instance.

GetDescriptorsForUuidAsync(Guid, BluetoothCacheMode)

Returns the descriptors whose UUIDs match descriptorUuid with the specified cacheMode.

GetDescriptorsForUuidAsync(Guid)

Returns the descriptors whose UUIDs match descriptorUuid.

ReadClientCharacteristicConfigurationDescriptorAsync()

Reads the current value of the ClientCharacteristicConfigurationDescriptor.

ReadValueAsync()

Performs a Characteristic Value read from the value cache maintained by Windows.

ReadValueAsync(BluetoothCacheMode)

Performs a Characteristic Value read either from the value cache maintained by Windows, or directly from the device.

WriteClientCharacteristicConfigurationDescriptorAsync(GattClientCharacteristicConfigurationDescriptorValue)

Writes the ClientCharacteristicConfigurationDescriptor to the Bluetooth LE device, and if the value to be written represents an indication or a notification and a ValueChanged event handler is registered, enables receiving ValueChanged events from the device.

WriteClientCharacteristicConfigurationDescriptorWithResultAsync(GattClientCharacteristicConfigurationDescriptorValue)

Writes the ClientCharacteristicConfigurationDescriptor to the Bluetooth LE device, and if the value to be written represents an indication or a notification and a ValueChanged event handler is registered, enables receiving ValueChanged events from the device.

WriteValueAsync(IBuffer, GattWriteOption)

Performs a Characteristic Value write to a Bluetooth LE device.

WriteValueAsync(IBuffer)

Performs a Characteristic Value write to a Bluetooth LE device.

WriteValueWithResultAsync(IBuffer, GattWriteOption)

Performs a Characteristic Value write to a Bluetooth LE device.

WriteValueWithResultAsync(IBuffer)

Performs a Characteristic Value write to a Bluetooth LE device.

Events

ValueChanged

An App can register an event handler in order to receive events when notification or indications are received from a device, after setting the Client Characteristic Configuration Descriptor.

Applies to