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

Commit 728790a

Browse files
committed
OCF: update device and platform properties according to OIC spec 1.1.0
Signed-off-by: Zoltan Kis <[email protected]>
1 parent d0574cf commit 728790a

File tree

3 files changed

+24
-16
lines changed

3 files changed

+24
-16
lines changed

api/ocf/README.md

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ The `options` optional parameter is an object that may contain the following pro
6464

6565
The method runs the following steps:
6666
- Return a [`Promise`](../README.md/#promise) object `promise` and continue [in parallel](https://html.spec.whatwg.org/#in-parallel).
67-
- Let `ocf` denote the API object (equal to the `this` property of `start()`).
6867
- If the `mode` argument is `undefined`, let `mode` be `"client-server"`.
6968
- Otherwise if the `mode` argument is not `"client"`, or `"server"`, or `"client-server"`, reject `promise` with a `TypeError` and abort these steps.
7069
- If the `mode` parameter is `"client"`, then run the following sub-steps:
@@ -93,31 +92,39 @@ Exposes information about the OCF device that runs the current OCF stack instanc
9392
|Property |Type |Optional |Default value |Represents |
9493
| --- | --- | --- | --- | --- |
9594
| `uuid` | string | no | `undefined` | UUID of the device |
96-
| `url` | string | yes | `undefined` | host:port |
9795
| `name` | string | yes | `undefined` | Name of the device |
9896
| `types` | array of strings | no | `[]` | List of supported OCF device types |
9997
| `dataModels` | array of strings | no | `[]` | List of supported OCF data models |
10098
| `coreSpecVersion` | string | no | `undefined` | OCF Core Specification version |
10199

102-
The `types` property is a list of the OCF Device types that are supported. It comforms to the same syntax constraints as [resource](./client.md/#resource) types. OCF mandates that every device supports at least the properties defined in the `"oic.wk.d"` resource type, that represents a resource for a "basic device". Other specifications, such as the OCF Smart Home Device Specification can define more device types, for instance `"oic.d.fan"`, `"oic.d.thermostat"`, `"oic.d.light"`, `"oic.d.airconditioner"`, etc. The properties exposed by these device types are defined in [oneiota.org](http://www.oneiota.org). The values in `types` may be used in [device discovery](./client.md/#finddevices) filters. For a client-only device `types` is an empty array.
100+
The `uuid` property is generated by the underlying OCF stack during the on-boarding process. Applications may provide this property, but it may be changed by the implementation after the device is started.
103101

104-
The `dataModels` property is in the following format: `vertical.major.minor` where `major` and `minor` are numbers and `vertical` is a string such as `"Smart Home"`.
102+
The `name` property represents the device name as provided by the application. Users can also set a free-form device name using the [configure()](./client.md/#configure) method that updates the `oic.wk.con` resource, hence does not alter `name`.
103+
104+
The `types` property is a list of the OCF Device types that are supported. It comforms to the same syntax constraints as [resource](./client.md/#resource) types. OCF mandates that every device supports at least the properties defined in the `"oic.wk.d"` resource type, that represents a resource for a "basic device". Other specifications, such as the OCF Smart Home Device Specification can define more device types, for instance `"oic.d.fan"`, `"oic.d.thermostat"`, `"oic.d.light"`, `"oic.d.airconditioner"`, etc. The properties exposed by these device types are defined in [oneiota.org](http://www.oneiota.org). The values in `types` may be used in [device discovery](./client.md/#finddevices) filters. For a client-only device `types` is an empty array. When a server device registers a new resource with a new resource type, this property SHOULD be updated by the implementation.
105+
106+
Elements of the `dataModels` property are in the following format: `vertical.major.minor.version` where `major`, `minor` and `version` are numbers and `vertical` is a string. For instance, in the OIC 1.1.0 Core Specification the supported data model version is `"res.1.1.0"`.
107+
108+
The `coreSpecVersion` is `"1.1.0"` in this version of the specification.
105109

106110
<a name="ocfplatform"></a>
107111
### The `OcfPlatform` object
108112
Exposes information about the OCF platform that hosts the current device.
109113

110-
|Property |Type |Optional |Default value |Represents |
111-
| --- | --- | --- | --- | --- |
112-
| `id` | string | no | `undefined` | Platform identifier |
113-
| `osVersion` | string | yes | `undefined` | OS version |
114-
| `model` | string | yes | `undefined` | Model of the hardware |
115-
| `manufacturerName` | string | no | `undefined` | Manufacturer name |
116-
| `manufacturerURL` | string | no | `undefined` | Manufacturer web page |
117-
| `manufacturerDate` | Date | no | `undefined` | Manufacturing date |
118-
| `platformVersion` | string | no | `undefined` | Platform version |
119-
| `firmwareVersion` | string | no | `undefined` | Firmware version |
120-
| `supportURL` | string | no | `undefined` | Product support web page |
114+
|Property |Type |Optional |Default value |Represents |
115+
| --- | --- | --- | --- | --- |
116+
| `id` | string | no | `undefined` | Platform identifier |
117+
| `model` | string | yes | `undefined` | Model of the hardware |
118+
| `manufacturerName` | string | no | `undefined` | Manufacturer name |
119+
| `manufacturerLink` | string | yes | `undefined` | Manufacturer URI |
120+
| `manufactureDate` | Date | yes | `undefined` | Manufacturing date |
121+
| `vendorId` | string | yes | `undefined` | Vendor ID |
122+
| `osVersion` | string | yes | `undefined` | OS version |
123+
| `platformVersion` | string | yes | `undefined` | Platform version |
124+
| `firmwareVersion` | string | yes | `undefined` | Firmware version |
125+
| `hardwareVersion` | string | yes | `undefined` | Firmware version |
126+
| `supportURL` | string | yes | `undefined` | Product support web page |
127+
| `datetime` | Date | yes | `undefined` | System time of the device |
121128

122129
<a name="ocferror"></a>
123130
### Error handling

api/ocf/examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ require('ocf').start("client").then(function(client) {
4646
var deviceInit = {
4747
name: "led",
4848
types: [ "oic.wk.d", "oic.wk.p", "oic.wk.res", "oic.d.light" ],
49-
dataModels: [res.1.1.0],
49+
dataModels: ["res.1.1.0"],
5050
coreSpecVersion: "OIC 1.1"
5151
};
5252

api/ocf/server.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ The method runs the following steps:
5252
- Send a request to register the given `resource`, and wait for the answer.
5353
- If there is an error during the request, reject `promise` with that error.
5454
- When the answer is received, update `resource` to be a [`ServerResource`](#serverresource) object.
55+
- Update the [device's](./README.md/#ocfdevice) `types` property, if `resourceType` of `resource` is not in `types`.
5556
- Resolve `promise` with `resource`.
5657

5758
<a name="oncreate"></a>

0 commit comments

Comments
 (0)