BluetoothGATTSetDescriptorValue function (bluetoothleapis.h)
The BluetoothGATTSetDescriptorValue function writes the specified descriptor value to the Bluetooth device.
Syntax
HRESULT BluetoothGATTSetDescriptorValue(
[in] HANDLE hDevice,
[in] PBTH_LE_GATT_DESCRIPTOR Descriptor,
[in] PBTH_LE_GATT_DESCRIPTOR_VALUE DescriptorValue,
[in] ULONG Flags
);
Parameters
[in] hDevice
Handle to the service.
[in] Descriptor
Pointer to the parent descriptor.
[in] DescriptorValue
Pointer to the descriptor's value.
[in] Flags
Flags to modify the behavior of BluetoothGATTSetDescriptorValue:
Flag | Description |
---|---|
BLUETOOTH_GATT_FLAG_NONE | The client does not have specific GATT requirements (default). |
BLUETOOTH_GATT_FLAG_CONNECTION_ENCRYPTED | The client requests the data to be transmitted over an encrypted channel. |
BLUETOOTH_GATT_FLAG_CONNECTION_AUTHENTICATED | The client requests the data to be transmitted over an authenticated channel. |
Return value
The BluetoothGATTSetDescriptorValue function returns the following values:
Return code | Description |
---|---|
|
The operation completed successfully. |
|
Returned if both a parent service and a service handle are provided and the service hierarchy does not roll up to the provided parent service handle. |
|
A parameter was invalid. |
|
The target server did not provide an appropriate network response. |
|
The request timed-out. |
|
The operation ran out of memory. |
|
The attribute handle given was not valid on this server. |
|
The attribute cannot be read. |
|
The attribute cannot be written. |
|
The attribute PDU was invalid. |
|
The attribute requires authentication before it can be read or written. |
|
Attribute server does not support the request received from the client. |
|
Offset specified was past the end of the attribute. |
|
The attribute requires authorization before it can be read or written. |
|
Too many prepare writes have been queued. |
|
No attribute found within the given attribute handle range. |
|
The attribute cannot be read or written using the Read Blob Request. |
|
The Encryption Key Size used for encrypting this link is insufficient. |
|
The attribute value length is invalid for the operation. |
|
The attribute request that was requested has encountered an error that was unlikely, and therefore could not be completed as requested. |
|
The attribute requires encryption before it can be read or written. |
|
The attribute type is not a supported grouping attribute as defined by a higher layer specification. |
|
Insufficient Resources to complete the request. |
|
An error that lies in the reserved range has been received. |
Remarks
The parent descriptor must be returned from a previous call to BluetoothGATTGetDescriptors, and must not be altered. Behavior is undefined if the caller does this.
Example
BTH_LE_GATT_DESCRIPTOR_VALUE newValue;
RtlZeroMemory(&newValue, sizeof(newValue));
newValue.DescriptorType = ClientCharacteristicConfiguration;
newValue.ClientCharacteristicConfiguration.IsSubscribeToNotification = TRUE;
// Subscribe to an event.
hr = BluetoothGATTSetDescriptorValue(hDevice,
parentDescriptor,
&newValue,
BLUETOOTH_GATT_FLAG_NONE);
Requirements
Requirement | Value |
---|---|
Minimum supported client | Supported in Windows 8 and later versions of Windows. |
Target Platform | Universal |
Header | bluetoothleapis.h |
Library | BluetoothApis.lib |
DLL | BluetoothAPIs.dll |