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

Modify docs2 #1898

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/aio.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ interface AIO {
(unsigned long or string) pin;
};<p>interface AIOPin {
unsigned long read();
void readAsync(ReadCallback callback); // TODO: change to return a promise
void on(string eventType, ReadCallback callback);
void readAsync(aio_ReadCallback callback); // TODO: change to return a promise
void on(string eventType, aio_ReadCallback callback);
void close();
};<p>callback ReadCallback = void (unsigned long value);
};<p>callback aio_ReadCallback = void (unsigned long value);
</pre> </details>

AIO API
Expand All @@ -70,10 +70,10 @@ AIOPin API
* Returns: the latest reading from the pin (an unsigned integer). Blocks until it gets the result.

### pin.readAsync(callback)
* 'callback' *ReadCallback* User-provided callback function that takes
* 'callback' *aio_ReadCallback* User-provided callback function that takes
a single unsigned integer and has no return value.

Pass a function for `ReadCallback` that will be called later when the result is
Pass a function for `aio_ReadCallback` that will be called later when the result is
obtained.

*WARNING: Making an async call like this allocates some memory while the call
Expand All @@ -89,7 +89,7 @@ returns a promise.*
### pin.on(eventType, callback)
* 'eventType' *string* Type of event; currently, the only supported
type is "change".
* 'callback' *ReadCallback* User-provided callback function that takes
* 'callback' *aio_ReadCallback* User-provided callback function that takes
a single, unsigned integer and has no return value; can be null.

The callback function is called any time the analog voltage changes. (At the moment,
Expand Down
8 changes: 4 additions & 4 deletions docs/ble.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ dictionary PrimaryServiceInit {
string uuid;
sequence < string > properties; // 'read', 'write', 'notify'
sequence < DescriptorInit > descriptors;
ReadCallback onReadRequest; // optional
ble_ReadCallback onReadRequest; // optional
WriteCallback onWriteRequest; // optional
SubscribeCallback onSubscribe; // optional
UnsubscribeCallback onUnsubscribe; // optional
NotifyCallback onNotify; // optional
};<p>interface Characteristic {
attribute ReadCallback onReadRequest;
attribute ble_ReadCallback onReadRequest;
attribute WriteCallback onWriteRequest;
attribute SubscribeCallback onSubscribe;
attribute UnsubscribeCallback onUnsubscribe;
attribute NotifyCallback onNotify;
attribute CharacteristicResult response;
};<p>callback ReadCallback = void (unsigned long offset,
};<p>callback ble_ReadCallback = void (unsigned long offset,
FulfillReadCallback fulfillReadCallback);
[ExternalInterface=(Buffer)]
callback WriteCallback = void (Buffer data, unsigned long offset,
Expand Down Expand Up @@ -210,7 +210,7 @@ This object has 3 required fields:
3. `descriptors` *array of [Descriptors](#descriptor)*

It may also contain these optional callback fields:
1. `onReadRequest` *ReadCallback*
1. `onReadRequest` *ble_ReadCallback*
* Called when the client is requesting to read data from the characteristic.
* See below for common argument definitions
2. `onWriteRequest` *WriteCallback*
Expand Down
8 changes: 4 additions & 4 deletions docs/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ZJS API for Buffer
* [buf.copy(target[, targetStart, [sourceStart[, sourceEnd]]])](#bufcopytarget-targetstart-sourcestart-sourceend)
* [buf.fill(value[, offset[, end[, encoding]]])](#buffillvalue-offset-end-encoding)
* [buf.readUInt*(offset)](#bufreaduint-family)
* [buf.toString([encoding])](#buftostringencoding)
* [buf.to_string([encoding])](#bufto_stringencoding)
* [buf.write(string[, offset[, length[, encoding]]])](#bufwritestring-offset-length-encoding)
* [buf.writeUInt*(value, offset)](#bufwriteuint-family)
* [Sample Apps](#sample-apps)
Expand All @@ -29,7 +29,7 @@ specific API functions. We have a short document explaining [ZJS WebIDL convent
<details>
<summary> Click to show/hide WebIDL</summary>
<pre>
[ Constructor(sequence < Uint8 > initialValues),
[ Constructor(sequence < octet > initialValues),
Constructor(unsigned long size),
Constructor(ByteString initialString), ]
interface Buffer {
Expand All @@ -46,7 +46,7 @@ interface Buffer {
short readUInt16LE(optional unsigned long offset = 0);
long readUInt32BE(optional unsigned long offset = 0);
long readUInt32LE(optional unsigned long offset = 0);
string toString(string encoding);
string to_string(optional string encoding = "utf8");
long write(string value, optional long offset = 0,
optional long length = 0,
optional string encoding = "utf8");
Expand Down Expand Up @@ -121,7 +121,7 @@ little-endian (lowest byte first) integer depending on the function version.
The `offset` should be provided but will be treated as 0 if not given. Returns
an error if the buffer is not big enough.

### buf.toString([encoding])
### buf.to_string([encoding])
* `encoding` *string* Encoding to use.
* Returns: *string*

Expand Down
6 changes: 3 additions & 3 deletions docs/gpio.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ dictionary GPIOInit {
long read();
void write(long value);
void close();
attribute ChangeCallback onchange;
};<p>callback ChangeCallback = void (GPIOEvent event);<p>dictionary GPIOEvent {
attribute gpio_ChangeCallback onchange;
};<p>callback gpio_ChangeCallback = void (GPIOEvent event);<p>dictionary GPIOEvent {
long value;
};<p>enum GPIOMode { "out", "in" };
enum GPIOEdge { "none", "rising", "falling", "any" };
Expand Down Expand Up @@ -112,7 +112,7 @@ writing anymore.

### pin.onchange

* `onchange` *ChangeCallback*
* `onchange` *gpio_ChangeCallback*

Set this attribute to a function that will receive events whenever the pin
changes according to the edge condition specified at pin initialization. The
Expand Down
4 changes: 2 additions & 2 deletions docs/pme.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ interface PME {
void setClassifierMode(unsigned short mode);
unsigned short getDistanceMode();
void setDistanceMode(unsigned short mode);
sequence < Json > saveNeurons();
void restoreNeurons(sequence < Json > objects);
sequence < JSON > saveNeurons();
void restoreNeurons(sequence < JSON > objects);
<p>
attribute unsigned short RBF_MODE; // RBF classification mode
attribute unsigned short KNN_MODE; // KNN classification mode
Expand Down
20 changes: 10 additions & 10 deletions docs/sensors.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@ explaining [ZJS WebIDL conventions](Notes_on_WebIDL.md).
<summary>Click to show WebIDL</summary>
<pre>
interface Sensor {
readonly attribute boolean activated; // whether the sensor is activated or not
readonly attribute boolean hasReading; // whether the sensor has readings available
readonly attribute double timestamp; // timestamp of the latest reading in milliseconds
attribute double frequency; // sampling frequency in hertz
void start(); // starts the sensor
void stop(); // stops the sensor
attribute ChangeCallback onreading; // callback handler for change events
attribute ActivateCallback onactivate; // callback handler for activate events
attribute ErrorCallback onerror; // callback handler for error events
readonly attribute boolean activated; // whether the sensor is activated or not
readonly attribute boolean hasReading; // whether the sensor has readings available
readonly attribute double timestamp; // timestamp of the latest reading in milliseconds
attribute double frequency; // sampling frequency in hertz
void start(); // starts the sensor
void stop(); // stops the sensor
attribute sensor_ChangeCallback onreading; // callback handler for change events
attribute ActivateCallback onactivate; // callback handler for activate events
attribute ErrorCallback onerror; // callback handler for error events
};<p>
dictionary SensorOptions {
double frequency; // desired frequency, default is 20 if unset
};<p>interface SensorErrorEvent {
attribute Error error;
};<p>callback ChangeCallback = void();
};<p>callback sensor_ChangeCallback = void();
callback ActivateCallback = void();
callback ErrorCallback = void(SensorErrorEvent error);<p>[Constructor(optional AccelerometerOptions accelerometerOptions)]
interface Accelerometer : Sensor {
Expand Down