Upstream changes for NetworkQualityProvider
[chromium-blink-merge.git] / device / bluetooth / bluetooth_gatt_notify_session.h
blob4c63563b71212de5ebc3f1cd392c1ec6d6f797a3
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_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_NOTIFY_SESSION_H_
8 #include <string>
10 #include "base/callback.h"
11 #include "device/bluetooth/bluetooth_export.h"
13 namespace device {
15 // A BluetoothGattNotifySession represents an active session for listening
16 // to value updates from GATT characteristics that support notifications and/or
17 // indications. Instances are obtained by calling
18 // BluetoothGattCharacteristic::StartNotifySession.
19 class DEVICE_BLUETOOTH_EXPORT BluetoothGattNotifySession {
20 public:
21 // Destructor automatically stops this session.
22 virtual ~BluetoothGattNotifySession();
24 // Returns the identifier of the associated characteristic.
25 virtual std::string GetCharacteristicIdentifier() const = 0;
27 // Returns true if this session is active.
28 virtual bool IsActive() = 0;
30 // Stops this session and calls |callback| upon completion. This won't
31 // necessarily stop value updates from the characteristic -- since updates
32 // are shared among BluetoothGattNotifySession instances -- but it will
33 // terminate this session.
34 virtual void Stop(const base::Closure& callback) = 0;
36 protected:
37 BluetoothGattNotifySession();
39 private:
40 DISALLOW_COPY_AND_ASSIGN(BluetoothGattNotifySession);
43 } // namespace device
45 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_NOTIFY_SESSION_H_