| 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_BLUEZ_BLUETOOTH_GATT_NOTIFY_SESSION_BLUEZ_H_ | |
| 6 #define DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_GATT_NOTIFY_SESSION_BLUEZ_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "device/bluetooth/bluetooth_gatt_notify_session.h" | |
| 13 #include "device/bluetooth/dbus/bluetooth_gatt_characteristic_client.h" | |
| 14 | |
| 15 namespace device { | |
| 16 | |
| 17 class BluetoothAdapter; | |
| 18 | |
| 19 } // namespace device | |
| 20 | |
| 21 namespace bluez { | |
| 22 | |
| 23 class BluetoothRemoteGattCharacteristicBlueZ; | |
| 24 | |
| 25 // BluetoothGattNotifySessionBlueZ implements | |
| 26 // BluetoothGattNotifySession for platforms that use BlueZ. | |
| 27 class BluetoothGattNotifySessionBlueZ | |
| 28 : public device::BluetoothGattNotifySession, | |
| 29 public bluez::BluetoothGattCharacteristicClient::Observer { | |
| 30 public: | |
| 31 ~BluetoothGattNotifySessionBlueZ() override; | |
| 32 | |
| 33 // BluetoothGattNotifySession overrides. | |
| 34 std::string GetCharacteristicIdentifier() const override; | |
| 35 bool IsActive() override; | |
| 36 void Stop(const base::Closure& callback) override; | |
| 37 | |
| 38 private: | |
| 39 friend class BluetoothRemoteGattCharacteristicBlueZ; | |
| 40 | |
| 41 explicit BluetoothGattNotifySessionBlueZ( | |
| 42 scoped_refptr<device::BluetoothAdapter> adapter, | |
| 43 const std::string& device_address, | |
| 44 const std::string& service_identifier, | |
| 45 const std::string& characteristic_identifier, | |
| 46 const dbus::ObjectPath& characteristic_path); | |
| 47 | |
| 48 // bluez::BluetoothGattCharacteristicClient::Observer overrides. | |
| 49 void GattCharacteristicRemoved(const dbus::ObjectPath& object_path) override; | |
| 50 void GattCharacteristicPropertyChanged( | |
| 51 const dbus::ObjectPath& object_path, | |
| 52 const std::string& property_name) override; | |
| 53 | |
| 54 // True, if this session is currently active. | |
| 55 bool active_; | |
| 56 | |
| 57 // The Bluetooth adapter that this session is associated with. | |
| 58 scoped_refptr<device::BluetoothAdapter> adapter_; | |
| 59 | |
| 60 // The Bluetooth address of the device hosting the characteristic. | |
| 61 std::string device_address_; | |
| 62 | |
| 63 // The GATT service that the characteristic belongs to. | |
| 64 std::string service_id_; | |
| 65 | |
| 66 // Identifier of the associated characteristic. | |
| 67 std::string characteristic_id_; | |
| 68 | |
| 69 // D-Bus object path of the associated characteristic. This is used to filter | |
| 70 // observer events. | |
| 71 dbus::ObjectPath object_path_; | |
| 72 | |
| 73 DISALLOW_COPY_AND_ASSIGN(BluetoothGattNotifySessionBlueZ); | |
| 74 }; | |
| 75 | |
| 76 } // namespace bluez | |
| 77 | |
| 78 #endif // DEVICE_BLUETOOTH_BLUEZ_BLUETOOTH_GATT_NOTIFY_SESSION_BLUEZ_H_ | |
| OLD | NEW |