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

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: address comments 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..98601163ccbe35051dbf82cc3b048456019ea4be 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);
};
« no previous file with comments | « device/bluetooth/bluetooth_low_energy_win_fake.cc ('k') | device/bluetooth/bluetooth_remote_gatt_characteristic_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698