OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_PROFILE_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_PROFILE_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_PROFILE_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_PROFILE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 | 12 |
13 namespace device { | 13 namespace device { |
14 | 14 |
| 15 class BluetoothDevice; |
15 class BluetoothProfileMac; | 16 class BluetoothProfileMac; |
16 class BluetoothSocket; | 17 class BluetoothSocket; |
17 | 18 |
18 // BluetoothProfile represents an implementation of either a client or server | 19 // BluetoothProfile represents an implementation of either a client or server |
19 // of a particular specified profile (aka service or protocol in other | 20 // of a particular specified profile (aka service or protocol in other |
20 // standards). | 21 // standards). |
21 // | 22 // |
22 // Profile implementations are created by registering them through the static | 23 // Profile implementations are created by registering them through the static |
23 // BluetoothProfile::Register() method and are always identified by a UUID | 24 // BluetoothProfile::Register() method and are always identified by a UUID |
24 // which in any method may be specified in the short or long form. | 25 // which in any method may be specified in the short or long form. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 virtual void Unregister() = 0; | 86 virtual void Unregister() = 0; |
86 | 87 |
87 // Set the connection callback for the profile to |callback|, any successful | 88 // Set the connection callback for the profile to |callback|, any successful |
88 // connection initiated by BluetoothDevice::ConnectToProfile() or incoming | 89 // connection initiated by BluetoothDevice::ConnectToProfile() or incoming |
89 // connections from devices, will have a BluetoothSocket created and passed | 90 // connections from devices, will have a BluetoothSocket created and passed |
90 // to this callback. | 91 // to this callback. |
91 // | 92 // |
92 // The socket will be closed when all references are released; none of the | 93 // The socket will be closed when all references are released; none of the |
93 // BluetoothProfile, or BluetoothAdapter or BluetoothDevice objects are | 94 // BluetoothProfile, or BluetoothAdapter or BluetoothDevice objects are |
94 // guaranteed to hold a reference so this may outlive all of them. | 95 // guaranteed to hold a reference so this may outlive all of them. |
95 typedef base::Callback<void(scoped_refptr<BluetoothSocket>)> SocketCallback; | 96 typedef base::Callback<void( |
96 virtual void SetConnectionCallback(const SocketCallback& callback) = 0; | 97 const BluetoothDevice*, |
| 98 scoped_refptr<BluetoothSocket>)> ConnectionCallback; |
| 99 virtual void SetConnectionCallback(const ConnectionCallback& callback) = 0; |
97 | 100 |
98 private: | 101 protected: |
99 friend class BluetoothProfileMac; | |
100 | |
101 BluetoothProfile(); | 102 BluetoothProfile(); |
102 virtual ~BluetoothProfile(); | 103 virtual ~BluetoothProfile(); |
103 }; | 104 }; |
104 | 105 |
105 } // namespace device | 106 } // namespace device |
106 | 107 |
107 #endif // DEVICE_BLUETOOTH_BLUETOOTH_PROFILE_H_ | 108 #endif // DEVICE_BLUETOOTH_BLUETOOTH_PROFILE_H_ |
OLD | NEW |