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

Side by Side Diff: device/bluetooth/bluetooth_remote_gatt_characteristic_win.h

Issue 1690133002: Implement BluetoothRemoteGattServiceWin and related unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments and split out of included GATT services Created 4 years, 9 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_WIN_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_WIN_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "base/sequenced_task_runner.h"
10 #include "device/bluetooth/bluetooth_gatt_characteristic.h"
11 #include "device/bluetooth/bluetooth_low_energy_defs_win.h"
12
13 namespace device {
14
15 class BluetoothAdapterWin;
16 class BluetoothRemoteGattServiceWin;
17 class BluetoothTaskManagerWin;
18
19 // The BluetoothRemoteGattCharacteristicWin class implements
20 // BluetoothGattCharacteristic for remote GATT services on Windows 8 and later.
21 class DEVICE_BLUETOOTH_EXPORT BluetoothRemoteGattCharacteristicWin
22 : public BluetoothGattCharacteristic {
23 public:
24 BluetoothRemoteGattCharacteristicWin(
25 BluetoothRemoteGattServiceWin* parent_service,
26 BTH_LE_GATT_CHARACTERISTIC* characteristic_info,
27 scoped_refptr<base::SequencedTaskRunner>& ui_task_runner);
28 ~BluetoothRemoteGattCharacteristicWin() override;
29
30 // Override BluetoothGattCharacteristic interfaces.
31 std::string GetIdentifier() const override;
32 BluetoothUUID GetUUID() const override;
33 bool IsLocal() const override;
34 std::vector<uint8_t>& GetValue() const override;
35 BluetoothGattService* GetService() const override;
36 Properties GetProperties() const override;
37 Permissions GetPermissions() const override;
38 bool IsNotifying() const override;
39 std::vector<BluetoothGattDescriptor*> GetDescriptors() const override;
40 BluetoothGattDescriptor* GetDescriptor(
41 const std::string& identifier) const override;
42 bool AddDescriptor(BluetoothGattDescriptor* descriptor) override;
43 bool UpdateValue(const std::vector<uint8_t>& value) override;
44 void StartNotifySession(const NotifySessionCallback& callback,
45 const ErrorCallback& error_callback) override;
46 void ReadRemoteCharacteristic(const ValueCallback& callback,
47 const ErrorCallback& error_callback) override;
48 void WriteRemoteCharacteristic(const std::vector<uint8_t>& new_value,
49 const base::Closure& callback,
50 const ErrorCallback& error_callback) override;
51
52 // Update included descriptors.
53 void Update();
54 uint16_t GetAttributeHandle() const;
55
56 private:
57 BluetoothAdapterWin* adapter_;
58 BluetoothRemoteGattServiceWin* parent_service_;
59 scoped_refptr<BluetoothTaskManagerWin> task_manager_;
60
61 // Characteristic info from OS and used to interact with OS.
62 scoped_ptr<BTH_LE_GATT_CHARACTERISTIC> characteristic_info_;
63 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
64 BluetoothUUID characteristic_uuid_;
65 std::vector<uint8_t> characteristic_value_;
66 std::string characteristic_identifier_;
67
68 base::WeakPtrFactory<BluetoothRemoteGattCharacteristicWin> weak_ptr_factory_;
69 DISALLOW_COPY_AND_ASSIGN(BluetoothRemoteGattCharacteristicWin);
70 };
71
72 } // namespace device
73
74 #endif // DEVICE_BLUETOOTH_BLUETOOTH_REMOTE_GATT_CHARACTERISTIC_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698