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.
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_GATT_NOTIFY_SESSION_CHROMEOS_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_NOTIFY_SESSION_CHROMEOS_H_
10 #include "base/callback.h"
11 #include "chromeos/dbus/bluetooth_gatt_characteristic_client.h"
12 #include "device/bluetooth/bluetooth_gatt_notify_session.h"
16 class BluetoothAdapter
;
22 class BluetoothRemoteGattCharacteristicChromeOS
;
24 // BluetoothGattNotifySessionChromeOS implements
25 // BluetoothGattNotifySession for the Chrome OS platform.
26 class BluetoothGattNotifySessionChromeOS
27 : public device::BluetoothGattNotifySession
,
28 public BluetoothGattCharacteristicClient::Observer
{
30 ~BluetoothGattNotifySessionChromeOS() override
;
32 // BluetoothGattNotifySession overrides.
33 std::string
GetCharacteristicIdentifier() const override
;
34 bool IsActive() override
;
35 void Stop(const base::Closure
& callback
) override
;
38 friend class BluetoothRemoteGattCharacteristicChromeOS
;
40 explicit BluetoothGattNotifySessionChromeOS(
41 scoped_refptr
<device::BluetoothAdapter
> adapter
,
42 const std::string
& device_address
,
43 const std::string
& service_identifier
,
44 const std::string
& characteristic_identifier
,
45 const dbus::ObjectPath
& characteristic_path
);
47 // BluetoothGattCharacteristicClient::Observer overrides.
48 void GattCharacteristicRemoved(const dbus::ObjectPath
& object_path
) override
;
49 void GattCharacteristicPropertyChanged(
50 const dbus::ObjectPath
& object_path
,
51 const std::string
& property_name
) override
;
53 // True, if this session is currently active.
56 // The Bluetooth adapter that this session is associated with.
57 scoped_refptr
<device::BluetoothAdapter
> adapter_
;
59 // The Bluetooth address of the device hosting the characteristic.
60 std::string device_address_
;
62 // The GATT service that the characteristic belongs to.
63 std::string service_id_
;
65 // Identifier of the associated characteristic.
66 std::string characteristic_id_
;
68 // D-Bus object path of the associated characteristic. This is used to filter
70 dbus::ObjectPath object_path_
;
72 DISALLOW_COPY_AND_ASSIGN(BluetoothGattNotifySessionChromeOS
);
75 } // namespace chromeos
77 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_NOTIFY_SESSION_CHROMEOS_H_