// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://wicg.github.io/serial
[
ActiveScriptWrappable,
Exposed(Window Serial,DedicatedWorker Serial),
SecureContext
] interface SerialPort : EventTarget {
attribute EventHandler onconnect;
attribute EventHandler ondisconnect;
[RuntimeEnabled=SerialPortConnected] readonly attribute boolean connected;
[CallWith=ScriptState, RaisesException]
readonly attribute ReadableStream readable;
[CallWith=ScriptState, RaisesException]
readonly attribute WritableStream writable;
[MeasureAs=SerialPortGetInfo] SerialPortInfo getInfo();
[CallWith=ScriptState, RaisesException, MeasureAs=SerialPortOpen]
Promise<undefined> open(SerialOptions options);
[CallWith=ScriptState, RaisesException]
Promise<SerialInputSignals> getSignals();
[CallWith=ScriptState, RaisesException]
Promise<undefined> setSignals(optional SerialOutputSignals signals = {});
[RaisesException, CallWith=ScriptState, MeasureAs=SerialPortClose]
Promise<undefined> close();
[RaisesException, CallWith=ScriptState, MeasureAs=SerialPortForget]
Promise<undefined> forget();
};