| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_GATT_NOTIFY_SESSION_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_GATT_NOTIFY_SESSION_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_NOTIFY_SESSION_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_NOTIFY_SESSION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "device/bluetooth/bluetooth_export.h" | |
| 12 | 11 |
| 13 namespace device { | 12 namespace device { |
| 14 | 13 |
| 15 // A BluetoothGattNotifySession represents an active session for listening | 14 // A BluetoothGattNotifySession represents an active session for listening |
| 16 // to value updates from GATT characteristics that support notifications and/or | 15 // to value updates from GATT characteristics that support notifications and/or |
| 17 // indications. Instances are obtained by calling | 16 // indications. Instances are obtained by calling |
| 18 // BluetoothGattCharacteristic::StartNotifySession. | 17 // BluetoothGattCharacteristic::StartNotifySession. |
| 19 class DEVICE_BLUETOOTH_EXPORT BluetoothGattNotifySession { | 18 class BluetoothGattNotifySession { |
| 20 public: | 19 public: |
| 21 // Destructor automatically stops this session. | 20 // Destructor automatically stops this session. |
| 22 virtual ~BluetoothGattNotifySession(); | 21 virtual ~BluetoothGattNotifySession(); |
| 23 | 22 |
| 24 // Returns the identifier of the associated characteristic. | 23 // Returns the identifier of the associated characteristic. |
| 25 virtual std::string GetCharacteristicIdentifier() const = 0; | 24 virtual std::string GetCharacteristicIdentifier() const = 0; |
| 26 | 25 |
| 27 // Returns true if this session is active. | 26 // Returns true if this session is active. |
| 28 virtual bool IsActive() = 0; | 27 virtual bool IsActive() = 0; |
| 29 | 28 |
| 30 // Stops this session and calls |callback| upon completion. This won't | 29 // Stops this session and calls |callback| upon completion. This won't |
| 31 // necessarily stop value updates from the characteristic -- since updates | 30 // necessarily stop value updates from the characteristic -- since updates |
| 32 // are shared among BluetoothGattNotifySession instances -- but it will | 31 // are shared among BluetoothGattNotifySession instances -- but it will |
| 33 // terminate this session. | 32 // terminate this session. |
| 34 virtual void Stop(const base::Closure& callback) = 0; | 33 virtual void Stop(const base::Closure& callback) = 0; |
| 35 | 34 |
| 36 protected: | 35 protected: |
| 37 BluetoothGattNotifySession(); | 36 BluetoothGattNotifySession(); |
| 38 | 37 |
| 39 private: | 38 private: |
| 40 DISALLOW_COPY_AND_ASSIGN(BluetoothGattNotifySession); | 39 DISALLOW_COPY_AND_ASSIGN(BluetoothGattNotifySession); |
| 41 }; | 40 }; |
| 42 | 41 |
| 43 } // namespace device | 42 } // namespace device |
| 44 | 43 |
| 45 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_NOTIFY_SESSION_H_ | 44 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_NOTIFY_SESSION_H_ |
| OLD | NEW |