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 CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ | 5 #ifndef CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ |
6 #define CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ | 6 #define CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/scoped_ptr.h" |
12 #include "chromeos/chromeos_export.h" | 13 #include "chromeos/chromeos_export.h" |
13 #include "dbus/bus.h" | 14 #include "dbus/bus.h" |
14 #include "dbus/file_descriptor.h" | 15 #include "dbus/file_descriptor.h" |
15 #include "dbus/object_path.h" | 16 #include "dbus/object_path.h" |
16 | 17 |
17 namespace chromeos { | 18 namespace chromeos { |
18 | 19 |
19 // ExperimentalBluetoothProfileServiceProvider is used to provide a D-Bus | 20 // ExperimentalBluetoothProfileServiceProvider is used to provide a D-Bus |
20 // object that BlueZ can communicate with to connect application profiles. | 21 // object that BlueZ can communicate with to connect application profiles. |
21 // | 22 // |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // Bluetooth daemon, generally at shutdown or at the applications' request. | 68 // Bluetooth daemon, generally at shutdown or at the applications' request. |
68 // It may be used to perform cleanup tasks. | 69 // It may be used to perform cleanup tasks. |
69 virtual void Release() = 0; | 70 virtual void Release() = 0; |
70 | 71 |
71 // This method will be called when a profile connection to the device | 72 // This method will be called when a profile connection to the device |
72 // with object path |device_path| is established. |callback| must be called | 73 // with object path |device_path| is established. |callback| must be called |
73 // to confirm the connection, or indicate rejection or cancellation. | 74 // to confirm the connection, or indicate rejection or cancellation. |
74 // | 75 // |
75 // A file descriptor for the connection socket is provided in |fd|, and | 76 // A file descriptor for the connection socket is provided in |fd|, and |
76 // details about the specific implementation of the profile in |options|. | 77 // details about the specific implementation of the profile in |options|. |
77 // The delegate should take the value and ownership | 78 // |
78 | 79 // IMPORTANT: Ownership of the file descriptor object |fd| is passed to |
79 // The file descriptor is owned by the delegate after this call so must be | 80 // the delegate by this call. The delegate is responsible for checking the |
80 // cleaned up if the connection is cancelled or rejected, the |options| | 81 // validity of |fd| on a thread where I/O is permitted before taking the |
81 // structure is not so information out of it must be copied if required. | 82 // value. If the value is not taken, the file descriptor is closed. |
| 83 // |
| 84 // Ownership of |options| is NOT passed so information out of it must be |
| 85 // copied if required. |
82 virtual void NewConnection(const dbus::ObjectPath& device_path, | 86 virtual void NewConnection(const dbus::ObjectPath& device_path, |
83 dbus::FileDescriptor* fd, | 87 scoped_ptr<dbus::FileDescriptor> fd, |
84 const Options& options, | 88 const Options& options, |
85 const ConfirmationCallback& callback) = 0; | 89 const ConfirmationCallback& callback) = 0; |
86 | 90 |
87 // This method will be called when a profile connection to the device | 91 // This method will be called when a profile connection to the device |
88 // with object path |device_path| is disconnected. Any file descriptors | 92 // with object path |device_path| is disconnected. Any file descriptors |
89 // owned by the service should be cleaned up and |callback| called to | 93 // owned by the service should be cleaned up and |callback| called to |
90 // confirm, or indicate rejection or cancellation of the disconnection. | 94 // confirm, or indicate rejection or cancellation of the disconnection. |
91 virtual void RequestDisconnection(const dbus::ObjectPath& device_path, | 95 virtual void RequestDisconnection(const dbus::ObjectPath& device_path, |
92 const ConfirmationCallback& callback) = 0; | 96 const ConfirmationCallback& callback) = 0; |
93 | 97 |
(...skipping 14 matching lines...) Expand all Loading... |
108 protected: | 112 protected: |
109 ExperimentalBluetoothProfileServiceProvider(); | 113 ExperimentalBluetoothProfileServiceProvider(); |
110 | 114 |
111 private: | 115 private: |
112 DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothProfileServiceProvider); | 116 DISALLOW_COPY_AND_ASSIGN(ExperimentalBluetoothProfileServiceProvider); |
113 }; | 117 }; |
114 | 118 |
115 } // namespace chromeos | 119 } // namespace chromeos |
116 | 120 |
117 #endif // CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ | 121 #endif // CHROMEOS_DBUS_EXPERIMENTAL_BLUETOOTH_PROFILE_SERVICE_PROVIDER_H_ |
OLD | NEW |