diff --git a/docs/aio.md b/docs/aio.md index bdd1d153d..65f9658cd 100644 --- a/docs/aio.md +++ b/docs/aio.md @@ -45,10 +45,10 @@ interface AIO { (unsigned long or string) pin; };

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(); -};

callback ReadCallback = void (unsigned long value); +};

callback aio_ReadCallback = void (unsigned long value); AIO API @@ -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 @@ -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, diff --git a/docs/ble.md b/docs/ble.md index 5908562d4..a27d10faf 100644 --- a/docs/ble.md +++ b/docs/ble.md @@ -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 };

interface Characteristic { - attribute ReadCallback onReadRequest; + attribute ble_ReadCallback onReadRequest; attribute WriteCallback onWriteRequest; attribute SubscribeCallback onSubscribe; attribute UnsubscribeCallback onUnsubscribe; attribute NotifyCallback onNotify; attribute CharacteristicResult response; -};

callback ReadCallback = void (unsigned long offset, +};

callback ble_ReadCallback = void (unsigned long offset, FulfillReadCallback fulfillReadCallback); [ExternalInterface=(Buffer)] callback WriteCallback = void (Buffer data, unsigned long offset, @@ -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* diff --git a/docs/buffer.md b/docs/buffer.md index 56b8b25e3..5b324b588 100644 --- a/docs/buffer.md +++ b/docs/buffer.md @@ -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) @@ -29,7 +29,7 @@ specific API functions. We have a short document explaining [ZJS WebIDL convent

Click to show/hide WebIDL
-[ Constructor(sequence < Uint8 > initialValues),
+[ Constructor(sequence < octet > initialValues),
   Constructor(unsigned long size),
   Constructor(ByteString initialString), ]
 interface Buffer {
@@ -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");
@@ -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*
 
diff --git a/docs/gpio.md b/docs/gpio.md
index 5e9d9769a..c4feff37b 100644
--- a/docs/gpio.md
+++ b/docs/gpio.md
@@ -44,8 +44,8 @@ dictionary GPIOInit {
     long read();
     void write(long value);
     void close();
-    attribute ChangeCallback onchange;
-};

callback ChangeCallback = void (GPIOEvent event);

dictionary GPIOEvent { + attribute gpio_ChangeCallback onchange; +};

callback gpio_ChangeCallback = void (GPIOEvent event);

dictionary GPIOEvent { long value; };

enum GPIOMode { "out", "in" }; enum GPIOEdge { "none", "rising", "falling", "any" }; @@ -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 diff --git a/docs/pme.md b/docs/pme.md index 148e95099..12264b38e 100644 --- a/docs/pme.md +++ b/docs/pme.md @@ -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);

attribute unsigned short RBF_MODE; // RBF classification mode attribute unsigned short KNN_MODE; // KNN classification mode diff --git a/docs/sensors.md b/docs/sensors.md index 5f6d0f0d6..9baed6044 100644 --- a/docs/sensors.md +++ b/docs/sensors.md @@ -37,21 +37,21 @@ explaining [ZJS WebIDL conventions](Notes_on_WebIDL.md).

Click to show WebIDL
 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
 };

dictionary SensorOptions { double frequency; // desired frequency, default is 20 if unset };

interface SensorErrorEvent { attribute Error error; -};

callback ChangeCallback = void(); +};

callback sensor_ChangeCallback = void(); callback ActivateCallback = void(); callback ErrorCallback = void(SensorErrorEvent error);

[Constructor(optional AccelerometerOptions accelerometerOptions)] interface Accelerometer : Sensor {