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" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // Bluetooth daemon, generally at shutdown or at the applications' request. | 67 // Bluetooth daemon, generally at shutdown or at the applications' request. |
68 // It may be used to perform cleanup tasks. | 68 // It may be used to perform cleanup tasks. |
69 virtual void Release() = 0; | 69 virtual void Release() = 0; |
70 | 70 |
71 // This method will be called when a profile connection to the device | 71 // This method will be called when a profile connection to the device |
72 // with object path |device_path| is established. |callback| must be called | 72 // with object path |device_path| is established. |callback| must be called |
73 // to confirm the connection, or indicate rejection or cancellation. | 73 // to confirm the connection, or indicate rejection or cancellation. |
74 // | 74 // |
75 // A file descriptor for the connection socket is provided in |fd|, and | 75 // A file descriptor for the connection socket is provided in |fd|, and |
76 // details about the specific implementation of the profile in |options|. | 76 // details about the specific implementation of the profile in |options|. |
77 // The delegate should take the value and ownership | 77 // |
78 | 78 // 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 | 79 // the delegate by this call, so it must be deleted in all code paths |
80 // cleaned up if the connection is cancelled or rejected, the |options| | 80 // including successful connnection or if the connection is cancelled or |
81 // structure is not so information out of it must be copied if required. | 81 // rejected. The delegate is responsible for checking the validity of |fd| |
| 82 // on a thread where I/O is permitted before taking the value. |
| 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 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, |
(...skipping 16 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 |