Skip to content

Commit

Permalink
chore: remove outdated serial options
Browse files Browse the repository at this point in the history
They was added because they was in the initial POC of the serial API, see https://github.com/google/web-serial-polyfill/blob/de0ad968797af753cd87a07ee529f71718f137c3/serial.ts#L20-L32
  • Loading branch information
mikaello authored Jul 17, 2024
1 parent 8bc4889 commit 5e4a4af
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
3 changes: 2 additions & 1 deletion documentation/research.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Chrome device log: chrome://device-log/
https://no.sport.orientering.narkive.com/EAXxSbGM/mtr-debug-tool
- tTime: http://matthey.no/ttime/ (contains protocol-documentation as well as
MTR debugging tools)
- Hardware readout of EMIT devices: https://gist.github.com/mikaello/791af810d94a0457b9099037d0a1934e
- Hardware readout of EMIT devices:
https://gist.github.com/mikaello/791af810d94a0457b9099037d0a1934e

## Serial API

Expand Down
29 changes: 20 additions & 9 deletions example/serial-types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/** @see https://wicg.github.io/serial/#serialoptions-dictionary */
export interface SerialOptions {
/** The baud rate at which serial communication should be established. */
baudRate:
| 115200
| 57600
Expand All @@ -17,14 +19,15 @@ export interface SerialOptions {
| 110
| 75
| 50;
/** The number of stop bits at the end of the frame. Defaults to 1. */
stopBits?: 1 | 2;
dataBits?: 8 | 7 | 6 | 5;
/** The number of data bits per frame. Defaults to 8. */
dataBits?: 7 | 8;
parity?: (typeof ParityType)[keyof typeof ParityType];
/** An unsigned long integer indicating the size of the read and write buffers that are to be established (must be less than 16MB). Defaults to 255. */
bufferSize?: number;
rtscts?: boolean;
xon?: boolean;
xoff?: boolean;
xany?: boolean;
/** The flow control mode. */
flowControl?: (typeof FlowControl)[keyof typeof FlowControl];
}

interface SerialPortInfo {
Expand All @@ -49,9 +52,9 @@ export interface SerialPortRequestOptions {
* @see https://wicg.github.io/serial/#serialportfilter-dictionary
*/
export interface SerialPortFilter {
/** An unsigned short integer that identifies a USB device vendor. */
/** USB Vendor ID */
usbVendorId: number;
/** An unsigned short integer that identifies a USB device. */
/** USB Product ID */
usbProductId: number;
}

Expand Down Expand Up @@ -80,11 +83,19 @@ declare global {
}

export const ParityType: {
/** No parity bit is sent for each data word. */
NONE: "none";
/** Data word plus parity bit has even parity. */
EVEN: "even";
/** Data word plus parity bit has odd parity. */
ODD: "odd";
MARK: "mark";
SPACE: "space";
};

export const FlowControl: {
/** No flow control is enabled. */
NONE: "none";
/** Hardware flow control using the RTS and CTS signals is enabled. */
HARDWARE: "hardware";
};

interface Navigator {
Expand Down

1 comment on commit 5e4a4af

@mikaello
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like they were in the spec at one point, but removed in WICG/serial#98

Please sign in to comment.