The BluetoothGATTGetCharacteristics function gets all the characteristics available for the specified service.
HRESULT BluetoothGATTGetCharacteristics( HANDLE hDevice, PBTH_LE_GATT_SERVICE Service, USHORT CharacteristicsBufferCount, PBTH_LE_GATT_CHARACTERISTIC CharacteristicsBuffer, USHORT *CharacteristicsBufferActual, ULONG Flags );
Handle to the Bluetooth device or service.
Address of a BTH_LE_GATT_SERVICE structure containing the parent service of the included services to be retrieved. This parameter is required if a device handle is passed to hDevice. This parameter is optional if a service handle was passed to hDevice, in which case the service specified by the service handle will be treated as the parent.
The number of elements allocated for the CharacteristicsBuffer parameter.
Pointer to buffer into which to return characteristics in a BTH_LE_GATT_SERVICE structure.
Pointer to buffer into which the actual number of characteristics were returned in the CharacteristicsBuffer parameter.
Flags to modify the behavior of BluetoothGATTGetCharacteristics:
|BLUETOOTH_GATT_FLAG_NONE||The client does not have specific GATT requirements (default).|
This function returns the following values:
||The operation completed successfully.|
||The buffer parameter is NULL and the number of items available is being returned instead.|
||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.|
One of the following conditions occurred:
||A buffer is specified, but the buffer count size is smaller than what is required, in bytes.|
||The current data in the cache appears to be inconsistent, and is leading to internal errors.|
||The operation ran out of memory.|
Returned characteristics are cached upon successful retrieval of characteristics from the device directly. Unless a service-change event is received, the list of returned characteristics is not expected to change.
Profile drivers should pre-allocate a sufficiently large buffer for the array of characteristics to be returned in. Callers can determine the necessary buffer size by passing a non-NULL value in CharacteristicsBufferActual and NULL in CharacteristicsBuffer.
Do not modify the returned characteristic structure, and then use the modified structure in subsequent function calls. Behavior is undefined if the caller does this.
The parent service must be present in the cache, otherwise the function will fail. The parent service must be a service returned by either BluetoothGATTGetServices or BluetoothGATTGetIncludedServices.
//////////////////////////////////////////////////////////////////////////// // Determine Characteristic Buffer Size ////////////////////////////////////////////////////////////////////////////
|Windows version||Supported in Windows 8 and later versions of Windows.|