OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_GATT_CONNECTION_H_ | |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_CONNECTION_H_ | |
7 | |
8 #include "base/callback.h" | |
9 | |
10 namespace device { | |
11 | |
12 // BluetoothGattConnection represents a GATT connection to a Bluetooth device | |
13 // that has GATT services. Instances are obtained from a BluetoothDevice, | |
14 // and the connection is kept alive as long as there is at least one | |
15 // active BluetoothGattConnection object. BluetoothGattConnection objects | |
16 // automatically update themselves, when the connection is terminated by the | |
17 // operating system (e.g. due to user action). | |
18 class BluetoothGattConnection { | |
19 public: | |
20 // Destructor automatically closes this GATT connection. If this is the last | |
21 // remaining GATT connection and this results in a call to the OS, that call | |
22 // may not always succeed. Users can make an explicit call to | |
23 // BluetoothGattConnection::Close to make sure that they are notified of | |
24 // a possible error via the callback. | |
25 virtual ~BluetoothGattConnection(); | |
26 | |
27 // Returns true if the connection is active. | |
28 virtual bool IsActive() const = 0; | |
keybuk
2014/06/17 21:41:06
nit: "Connected" makes much more sense than "Activ
armansito
2014/06/18 02:03:06
Done.
| |
29 | |
30 // Disconnects this GATT connection and calls |callback| upon completion. | |
31 // After a successful invocation, the device may still remain connected due to | |
32 // other GATT connections. | |
33 virtual void Disconnect(const base::Closure& callback) = 0; | |
34 | |
35 protected: | |
36 BluetoothGattConnection(); | |
37 | |
38 private: | |
39 DISALLOW_COPY_AND_ASSIGN(BluetoothGattConnection); | |
40 }; | |
41 | |
42 } // namespace device | |
43 | |
44 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_CONNECTION_H_ | |
OLD | NEW |