/* * Copyright (c) 2025, Edwin Hoksberg * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include namespace Web::Serial { // https://wicg.github.io/serial/#serial-interface class Serial : public DOM::EventTarget { WEB_PLATFORM_OBJECT(Serial, DOM::EventTarget); GC_DECLARE_ALLOCATOR(Serial); public: // https://wicg.github.io/serial/#requestport-method WebIDL::ExceptionOr> request_port(Bindings::SerialPortRequestOptions const& = {}); // https://wicg.github.io/serial/#getports-method GC::Ref get_ports(); // https://wicg.github.io/serial/#onconnect-attribute void set_onconnect(WebIDL::CallbackType*); WebIDL::CallbackType* onconnect(); // https://wicg.github.io/serial/#ondisconnect-attribute void set_ondisconnect(WebIDL::CallbackType*); WebIDL::CallbackType* ondisconnect(); private: explicit Serial(JS::Realm&); virtual void initialize(JS::Realm&) override; }; }