Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Unified Diff: device/bluetooth/bluetooth_remote_gatt_characteristic_win.h

Issue 1728163006: Implement BluetoothRemoteGattCharacteristicWin::GetDescriptors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluetooth_remote_gatt_characteristic_win.h
diff --git a/device/bluetooth/bluetooth_remote_gatt_characteristic_win.h b/device/bluetooth/bluetooth_remote_gatt_characteristic_win.h
index f397363f500d1e606fb935949cce3cb73910732b..9e94b696c2a51f00ba2f76a47152a1870a87bdb5 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;
@@ -54,6 +57,23 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicWin
uint16_t GetAttributeHandle() const;
private:
+ 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);
+
BluetoothAdapterWin* adapter_;
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 send out to avoid duplicate notification.
scheib 2016/03/01 00:06:22 sent
gogerald1 2016/03/01 17:00:13 Done.
+ bool characteristic_added_notified_;
+
base::WeakPtrFactory<BluetoothRemoteGattCharacteristicWin> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicWin);
};

Powered by Google App Engine
This is Rietveld 408576698