You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: draft-mohan-asdf-sdf-protocol-mapping.md
+71-6Lines changed: 71 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,12 +104,13 @@ protocol-specific operation, as implementations of the same affordance will
104
104
differ between protocols. For example, BLE will address a property as a service
105
105
characteristic, while a property in Zigbee is addressed as an attribute in a
106
106
cluster of an endpoint. Again, HTTP is addressed by a method, an endpoint path,
107
-
an optional query string, optional headers, and an optional body.
107
+
an optional query string, optional headers, and an optional body. Finally, CoAP
108
+
is addressed by a method, a URI, an optional query string and options set.
108
109
109
110
A protocol mapping object is a JSON object identified by the `sdfProtocolMap`
110
111
keyword. Protocol-specific properties are embedded within this object, organized
111
-
by protocol name, e.g., "ble" or "zigbee" or "http". The protocol name MUST be
112
-
specified in the IANA registry requested in {{iana-prot-map}}.
112
+
by protocol name, e.g., "ble" or "zigbee" or "http" or "coap". The protocol name
113
+
MUST be specified in the IANA registry requested in {{iana-prot-map}}.
113
114
114
115
~~~ aasvg
115
116
sdfProtocolMap
@@ -123,8 +124,11 @@ sdfProtocolMap
123
124
| +--> Zigbee-specific mapping
124
125
|
125
126
+-----> http
126
-
|
127
-
+--> HTTP-specific mapping
127
+
| |
128
+
| +--> HTTP-specific mapping
129
+
+-----> coap
130
+
| |
131
+
| +--> CoAP-specific mapping
128
132
~~~
129
133
{: #protmap title="Property Mapping"}
130
134
@@ -344,7 +348,7 @@ parameters that are used to access the corresponding SDF affordances.
344
348
~~~ cddl
345
349
{::include cddl/http-protocol-map.cddl}
346
350
~~~
347
-
{: #httpmap1 title="CDDL definition for HTTP OpenAPI Protocol Mapping for properties, actions, and events"}
351
+
{: #httpmap1 title="CDDL definition for HTTP Protocol Mapping for properties, actions, and events"}
348
352
349
353
Where:
350
354
@@ -374,6 +378,64 @@ For example, a HTTP protocol mapping for a temperature property might look like:
374
378
375
379
The above SDF Protocol Mapping will be resolved to the following HTTP request: `GET /device/123/temperature/0?unit=celsius`.
376
380
381
+
### CoAP
382
+
383
+
The CoAP protocol mapping allows SDF models to specify how affordances should be
384
+
accessed using the CoAP protocol. The mapping includes details such as method,
385
+
URI, as well as optional query string and options.
386
+
387
+
~~~ cddl
388
+
{::include cddl/coap-protocol-map.cddl}
389
+
~~~
390
+
{: #coapmap1 title="CDDL definition for CoAP Protocol Mapping for properties, actions, and events"}
391
+
392
+
Where:
393
+
394
+
- `method`is the method of the CoAP request towards the affordance. Allowed methods are `GET`, `POST`, `PUT`, and `DELETE`.
395
+
- `uri`is the URI that identifies the resource associated to the affordance.
396
+
- `query`is the optional query string expressed as a text map. The key of the map is the name of the query parameter and the value of the map is the value of the query parameter.
397
+
- `options`is the optional set of CoAP options expressed as text map. The key of the map is the name of the option and the value of the map is the value of the option.
398
+
399
+
For example, a CoAP protocol mapping for a temperature property may look like:
400
+
401
+
~~~ jsonc
402
+
{
403
+
"sdfProperty": {
404
+
"temperature": {
405
+
"sdfProtocolMap": {
406
+
"coap": {
407
+
"method": "GET",
408
+
"path": "/device/123/temperature/0",
409
+
"query": {"unit": "celsius"},
410
+
"options": {"Accept": "application/senml+json"},
411
+
}
412
+
}
413
+
}
414
+
}
415
+
}
416
+
~~~
417
+
418
+
The next example shows how to register for notifications with OBSERVE when a
419
+
resource's value gets above 20, e.g., degree Celsius.
420
+
421
+
~~~ jsonc
422
+
{
423
+
"sdfProperty": {
424
+
"temperature": {
425
+
"sdfProtocolMap": {
426
+
"coap": {
427
+
"method": "GET",
428
+
"path": "/device/123/temperature/0?above=20",
429
+
"query": {"above": "20", "unit": "celsius"},
430
+
"options": {"Accept": "application/senml+json",
431
+
"Observe": 0},
432
+
}
433
+
}
434
+
}
435
+
}
436
+
}
437
+
~~~
438
+
377
439
### OpenAPI Protocol Mapping Structure
378
440
379
441
In the case of HTTP, SDF protocol mappings towards an SDF quality MAY be
@@ -480,6 +542,7 @@ Following protocol mappings are described in this document:
480
542
| ble | Bluetooth Low Energy (BLE) | Protocol mapping for BLE devices | This document |
481
543
| zigbee | Zigbee | Protocol mapping for Zigbee devices | This document |
482
544
| http | HTTP | Protocol mapping for HTTP IP-based devices | This document |
545
+
| coap | CoAP | Protocol mapping for CoAP IP-based devices | This document |
0 commit comments