Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Side by Side Diff: device/bluetooth/bluetooth_gatt_connection.h

Issue 336933002: device/bluetooth: Introduce BluetoothGattConnection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Returning ERROR_UNSUPPORTED_DEVICE from platforms. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « device/bluetooth/bluetooth_device_win.cc ('k') | device/bluetooth/bluetooth_gatt_connection.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 <string>
9
10 #include "base/callback.h"
11
12 namespace device {
13
14 // BluetoothGattConnection represents a GATT connection to a Bluetooth device
15 // that has GATT services. Instances are obtained from a BluetoothDevice,
16 // and the connection is kept alive as long as there is at least one
17 // active BluetoothGattConnection object. BluetoothGattConnection objects
18 // automatically update themselves, when the connection is terminated by the
19 // operating system (e.g. due to user action).
20 class BluetoothGattConnection {
21 public:
22 // Destructor automatically closes this GATT connection. If this is the last
23 // remaining GATT connection and this results in a call to the OS, that call
24 // may not always succeed. Users can make an explicit call to
25 // BluetoothGattConnection::Close to make sure that they are notified of
26 // a possible error via the callback.
27 virtual ~BluetoothGattConnection();
28
29 // Returns the Bluetooth address of the device that this connection is open
30 // to.
31 virtual std::string GetDeviceAddress() const = 0;
32
33 // Returns true if this connection is open.
34 virtual bool IsConnected() = 0;
35
36 // Disconnects this GATT connection and calls |callback| upon completion.
37 // After a successful invocation, the device may still remain connected due to
38 // other GATT connections.
39 virtual void Disconnect(const base::Closure& callback) = 0;
40
41 protected:
42 BluetoothGattConnection();
43
44 private:
45 DISALLOW_COPY_AND_ASSIGN(BluetoothGattConnection);
46 };
47
48 } // namespace device
49
50 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_CONNECTION_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_device_win.cc ('k') | device/bluetooth/bluetooth_gatt_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698