Roll breakpad a513e85:7caf028 (svn 1384:1385)
[chromium-blink-merge.git] / device / bluetooth / bluetooth_gatt_notify_session.h
blob9837e3a3cc333f090e799ee5a50b3d506fe7b5e0
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"
12 namespace device {
14 // A BluetoothGattNotifySession represents an active session for listening
15 // to value updates from GATT characteristics that support notifications and/or
16 // indications. Instances are obtained by calling
17 // BluetoothGattCharacteristic::StartNotifySession.
18 class BluetoothGattNotifySession {
19 public:
20 // Destructor autmatically stops this session.
21 virtual ~BluetoothGattNotifySession();
23 // Returns the identifier of the associated characteristic.
24 virtual std::string GetCharacteristicIdentifier() const = 0;
26 // Returns true if this session is active.
27 virtual bool IsActive() = 0;
29 // Stops this session and calls |callback| upon completion. This won't
30 // necessarily stop value updates from the characteristic -- since updates
31 // are shared among BluetoothGattNotifySession instances -- but it will
32 // terminate this session.
33 virtual void Stop(const base::Closure& callback) = 0;
35 protected:
36 BluetoothGattNotifySession();
38 private:
39 DISALLOW_COPY_AND_ASSIGN(BluetoothGattNotifySession);
42 } // namespace device
44 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_NOTIFY_SESSION_H_