Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit cef5c0d

Browse files
t-harveyJimmy Huang
t-harvey
authored and
Jimmy Huang
committed
Fixed small things on grove and web-socket and redid webusb, which I (#1895)
somehow missed on the first go around. Signed-off-by: Timothy Harvey <[email protected]>
1 parent 6d21e17 commit cef5c0d

File tree

3 files changed

+40
-23
lines changed

3 files changed

+40
-23
lines changed

docs/grove_lcd.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ ZJS API for Grove LCD
1515
* [groveLCDDevice.getFunction()](#grovelcddevicegetfunction)
1616
* [groveLCDDevice.setDisplayState(config)](#grovelcddevicesetdisplaystateconfig)
1717
* [GroveLCDDevice.getDisplayState()](#grovelcddevicegetdisplaystate)
18-
1918
* [Sample Apps](#sample-apps)
2019

2120
Introduction

docs/web-socket.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,22 @@ explaining [ZJS WebIDL conventions](Notes_on_WebIDL.md).
3636
// var ws = require('ws');
3737
[ReturnFromRequire]
3838
interface WebSocket {
39-
WebSocketServer Server(object options);
39+
WebSocketServer Server(OptionsObject options);
4040
};<p>
4141
[ExternalInterface=(EventEmitter)]
4242
interface WebSocketServer: EventEmitter{};<p>[ExternalInterface=(Buffer),]
4343
interface WebSocketConnection: EventEmitter {
4444
void send(Buffer data, boolean mask);
4545
void ping(Buffer data, boolean mask);
4646
void pong(Buffer data, boolean mask);
47-
};</pre>
47+
};<p>dictionary OptionsObject {
48+
double port; // Port to bind to
49+
boolean backlog; // Max number of concurrent connections
50+
boolean clientTracking; // enable client tracking
51+
double maxPayload; // set the max payload bytes per message
52+
string acceptHandler; // handler to call to accept/deny connections
53+
};
54+
</pre>
4855
</details>
4956

5057
WebSocket API

docs/webusb.md

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ Zephyr.js API for WebUSB
22
========================
33

44
* [Introduction](#introduction)
5-
* [Class: WebUSB](#class-webusb)
6-
* [API Documentation](#api-documentation)
5+
* [Class: WebUSB](#webusb-api)
6+
* [webusb.setURL(url)](#webusbseturlurl)
7+
* [webusb.write(buffer)](#webusbwritebuffer)
8+
* [Event: 'read'](#event-read)
79
* [Sample Apps](#sample-apps)
810

911
Introduction
@@ -19,31 +21,40 @@ When you connect your device to a Linux PC or Mac with Chrome >= 60 running, it
1921
will give a notification that the device would like you to visit the URL you've
2022
set. (Windows currently prevents this from working, I believe.)
2123

22-
API Documentation
23-
-----------------
24+
Web IDL
25+
-------
26+
This IDL provides an overview of the interface; see below for documentation of
27+
specific API functions. We also have a short document explaining [ZJS WebIDL conventions](Notes_on_WebIDL.md).
28+
<details>
29+
<summary> Click to show/hide WebIDL</summary>
30+
<pre>
31+
// require returns a webusb object
32+
// var webusb = require('webusb');<p>[ReturnFromRequire, ExternalInterface=(Buffer)]
33+
interface webusb {
34+
void setURL(string url);
35+
void write(Buffer buf);
36+
};
37+
</pre>
38+
</details>
39+
40+
webusb API
41+
----------
42+
43+
### webusb.setURL(url)
44+
* `url` *string* Should begin with "https://" for Chrome to accept it
45+
and display a notification. Other URLs are valid in terms of the protocol but
46+
will have no user-visible effect in Chrome.
47+
48+
### webusb.write(buffer)
49+
* `write` *Buffer* Writes the data in `buffer` to the WebUSB TX line. By default, at most 511 bytes can be pending at one time, so that is the maximum write size, assuming all previous data has already been flushed out. An error will be thrown on overflow.
50+
2451
### Event: 'read'
2552

2653
* `Buffer` `data`
2754

2855
Emitted when data is received on the WebUSB RX line. The `data` parameter is a
2956
`Buffer` with the received data.
3057

31-
### WebUSB.setURL
32-
33-
`void setURL(string url);`
34-
35-
The `url` string should begin with "https://" in order for Chrome to accept it
36-
and display a notification. Other URLs are valid in terms of the protocol but
37-
will have no user-visible effect in Chrome.
38-
39-
### WebUSB.write
40-
41-
`void write(Buffer buffer);`
42-
43-
Writes the data in `buffer` to the WebUSB TX line. By default at most 511 bytes
44-
can be pending at one time, so that is the maximum write size, assuming all
45-
previous data had already been flushed out. An error will be thrown on overflow.
46-
4758
Sample Apps
4859
-----------
4960
* [WebUSB sample](../samples/WebUSB.js)

0 commit comments

Comments
 (0)