17d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 2b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)// found in the LICENSE file. 4b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 57d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#ifndef DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ 67d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ 7b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 8cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include <queue> 9cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include <string> 10cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 11cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "base/memory/linked_ptr.h" 12cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "base/memory/scoped_ptr.h" 13b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#include "chromeos/chromeos_export.h" 14cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "chromeos/dbus/bluetooth_profile_manager_client.h" 15cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "chromeos/dbus/bluetooth_profile_service_provider.h" 16cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "dbus/object_path.h" 17cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "device/bluetooth/bluetooth_adapter.h" 18b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#include "device/bluetooth/bluetooth_socket.h" 19010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)#include "device/bluetooth/bluetooth_socket_net.h" 20cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "device/bluetooth/bluetooth_uuid.h" 21b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 22b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)namespace dbus { 23b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)class FileDescriptor; 24b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)} // namespace dbus 25b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 26b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)namespace chromeos { 27b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 28cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class BluetoothDeviceChromeOS; 29cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 307d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// The BluetoothSocketChromeOS class implements BluetoothSocket for the 317d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// Chrome OS platform. 327d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)class CHROMEOS_EXPORT BluetoothSocketChromeOS 33cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) : public device::BluetoothSocketNet, 34cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) public device::BluetoothAdapter::Observer, 35cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) public BluetoothProfileServiceProvider::Delegate { 36b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) public: 3703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) enum SecurityLevel { 3803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) SECURITY_LEVEL_LOW, 3903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) SECURITY_LEVEL_MEDIUM 4003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) }; 4103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 42010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) static scoped_refptr<BluetoothSocketChromeOS> CreateBluetoothSocket( 43010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) scoped_refptr<base::SequencedTaskRunner> ui_task_runner, 445f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) scoped_refptr<device::BluetoothSocketThread> socket_thread); 45b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 46cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Connects this socket to the service on |device| published as UUID |uuid|, 47cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // the underlying protocol and PSM or Channel is obtained through service 48cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // discovery. On a successful connection the socket properties will be updated 49cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // and |success_callback| called. On failure |error_callback| will be called 50cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // with a message explaining the cause of the failure. 51cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Connect(const BluetoothDeviceChromeOS* device, 52cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const device::BluetoothUUID& uuid, 5303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) SecurityLevel security_level, 54010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) const base::Closure& success_callback, 55010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) const ErrorCompletionCallback& error_callback); 56b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 57cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Listens using this socket using a service published on |adapter|. The 58cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // service is either RFCOMM or L2CAP depending on |socket_type| and published 59116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // as UUID |uuid|. The |service_options| argument is interpreted according to 60f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) // |socket_type|. |success_callback| will be called if the service is 61f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) // successfully registered, |error_callback| on failure with a message 62f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) // explaining the cause. 63cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) enum SocketType { kRfcomm, kL2cap }; 64116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch virtual void Listen( 65116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch scoped_refptr<device::BluetoothAdapter> adapter, 66116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch SocketType socket_type, 67116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch const device::BluetoothUUID& uuid, 68116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch const device::BluetoothAdapter::ServiceOptions& service_options, 69116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch const base::Closure& success_callback, 70116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch const ErrorCompletionCallback& error_callback); 71cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 72cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // BluetoothSocket: 73cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Close() OVERRIDE; 74cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Disconnect(const base::Closure& callback) OVERRIDE; 75cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Accept(const AcceptCompletionCallback& success_callback, 76cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const ErrorCompletionCallback& error_callback) OVERRIDE; 77cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 78cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Returns the object path of the socket. 79cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const dbus::ObjectPath& object_path() const { return object_path_; } 80cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 81b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) protected: 827d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) virtual ~BluetoothSocketChromeOS(); 83b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 84b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) private: 85010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) BluetoothSocketChromeOS( 86010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) scoped_refptr<base::SequencedTaskRunner> ui_task_runner, 875f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) scoped_refptr<device::BluetoothSocketThread> socket_thread); 88b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 89cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Register the underlying profile client object with the Bluetooth Daemon. 90cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void RegisterProfile(const base::Closure& success_callback, 91cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const ErrorCompletionCallback& error_callback); 92cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void OnRegisterProfile(const base::Closure& success_callback, 93cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const ErrorCompletionCallback& error_callback); 94cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void OnRegisterProfileError(const ErrorCompletionCallback& error_callback, 95cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const std::string& error_name, 96cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const std::string& error_message); 97cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 98cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Called by dbus:: on completion of the ConnectProfile() method. 99cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void OnConnectProfile(const base::Closure& success_callback); 100cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void OnConnectProfileError(const ErrorCompletionCallback& error_callback, 101cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const std::string& error_name, 102cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const std::string& error_message); 103cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 104cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // BluetoothAdapter::Observer: 105cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void AdapterPresentChanged(device::BluetoothAdapter* adapter, 106cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) bool present) OVERRIDE; 107cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 108cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Called by dbus:: on completion of the RegisterProfile() method call 109cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // triggered as a result of the adapter becoming present again. 110cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void OnInternalRegisterProfile(); 111cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void OnInternalRegisterProfileError(const std::string& error_name, 112cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const std::string& error_message); 113cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 114cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // BluetoothProfileServiceProvider::Delegate: 115cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Released() OVERRIDE; 116cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void NewConnection( 117cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const dbus::ObjectPath& device_path, 118cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) scoped_ptr<dbus::FileDescriptor> fd, 119cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const BluetoothProfileServiceProvider::Delegate::Options& options, 120cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const ConfirmationCallback& callback) OVERRIDE; 121cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void RequestDisconnection( 122cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const dbus::ObjectPath& device_path, 123cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const ConfirmationCallback& callback) OVERRIDE; 124cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Cancel() OVERRIDE; 125cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 126cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Method run to accept a single incoming connection. 127cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void AcceptConnectionRequest(); 128cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 129cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Method run on the socket thread to validate the file descriptor of a new 130cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // connection and set up the underlying net::TCPSocket() for it. 131cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void DoNewConnection( 132cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const dbus::ObjectPath& device_path, 133cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) scoped_ptr<dbus::FileDescriptor> fd, 134cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const BluetoothProfileServiceProvider::Delegate::Options& options, 135cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const ConfirmationCallback& callback); 136cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 137cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Method run on the UI thread after a new connection has been accepted and 138cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // a socket allocated in |socket|. Takes care of calling the Accept() 139cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // callback and |callback| with the right arguments based on |status|. 140cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void OnNewConnection(scoped_refptr<BluetoothSocket> socket, 141cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const ConfirmationCallback& callback, 142cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) Status status); 143cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 144cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Method run on the socket thread with a valid file descriptor |fd|, once 145cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // complete calls |callback| on the UI thread with an appropriate argument 146cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // indicating success or failure. 147010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles) void DoConnect(scoped_ptr<dbus::FileDescriptor> fd, 148cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const ConfirmationCallback& callback); 149cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 150cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Method run to clean-up a listening socket. 151cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void DoCloseListening(); 152cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 153cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Unregister the underlying profile client object from the Bluetooth Daemon. 154cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void UnregisterProfile(); 155cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void OnUnregisterProfile(const dbus::ObjectPath& object_path); 156cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void OnUnregisterProfileError(const dbus::ObjectPath& object_path, 157cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const std::string& error_name, 158cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const std::string& error_message); 159cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 160cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Adapter the profile is registered against; this is only present when the 161cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // socket is listening. 162cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) scoped_refptr<device::BluetoothAdapter> adapter_; 163cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 164cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Address and D-Bus object path of the device being connected to, empty and 165cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // ignored if the socket is listening. 166cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) std::string device_address_; 167cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) dbus::ObjectPath device_path_; 168cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 169cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // UUID of the profile being connected to, or listening on. 170cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) device::BluetoothUUID uuid_; 171cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 172cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Copy of the profile options used for registering the profile. 173cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) scoped_ptr<BluetoothProfileManagerClient::Options> options_; 174cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 175cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Object path of the local profile D-Bus object. 176cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) dbus::ObjectPath object_path_; 177cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 178cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Local profile D-Bus object used for receiving profile delegate methods 179cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // from BlueZ. 180cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) scoped_ptr<BluetoothProfileServiceProvider> profile_; 181cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 182cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Pending request to an Accept() call. 183cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) struct AcceptRequest { 184cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) AcceptRequest(); 185cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) ~AcceptRequest(); 186cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 187cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) AcceptCompletionCallback success_callback; 188cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) ErrorCompletionCallback error_callback; 189cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) }; 190cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) scoped_ptr<AcceptRequest> accept_request_; 191cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 192cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Queue of incoming connection requests. 193cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) struct ConnectionRequest { 194cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) ConnectionRequest(); 195cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) ~ConnectionRequest(); 196b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 197cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) dbus::ObjectPath device_path; 198cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) scoped_ptr<dbus::FileDescriptor> fd; 199cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) BluetoothProfileServiceProvider::Delegate::Options options; 200cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) ConfirmationCallback callback; 201cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) bool accepting; 202cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) bool cancelled; 203cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) }; 204cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) std::queue<linked_ptr<ConnectionRequest> > connection_request_queue_; 205b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 2067d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(BluetoothSocketChromeOS); 207b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)}; 208b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 209b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)} // namespace chromeos 210b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 2117d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ 212