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

Commit d25677e

Browse files
committed
Add version properties to API objects
1 parent e715a8f commit d25677e

File tree

5 files changed

+22
-6
lines changed

5 files changed

+22
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The following JavaScript APIs are aimed for handling Internet of Things (IoT) ap
99
- [OCF API Test Suite](./ocf/test-suite/README.md)
1010
* [Bluetooth Smart API](./ble/README.md), exposing functionality for Bluetooth Peripheral mode
1111
* [Sensor API](./sensors/README.md), exposing sensor functionality supported on the device
12-
* [Board API](./board/README.md) provides low level interfaces for I/O operations supported by the device board, so that applications could implement support for new types of sensors that are not supported by the Sensor API.
12+
* [Board API](./board/README.md) providing low-level interfaces for I/O operations supported by the device board, so that applications could implement support for new types of sensors that are not supported by the Sensor API.
1313

1414
Since implementations of these APIs exist also on constrained hardware, they might not support the latest [ECMAScript](http://www.ecma-international.org) versions. However, implementations should support at least [ECMAScript 5.1](http://www.ecma-international.org/ecma-262/5.1/). Examples are limited to ECMAScript 5.1 with the exception of using [Promises](#promise).
1515

ble/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ This object is created and returned by `require`. It has the following read-only
4646
| `name` | String | yes | `undefined` | the Bluetooth Device Name in scan responses |
4747
| `enabled` | boolean | no | false | whether Bluetooth is enabled |
4848
| `services` | array of [service objects](#service) | no | [] | Primary services on the device |
49+
| `version` | string | no | `version` in[`package.json`](../package.json) | API version |
4950

5051
| Event name | Event callback argument |
5152
| --- | --- |
@@ -80,6 +81,9 @@ The `enabled` property MUST be set to `true` if the Bluetooth Smart functionalit
8081
<a name="bd_services">
8182
The `services` property is a read-only array (sequence) of [`BluetoothService`](#service) objects that represents the primary GATT services on the device. A primary service is visible at device root level, and it may contain other services.
8283

84+
<a name="version"></a>
85+
The `version` property is read-only, and provides the master API version, as specified in the `version` property of [`package.json`](../package.json).
86+
8387
#### `BluetoothPeripheralDevice` events
8488

8589
<a name="onstatechange"></a>

board/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Represents a hardware board.
5555
| Property | Type | Optional | Default value | Represents |
5656
| --- | --- | --- | --- | --- |
5757
| [`name`](#name) | String | no | `undefined` | board name |
58+
| [`version`](#version) | String | no | `versions.board` in [`package.json`](../package.json) | API version |
5859

5960
| Method signature | Description |
6061
| --- | --- |
@@ -72,6 +73,9 @@ Represents a hardware board.
7273
<a name="name"></a>
7374
The `name` property is read-only, and provides the board name.
7475

76+
<a name="version"></a>
77+
The `version` property is read-only, and provides the provides the Board API version, as specified in the `versions.board` property of [`package.json`](../package.json).
78+
7579
<a name="error"></a>
7680
Board errors are represented as augmented [`Error`](https://nodejs.org/api/errors.html#errors_class_error) objects. The following [`Error` names](https://nodejs.org/api/errors.html) are used for signaling issues:
7781
- `BoardDisconnectError`

ocf/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,19 @@ var ocf = require(module);
4343
```
4444
If the functionality is not supported by the platform, `require` should throw `NotSupportedError`. If there is no permission for using the functionality, `require` should throw `SecurityError`.
4545

46-
When `require` is successful, it MUST return an object with the following methods.
46+
When `require` is successful, it MUST return an object with the following properties and methods.
47+
48+
|Property |Type |Optional |Default value | Represents |
49+
| --- | --- | --- | --- |
50+
| `version` | string | no | `versions.ocf` in [`package.json`](../package.json) | API version |
4751

4852
| Method signature | Description |
4953
| --- | --- |
5054
| [`start(mode, options)`](#ocfstart)| start the OCF stack |
5155
| [`stop()`](#ocfstop) | stop the OCF stack |
5256

57+
The `version` property is read only and provides the the OCF API specification, as specified in the `versions.ocf` property of [`package.json`](../package.json).
58+
5359
<a name="ocfstart"></a>
5460
The `start(options)` method initializes the underlying platform and resolves with an API object providing OCF client, or server, or both client-server functionality.
5561

versions.json renamed to package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
"description": "OCF JS API specifications and test suites",
44

55
"version": "1.0",
6-
"ocfApiVersion": "oic1.1.0-0",
7-
"bleApiVersion": "1.0",
8-
"boardApiVersion": "1.0",
9-
"sensorApiVersion": "1.0",
6+
"versions": {
7+
"ocf": "oic1.1.0-0",
8+
"ble": "1.0",
9+
"board": "1.0",
10+
"sensor": "1.0",
11+
},
1012

1113
"license": "Apache-2.0",
1214

0 commit comments

Comments
 (0)