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