summaryrefslogtreecommitdiffstats
path: root/device/bluetooth/bluetooth_remote_gatt_characteristic_win.h
diff options
context:
space:
mode:
Diffstat (limited to 'device/bluetooth/bluetooth_remote_gatt_characteristic_win.h')
-rw-r--r--device/bluetooth/bluetooth_remote_gatt_characteristic_win.h33
1 files changed, 32 insertions, 1 deletions
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_win.h b/device/bluetooth/bluetooth_remote_gatt_characteristic_win.h
index f397363..9860116 100644
--- a/device/bluetooth/bluetooth_remote_gatt_characteristic_win.h
+++ b/device/bluetooth/bluetooth_remote_gatt_characteristic_win.h
@@ -5,6 +5,8 @@
#ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_WIN_H_
#define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_WIN_H_
+#include <unordered_map>
+
#include "base/memory/weak_ptr.h"
#include "base/sequenced_task_runner.h"
#include "device/bluetooth/bluetooth_gatt_characteristic.h"
@@ -13,6 +15,7 @@
namespace device {
class BluetoothAdapterWin;
+class BluetoothRemoteGattDescriptorWin;
class BluetoothRemoteGattServiceWin;
class BluetoothTaskManagerWin;
@@ -52,9 +55,26 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicWin
// Update included descriptors.
void Update();
uint16_t GetAttributeHandle() const;
+ BluetoothRemoteGattServiceWin* GetWinService() { return parent_service_; }
private:
- BluetoothAdapterWin* adapter_;
+ void OnGetIncludedDescriptorsCallback(
+ scoped_ptr<BTH_LE_GATT_DESCRIPTOR> descriptors,
+ uint16_t num,
+ HRESULT hr);
+ void UpdateIncludedDescriptors(PBTH_LE_GATT_DESCRIPTOR descriptors,
+ uint16_t num);
+
+ // Checks if the descriptor with |uuid| and |attribute_handle| has already
+ // been discovered as included descriptor.
+ bool IsDescriptorDiscovered(BTH_LE_UUID& uuid, uint16_t attribute_handle);
+
+ // Checks if |descriptor| still exists in this characteristic according to
+ // newly discovered |num| of |descriptors|.
+ static bool DoesDescriptorExist(PBTH_LE_GATT_DESCRIPTOR descriptors,
+ uint16_t num,
+ BluetoothRemoteGattDescriptorWin* descriptor);
+
BluetoothRemoteGattServiceWin* parent_service_;
scoped_refptr<BluetoothTaskManagerWin> task_manager_;
@@ -65,6 +85,17 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicWin
std::vector<uint8_t> characteristic_value_;
std::string characteristic_identifier_;
+ // The key of GattDescriptorMap is the identitfier of
+ // BluetoothRemoteGattDescriptorWin instance.
+ typedef std::unordered_map<std::string,
+ scoped_ptr<BluetoothRemoteGattDescriptorWin>>
+ GattDescriptorMap;
+ GattDescriptorMap included_descriptors_;
+
+ // Flag indicates if characteristic added notification of this characteristic
+ // has been sent out to avoid duplicate notification.
+ bool characteristic_added_notified_;
+
base::WeakPtrFactory<BluetoothRemoteGattCharacteristicWin> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicWin);
};