#include "device/bluetooth/bluetooth_remote_gatt_characteristic.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/task/single_thread_task_runner.h"
#include "device/bluetooth/bluetooth_gatt_notify_session.h"
#include "device/bluetooth/bluetooth_remote_gatt_descriptor.h"
namespace device {
BluetoothRemoteGattCharacteristic::CommandStatus::CommandStatus(
CommandType type,
std::optional<BluetoothRemoteGattService::GattErrorCode> error_code)
: … { … }
BluetoothRemoteGattCharacteristic::CommandStatus::CommandStatus(
CommandStatus&& other) = default;
BluetoothRemoteGattCharacteristic::BluetoothRemoteGattCharacteristic() { … }
BluetoothRemoteGattCharacteristic::~BluetoothRemoteGattCharacteristic() { … }
std::vector<BluetoothRemoteGattDescriptor*>
BluetoothRemoteGattCharacteristic::GetDescriptors() const { … }
BluetoothRemoteGattDescriptor* BluetoothRemoteGattCharacteristic::GetDescriptor(
const std::string& identifier) const { … }
std::vector<BluetoothRemoteGattDescriptor*>
BluetoothRemoteGattCharacteristic::GetDescriptorsByUUID(
const BluetoothUUID& uuid) const { … }
base::WeakPtr<device::BluetoothRemoteGattCharacteristic>
BluetoothRemoteGattCharacteristic::GetWeakPtr() { … }
bool BluetoothRemoteGattCharacteristic::IsNotifying() const { … }
BluetoothRemoteGattCharacteristic::NotifySessionCommand::NotifySessionCommand(
ExecuteCallback execute_callback,
base::OnceClosure cancel_callback)
: … { … }
BluetoothRemoteGattCharacteristic::NotifySessionCommand::NotifySessionCommand(
NotifySessionCommand&& other) = default;
BluetoothRemoteGattCharacteristic::NotifySessionCommand::
~NotifySessionCommand() = default;
void BluetoothRemoteGattCharacteristic::NotifySessionCommand::Execute() { … }
void BluetoothRemoteGattCharacteristic::NotifySessionCommand::Execute(
CommandStatus previous_command) { … }
void BluetoothRemoteGattCharacteristic::NotifySessionCommand::Cancel() { … }
void BluetoothRemoteGattCharacteristic::StartNotifySession(
NotifySessionCallback callback,
ErrorCallback error_callback) { … }
#if BUILDFLAG(IS_CHROMEOS)
void BluetoothRemoteGattCharacteristic::StartNotifySession(
NotificationType notification_type,
NotifySessionCallback callback,
ErrorCallback error_callback) {
StartNotifySessionInternal(notification_type, std::move(callback),
std::move(error_callback));
}
#endif
bool BluetoothRemoteGattCharacteristic::AddDescriptor(
std::unique_ptr<BluetoothRemoteGattDescriptor> descriptor) { … }
void BluetoothRemoteGattCharacteristic::StartNotifySessionInternal(
const std::optional<NotificationType>& notification_type,
NotifySessionCallback callback,
ErrorCallback error_callback) { … }
void BluetoothRemoteGattCharacteristic::ExecuteStartNotifySession(
const std::optional<NotificationType>& notification_type,
NotifySessionCallback callback,
ErrorCallback error_callback,
CommandStatus previous_command) { … }
void BluetoothRemoteGattCharacteristic::CancelStartNotifySession(
base::OnceClosure callback) { … }
void BluetoothRemoteGattCharacteristic::OnStartNotifySessionSuccess(
NotifySessionCallback callback) { … }
void BluetoothRemoteGattCharacteristic::OnStartNotifySessionError(
ErrorCallback error_callback,
BluetoothGattService::GattErrorCode error) { … }
void BluetoothRemoteGattCharacteristic::StopNotifySession(
BluetoothGattNotifySession::Id session,
base::OnceClosure callback) { … }
void BluetoothRemoteGattCharacteristic::ExecuteStopNotifySession(
BluetoothGattNotifySession::Id session,
base::OnceClosure callback,
CommandStatus previous_command) { … }
void BluetoothRemoteGattCharacteristic::CancelStopNotifySession(
base::OnceClosure callback) { … }
void BluetoothRemoteGattCharacteristic::OnStopNotifySessionSuccess(
BluetoothGattNotifySession::Id session,
base::OnceClosure callback) { … }
void BluetoothRemoteGattCharacteristic::OnStopNotifySessionError(
BluetoothGattNotifySession::Id session,
base::OnceClosure callback,
BluetoothGattService::GattErrorCode error) { … }
bool BluetoothRemoteGattCharacteristic::IsNotificationTypeSupported(
const std::optional<NotificationType>& notification_type) { … }
}