OLD | NEW |
| (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_LOCAL_GATT_CHARACTERISTIC_BLUEZ_H_ | |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_BLUEZ_H_ | |
7 | |
8 #include <stdint.h> | |
9 #include <vector> | |
10 | |
11 #include "base/callback_forward.h" | |
12 #include "base/macros.h" | |
13 #include "base/memory/weak_ptr.h" | |
14 #include "dbus/object_path.h" | |
15 #include "device/bluetooth/bluetooth_gatt_characteristic_bluez.h" | |
16 #include "device/bluetooth/bluetooth_uuid.h" | |
17 | |
18 namespace device { | |
19 | |
20 class BluetoothGattDescriptor; | |
21 class BluetoothGattService; | |
22 | |
23 } // namespace device | |
24 | |
25 namespace bluez { | |
26 | |
27 class BluetoothLocalGattDescriptorBlueZ; | |
28 class BluetoothLocalGattServiceBlueZ; | |
29 | |
30 // The BluetoothLocalGattCharacteristicBlueZ class implements | |
31 // BluetoothGattCharacteristic for remote GATT characteristics for platforms | |
32 // that use BlueZ. | |
33 class BluetoothLocalGattCharacteristicBlueZ | |
34 : public BluetoothGattCharacteristicBlueZ { | |
35 public: | |
36 // device::BluetoothGattCharacteristic overrides. | |
37 device::BluetoothUUID GetUUID() const override; | |
38 bool IsLocal() const override; | |
39 const std::vector<uint8_t>& GetValue() const override; | |
40 Properties GetProperties() const override; | |
41 bool IsNotifying() const override; | |
42 bool AddDescriptor(device::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 private: | |
53 friend class BluetoothLocalGattServiceBlueZ; | |
54 | |
55 BluetoothLocalGattCharacteristicBlueZ(BluetoothLocalGattServiceBlueZ* service, | |
56 const dbus::ObjectPath& object_path); | |
57 ~BluetoothLocalGattCharacteristicBlueZ() override; | |
58 | |
59 // Note: This should remain the last member so it'll be destroyed and | |
60 // invalidate its weak pointers before any other members are destroyed. | |
61 base::WeakPtrFactory<BluetoothLocalGattCharacteristicBlueZ> weak_ptr_factory_; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(BluetoothLocalGattCharacteristicBlueZ); | |
64 }; | |
65 | |
66 } // namespace bluez | |
67 | |
68 #endif // DEVICE_BLUETOOTH_BLUETOOTH_LOCAL_GATT_CHARACTERISTIC_BLUEZ_H_ | |
OLD | NEW |