#include "third_party/blink/renderer/modules/bluetooth/bluetooth_device.h"
#include <memory>
#include <utility>
#include "third_party/blink/renderer/bindings/core/v8/callback_promise_adapter.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_watch_advertisements_options.h"
#include "third_party/blink/renderer/core/dom/abort_signal.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/modules/bluetooth/bluetooth.h"
#include "third_party/blink/renderer/modules/bluetooth/bluetooth_attribute_instance_map.h"
#include "third_party/blink/renderer/modules/bluetooth/bluetooth_error.h"
#include "third_party/blink/renderer/modules/bluetooth/bluetooth_remote_gatt_server.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
namespace blink {
const char kAbortErrorMessage[] = …;
const char kInactiveDocumentError[] = …;
const char kInvalidStateErrorMessage[] = …;
BluetoothDevice::BluetoothDevice(ExecutionContext* context,
mojom::blink::WebBluetoothDevicePtr device,
Bluetooth* bluetooth)
: … { … }
BluetoothRemoteGATTService* BluetoothDevice::GetOrCreateRemoteGATTService(
mojom::blink::WebBluetoothRemoteGATTServicePtr service,
bool is_primary,
const String& device_instance_id) { … }
bool BluetoothDevice::IsValidService(const String& service_instance_id) { … }
BluetoothRemoteGATTCharacteristic*
BluetoothDevice::GetOrCreateRemoteGATTCharacteristic(
ExecutionContext* context,
mojom::blink::WebBluetoothRemoteGATTCharacteristicPtr characteristic,
BluetoothRemoteGATTService* service) { … }
bool BluetoothDevice::IsValidCharacteristic(
const String& characteristic_instance_id) { … }
BluetoothRemoteGATTDescriptor*
BluetoothDevice::GetOrCreateBluetoothRemoteGATTDescriptor(
mojom::blink::WebBluetoothRemoteGATTDescriptorPtr descriptor,
BluetoothRemoteGATTCharacteristic* characteristic) { … }
bool BluetoothDevice::IsValidDescriptor(const String& descriptor_instance_id) { … }
void BluetoothDevice::ClearAttributeInstanceMapAndFireEvent() { … }
const WTF::AtomicString& BluetoothDevice::InterfaceName() const { … }
ExecutionContext* BluetoothDevice::GetExecutionContext() const { … }
void BluetoothDevice::Trace(Visitor* visitor) const { … }
ScriptPromise<IDLUndefined> BluetoothDevice::watchAdvertisements(
ScriptState* script_state,
const WatchAdvertisementsOptions* options,
ExceptionState& exception_state) { … }
void BluetoothDevice::AbortWatchAdvertisements(AbortSignal* signal) { … }
ScriptPromise<IDLUndefined> BluetoothDevice::forget(
ScriptState* script_state,
ExceptionState& exception_state) { … }
void BluetoothDevice::AdvertisingEvent(
mojom::blink::WebBluetoothAdvertisingEventPtr advertising_event) { … }
bool BluetoothDevice::HasPendingActivity() const { … }
void BluetoothDevice::AddedEventListener(
const AtomicString& event_type,
RegisteredEventListener& registered_listener) { … }
void BluetoothDevice::WatchAdvertisementsCallback(
mojom::blink::WebBluetoothResult result) { … }
}