#include "device/bluetooth/floss/bluetooth_socket_floss.h"
#include "base/task/sequenced_task_runner.h"
#include "device/bluetooth/floss/bluetooth_adapter_floss.h"
#include "device/bluetooth/floss/bluetooth_device_floss.h"
#include "device/bluetooth/floss/floss_dbus_client.h"
#include "device/bluetooth/floss/floss_dbus_manager.h"
#include "device/bluetooth/floss/floss_socket_manager.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
namespace floss {
namespace {
const char kInvalidSocketType[] = …;
const char kInvalidUUID[] = …;
const char kSocketNotListening[] = …;
const char kSocketListenFailed[] = …;
const char kSocketAcceptFailed[] = …;
const char kSocketFailedToConnect[] = …;
const char kSocketInvalidFd[] = …;
const char kSocketAlreadyConnected[] = …;
const char kSocketErrorAdopting[] = …;
}
scoped_refptr<BluetoothSocketFloss> BluetoothSocketFloss::CreateBluetoothSocket(
scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
scoped_refptr<device::BluetoothSocketThread> socket_thread) { … }
BluetoothSocketFloss::AcceptRequest::AcceptRequest() = default;
BluetoothSocketFloss::AcceptRequest::~AcceptRequest() = default;
BluetoothSocketFloss::BluetoothSocketFloss(
scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
scoped_refptr<device::BluetoothSocketThread> socket_thread)
: … { … }
BluetoothSocketFloss::~BluetoothSocketFloss() = default;
void BluetoothSocketFloss::Connect(BluetoothDeviceFloss* device,
const FlossSocketManager::Security security,
const device::BluetoothUUID& uuid,
base::OnceClosure success_callback,
ErrorCompletionCallback error_callback) { … }
void BluetoothSocketFloss::Listen(
scoped_refptr<device::BluetoothAdapter> adapter,
FlossSocketManager::SocketType socket_type,
const std::optional<device::BluetoothUUID>& uuid,
const device::BluetoothAdapter::ServiceOptions& service_options,
base::OnceClosure success_callback,
ErrorCompletionCallback error_callback) { … }
void BluetoothSocketFloss::Disconnect(base::OnceClosure callback) { … }
void BluetoothSocketFloss::Accept(AcceptCompletionCallback success_callback,
ErrorCompletionCallback error_callback) { … }
void BluetoothSocketFloss::DoConnectionStateChanged(
FlossSocketManager::ServerSocketState state,
FlossSocketManager::FlossListeningSocket socket,
FlossDBusClient::BtifStatus status) { … }
void BluetoothSocketFloss::DoConnectionAccepted(
FlossSocketManager::FlossSocket&& socket) { … }
void BluetoothSocketFloss::CompleteListen(
base::OnceClosure success_callback,
ErrorCompletionCallback error_callback,
DBusResult<FlossDBusClient::BtifStatus> result) { … }
void BluetoothSocketFloss::CompleteConnect(
base::OnceClosure success_callback,
ErrorCompletionCallback error_callback,
FlossDBusClient::BtifStatus status,
std::optional<FlossSocketManager::FlossSocket>&& socket) { … }
void BluetoothSocketFloss::CompleteConnectionInSocketThread(
base::OnceClosure success_callback,
ErrorCompletionCallback error_callback,
FlossDBusClient::BtifStatus status,
std::optional<FlossSocketManager::FlossSocket>&& socket) { … }
void BluetoothSocketFloss::CompleteAccept(
DBusResult<FlossDBusClient::BtifStatus> result) { … }
void BluetoothSocketFloss::CompleteClose(
base::OnceClosure callback,
DBusResult<FlossDBusClient::BtifStatus> result) { … }
void BluetoothSocketFloss::CompleteListeningConnect() { … }
}