draft-ietf-core-senml-06.txt   draft-ietf-core-senml-07.txt 
skipping to change at page 1, line 15 skipping to change at page 1, line 15
Intended status: Standards Track Z. Shelby Intended status: Standards Track Z. Shelby
Expires: November 5, 2017 ARM Expires: November 5, 2017 ARM
J. Arkko J. Arkko
A. Keranen A. Keranen
Ericsson Ericsson
C. Bormann C. Bormann
Universitaet Bremen TZI Universitaet Bremen TZI
May 4, 2017 May 4, 2017
Media Types for Sensor Measurement Lists (SenML) Media Types for Sensor Measurement Lists (SenML)
draft-ietf-core-senml-06 draft-ietf-core-senml-07
Abstract Abstract
This specification defines media types for representing simple sensor This specification defines media types for representing simple sensor
measurements and device parameters in the Sensor Measurement Lists measurements and device parameters in the Sensor Measurement Lists
(SenML). Representations are defined in JavaScript Object Notation (SenML). Representations are defined in JavaScript Object Notation
(JSON), Concise Binary Object Representation (CBOR), eXtensible (JSON), Concise Binary Object Representation (CBOR), eXtensible
Markup Language (XML), and Efficient XML Interchange (EXI), which Markup Language (XML), and Efficient XML Interchange (EXI), which
share the common SenML data model. A simple sensor, such as a share the common SenML data model. A simple sensor, such as a
temperature sensor, could use this media type in protocols such as temperature sensor, could use this media type in protocols such as
skipping to change at page 7, line 17 skipping to change at page 7, line 17
Update Time: An optional time in seconds that represents the maximum Update Time: An optional time in seconds that represents the maximum
time before this sensor will provide an updated reading for a time before this sensor will provide an updated reading for a
measurement. This can be used to detect the failure of sensors or measurement. This can be used to detect the failure of sensors or
communications path from the sensor. communications path from the sensor.
4.3. Considerations 4.3. Considerations
The SenML format can be extended with further custom attributes. The SenML format can be extended with further custom attributes.
Both new base and regular attributes are allowed. See Section 12.2 Both new base and regular attributes are allowed. See Section 12.2
for details. Implementations MUST ignore attributes they don't for details. Implementations MUST ignore attributes they don't
recognize. recognize unless that attribute has a label name that ends with the
'_' character in which case an error MUST be generated.
Systems reading one of the objects MUST check for the Version Systems reading one of the objects MUST check for the Version
attribute. If this value is a version number larger than the version attribute. If this value is a version number larger than the version
which the system understands, the system SHOULD NOT use this object. which the system understands, the system SHOULD NOT use this object.
This allows the version number to indicate that the object contains This allows the version number to indicate that the object contains
mandatory to understand attributes. New version numbers can only be mandatory to understand attributes. New version numbers can only be
defined in an RFC that updates this specification or it successors. defined in an RFC that updates this specification or it successors.
The Name value is concatenated to the Base Name value to get the name The Name value is concatenated to the Base Name value to get the name
of the sensor. The resulting name needs to uniquely identify and of the sensor. The resulting name needs to uniquely identify and
skipping to change at page 10, line 26 skipping to change at page 10, line 26
[ [
{"n":"urn:dev:ow:10e2073a01080063","u":"Cel","v":23.1} {"n":"urn:dev:ow:10e2073a01080063","u":"Cel","v":23.1}
] ]
5.1.2. Multiple Datapoints 5.1.2. Multiple Datapoints
The following example shows voltage and current now, i.e., at an The following example shows voltage and current now, i.e., at an
unspecified time. unspecified time.
[ [
{"bn":"urn:dev:ow:10e2073a01080063;","n":"voltage","u":"V","v":120.1}, {"bn":"urn:dev:ow:10e2073a01080063:","n":"voltage","u":"V","v":120.1},
{"n":"current","u":"A","v":1.2} {"n":"current","u":"A","v":1.2}
] ]
The next example is similar to the above one, but shows current at The next example is similar to the above one, but shows current at
Tue Jun 8 18:01:16.001 UTC 2010 and at each second for the previous 5 Tue Jun 8 18:01:16.001 UTC 2010 and at each second for the previous 5
seconds. seconds.
[ [
{"bn":"urn:dev:ow:10e2073a0108006;","bt":1.276020076001e+09, {"bn":"urn:dev:ow:10e2073a0108006:","bt":1.276020076001e+09,
"bu":"A","bver":5, "bu":"A","bver":5,
"n":"voltage","u":"V","v":120.1}, "n":"voltage","u":"V","v":120.1},
{"n":"current","t":-5,"v":1.2}, {"n":"current","t":-5,"v":1.2},
{"n":"current","t":-4,"v":1.3}, {"n":"current","t":-4,"v":1.3},
{"n":"current","t":-3,"v":1.4}, {"n":"current","t":-3,"v":1.4},
{"n":"current","t":-2,"v":1.5}, {"n":"current","t":-2,"v":1.5},
{"n":"current","t":-1,"v":1.6}, {"n":"current","t":-1,"v":1.6},
{"n":"current","v":1.7} {"n":"current","v":1.7}
] ]
skipping to change at page 13, line 40 skipping to change at page 13, line 40
{"n":"urn:dev:ow:10e2073a01080063","u":"lat","t":1.320067644e+09, {"n":"urn:dev:ow:10e2073a01080063","u":"lat","t":1.320067644e+09,
"v":60.07967} "v":60.07967}
] ]
5.1.5. Multiple Data Types 5.1.5. Multiple Data Types
The following example shows a sensor that returns different data The following example shows a sensor that returns different data
types. types.
[ [
{"bn":"urn:dev:ow:10e2073a01080063;","n":"temp","u":"Cel","v":23.1}, {"bn":"urn:dev:ow:10e2073a01080063:","n":"temp","u":"Cel","v":23.1},
{"n":"label","vs":"Machine Room"}, {"n":"label","vs":"Machine Room"},
{"n":"open","vb":false}, {"n":"open","vb":false},
{"n":"nfv-reader","vd":"aGkgCg=="} {"n":"nfv-reader","vd":"aGkgCg=="}
] ]
5.1.6. Collection of Resources 5.1.6. Collection of Resources
The following example shows how to query one device that can provide The following example shows how to query one device that can provide
multiple measurements. The example assumes that a client has fetched multiple measurements. The example assumes that a client has fetched
information from a device at 2001:db8::2 by performing a GET information from a device at 2001:db8::2 by performing a GET
operation on http://[2001:db8::2] at Mon Oct 31 16:27:09 UTC 2011, operation on http://[2001:db8::2] at Mon Oct 31 16:27:09 UTC 2011,
and has gotten two separate values as a result, a temperature and and has gotten two separate values as a result, a temperature and
humidity measurement. humidity measurement.
[ [
{"bn":"http://[2001:db8::2]/","bt":1.320078429e+09, {"bn":"2001:db8::2","bt":1.320078429e+09,
"n":"temperature","u":"Cel","v":27.2}, "n":"temperature","u":"Cel","v":27.2},
{"n":"humidity","u":"%RH","v":80} {"n":"humidity","u":"%RH","v":80}
] ]
5.1.7. Setting an Actuator 5.1.7. Setting an Actuator
The following example show the SenML that could be used to set the The following example show the SenML that could be used to set the
current set point of a typical residential thermostat which has a current set point of a typical residential thermostat which has a
temperature set point, a switch to turn on and off the heat, and a temperature set point, a switch to turn on and off the heat, and a
switch to turn on the fan override. switch to turn on the fan override.
[ [
{"bn":"urn:dev:ow:10e2073a01080063;"}, {"bn":"urn:dev:ow:10e2073a01080063:"},
{"n":"temp","u":"Cel","v":23.1}, {"n":"temp","u":"Cel","v":23.1},
{"n":"heat","u":"/","v":1}, {"n":"heat","u":"/","v":1},
{"n":"fan","u":"/","v":0} {"n":"fan","u":"/","v":0}
] ]
In the following example two different lights are turned on. It is In the following example two different lights are turned on. It is
assumed that the lights are on a 802.1BA network that can guarantee assumed that the lights are on a 802.1BA network that can guarantee
delivery of the messages to the two lights within 15 ms and uses delivery of the messages to the two lights within 15 ms and uses
802.1AS for time synchronization. The controller has set the time of 802.1AS for time synchronization. The controller has set the time of
the lights coming on to 20 ms in the future from the current time. the lights coming on to 20 ms in the future from the current time.
This allows both lights to receive the message, wait till that time, This allows both lights to receive the message, wait till that time,
then apply the switch command so that both lights come on at the same then apply the switch command so that both lights come on at the same
time. time.
[ [
{"bt":1.320078429e+09,"bu":"/","n":"http://[2001:db8::3]/","v":1}, {"bt":1.320078429e+09,"bu":"/","n":"2001:db8::3","v":1},
{"n":"http://[2001:db8::4]/","v":1} {"n":"2001:db8::4","v":1}
] ]
The following shows two lights being turned off using a non The following shows two lights being turned off using a non
deterministic network that has a high odds of delivering a message in deterministic network that has a high odds of delivering a message in
less than 100 ms and uses NTP for time synchronization. The current less than 100 ms and uses NTP for time synchronization. The current
time is 1320078429. The user has just turned off a light switch time is 1320078429. The user has just turned off a light switch
which is turning off two lights. Both lights are dimmed to 50% which is turning off two lights. Both lights are dimmed to 50%
brightness immediately to give the user instant feedback that brightness immediately to give the user instant feedback that
something is changing. However given the network, the lights will something is changing. However given the network, the lights will
probably dim at somewhat different times. Then 100 ms in the future, probably dim at somewhat different times. Then 100 ms in the future,
both lights will go off at the same time. The instant but not both lights will go off at the same time. The instant but not
synchronized dimming gives the user the sensation of quick responses synchronized dimming gives the user the sensation of quick responses
and the timed off 100 ms in the future gives the perception of both and the timed off 100 ms in the future gives the perception of both
lights going off at the same time. lights going off at the same time.
[ [
{"bt":1.320078429e+09,"bu":"/","n":"http://[2001:db8::3]/","v":0.5}, {"bt":1.320078429e+09,"bu":"/","n":"2001:db8::3","v":0.5},
{"n":"http://[2001:db8::4]/","v":0.5}, {"n":"2001:db8::4","v":0.5},
{"n":"http://[2001:db8::3]/","t":0.1,"v":0}, {"n":"2001:db8::3","t":0.1,"v":0},
{"n":"http://[2001:db8::4]/","t":0.1,"v":0} {"n":"2001:db8::4","t":0.1,"v":0}
] ]
6. CBOR Representation (application/senml+cbor) 6. CBOR Representation (application/senml+cbor)
The CBOR [RFC7049] representation is equivalent to the JSON The CBOR [RFC7049] representation is equivalent to the JSON
representation, with the following changes: representation, with the following changes:
o For JSON Numbers, the CBOR representation can use integers, o For JSON Numbers, the CBOR representation can use integers,
floating point numbers, or decimal fractions (CBOR Tag 4); however floating point numbers, or decimal fractions (CBOR Tag 4); however
a representation SHOULD be chosen such that when the CBOR value is a representation SHOULD be chosen such that when the CBOR value is
converted back to an IEEE double precision floating point value, converted back to an IEEE double precision floating point value,
skipping to change at page 16, line 36 skipping to change at page 16, line 36
Table 3: CBOR representation: integers for map keys Table 3: CBOR representation: integers for map keys
o For streaming SensML in CBOR representation, the array containing o For streaming SensML in CBOR representation, the array containing
the records SHOULD be an CBOR indefinite length array while for the records SHOULD be an CBOR indefinite length array while for
non streaming SenML, a definite length array MUST be used. non streaming SenML, a definite length array MUST be used.
The following example shows a dump of the CBOR example for the same The following example shows a dump of the CBOR example for the same
sensor measurement as in Section 5.1.2. sensor measurement as in Section 5.1.2.
0000 87 a7 21 78 1b 75 72 6e 3a 64 65 76 3a 6f 77 3a |..!x.urn:dev:ow:| 0000 87 a7 21 78 1b 75 72 6e 3a 64 65 76 3a 6f 77 3a |..!x.urn:dev:ow:|
0010 31 30 65 32 30 37 33 61 30 31 30 38 30 30 36 3b |10e2073a0108006;| 0010 31 30 65 32 30 37 33 61 30 31 30 38 30 30 36 3a |10e2073a0108006:|
0020 22 fb 41 d3 03 a1 5b 00 10 62 23 61 41 20 05 00 |".A...[..b#aA ..| 0020 22 fb 41 d3 03 a1 5b 00 10 62 23 61 41 20 05 00 |".A...[..b#aA ..|
0030 67 76 6f 6c 74 61 67 65 01 61 56 02 fb 40 5e 06 |gvoltage.aV..@^.| 0030 67 76 6f 6c 74 61 67 65 01 61 56 02 fb 40 5e 06 |gvoltage.aV..@^.|
0040 66 66 66 66 66 a3 00 67 63 75 72 72 65 6e 74 06 |fffff..gcurrent.| 0040 66 66 66 66 66 a3 00 67 63 75 72 72 65 6e 74 06 |fffff..gcurrent.|
0050 24 02 fb 3f f3 33 33 33 33 33 33 a3 00 67 63 75 |$..?.333333..gcu| 0050 24 02 fb 3f f3 33 33 33 33 33 33 a3 00 67 63 75 |$..?.333333..gcu|
0060 72 72 65 6e 74 06 23 02 fb 3f f4 cc cc cc cc cc |rrent.#..?......| 0060 72 72 65 6e 74 06 23 02 fb 3f f4 cc cc cc cc cc |rrent.#..?......|
0070 cd a3 00 67 63 75 72 72 65 6e 74 06 22 02 fb 3f |...gcurrent."..?| 0070 cd a3 00 67 63 75 72 72 65 6e 74 06 22 02 fb 3f |...gcurrent."..?|
0080 f6 66 66 66 66 66 66 a3 00 67 63 75 72 72 65 6e |.ffffff..gcurren| 0080 f6 66 66 66 66 66 66 a3 00 67 63 75 72 72 65 6e |.ffffff..gcurren|
0090 74 06 21 02 f9 3e 00 a3 00 67 63 75 72 72 65 6e |t.!..>...gcurren| 0090 74 06 21 02 f9 3e 00 a3 00 67 63 75 72 72 65 6e |t.!..>...gcurren|
00a0 74 06 20 02 fb 3f f9 99 99 99 99 99 9a a3 00 67 |t. ..?.........g| 00a0 74 06 20 02 fb 3f f9 99 99 99 99 99 9a a3 00 67 |t. ..?.........g|
00b0 63 75 72 72 65 6e 74 06 00 02 fb 3f fb 33 33 33 |current....?.333| 00b0 63 75 72 72 65 6e 74 06 00 02 fb 3f fb 33 33 33 |current....?.333|
skipping to change at page 17, line 19 skipping to change at page 17, line 19
Only the UTF-8 form of XML is allowed. Characters in the String Only the UTF-8 form of XML is allowed. Characters in the String
Value are encoded using the escape sequences defined in [RFC7159]. Value are encoded using the escape sequences defined in [RFC7159].
Octets in the Data Value are base64 encoded with URL safe alphabet as Octets in the Data Value are base64 encoded with URL safe alphabet as
defined in Section 5 of [RFC4648]. defined in Section 5 of [RFC4648].
The following example shows an XML example for the same sensor The following example shows an XML example for the same sensor
measurement as in Section 5.1.2. measurement as in Section 5.1.2.
<sensml xmlns="urn:ietf:params:xml:ns:senml"> <sensml xmlns="urn:ietf:params:xml:ns:senml">
<senml bn="urn:dev:ow:10e2073a0108006;" bt="1.276020076001e+09" <senml bn="urn:dev:ow:10e2073a0108006:" bt="1.276020076001e+09"
bu="A" bver="5" n="voltage" u="V" v="120.1"></senml> bu="A" bver="5" n="voltage" u="V" v="120.1"></senml>
<senml n="current" t="-5" v="1.2"></senml> <senml n="current" t="-5" v="1.2"></senml>
<senml n="current" t="-4" v="1.3"></senml> <senml n="current" t="-4" v="1.3"></senml>
<senml n="current" t="-3" v="1.4"></senml> <senml n="current" t="-3" v="1.4"></senml>
<senml n="current" t="-2" v="1.5"></senml> <senml n="current" t="-2" v="1.5"></senml>
<senml n="current" t="-1" v="1.6"></senml> <senml n="current" t="-1" v="1.6"></senml>
<senml n="current" v="1.7"></senml> <senml n="current" v="1.7"></senml>
</sensml> </sensml>
The SenML Stream is represented as a sensml tag that contains a The SenML Stream is represented as a sensml tag that contains a
skipping to change at page 21, line 6 skipping to change at page 21, line 6
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
</xs:schema> </xs:schema>
The following shows a hexdump of the EXI produced from encoding the The following shows a hexdump of the EXI produced from encoding the
following XML example. Note this example is the same information as following XML example. Note this example is the same information as
the first example in Section 5.1.2 in JSON format. the first example in Section 5.1.2 in JSON format.
<sensml xmlns="urn:ietf:params:xml:ns:senml"> <sensml xmlns="urn:ietf:params:xml:ns:senml">
<senml bn="urn:dev:ow:10e2073a01080063;" n="voltage" u="V" <senml bn="urn:dev:ow:10e2073a01080063:" n="voltage" u="V"
v="120.1"></senml> v="120.1"></senml>
<senml n="current" u="A" v="1.2"></senml> <senml n="current" u="A" v="1.2"></senml>
</sensml> </sensml>
Which compresses with EXI to the following displayed in hexdump: Which compresses with EXI to the following displayed in hexdump:
0000 a0 30 0d 84 80 79 d5 c9 b8 e9 91 95 d8 e9 bd dc |.0...y..........| 0000 a0 30 0d 84 80 79 d5 c9 b8 e9 91 95 d8 e9 bd dc |.0...y..........|
0010 e8 c4 c1 94 c8 c0 dc cd 84 c0 c4 c0 e0 c0 c0 d8 |................| 0010 e8 c4 c1 94 c8 c0 dc cd 84 c0 c4 c0 e0 c0 c0 d8 |................|
0020 cc ed 82 5d 9b db 1d 18 59 d9 48 0d 58 ac 42 60 |...]....Y.H.X.B`| 0020 cc e9 82 5d 9b db 1d 18 59 d9 48 0d 58 ac 42 60 |...]....Y.H.X.B`|
0030 18 e1 2c 6e ae 4e 4c ad ce 84 06 82 41 90 0e |..,n.NL.....A..| 0030 18 e1 2c 6e ae 4e 4c ad ce 84 06 82 41 90 0e |..,n.NL.....A..|
003f 003f
The above example used the bit packed form of EXI but it is also The above example used the bit packed form of EXI but it is also
possible to use a byte packed form of EXI which can makes it easier possible to use a byte packed form of EXI which can makes it easier
for a simple sensor to produce valid EXI without really implementing for a simple sensor to produce valid EXI without really implementing
EXI. Consider the example of a temperature sensor that produces a EXI. Consider the example of a temperature sensor that produces a
value in tenths of degrees Celsius over a range of 0.0 to 55.0. It value in tenths of degrees Celsius over a range of 0.0 to 55.0. It
would produce an XML SenML file such as: would produce an XML SenML file such as:
skipping to change at page 30, line 33 skipping to change at page 30, line 33
registry. registry.
Extensions that add a label that is intended for use with EXI need to Extensions that add a label that is intended for use with EXI need to
create a new XSD Schema that includes all the labels in the IANA create a new XSD Schema that includes all the labels in the IANA
registry then allocate a new EXI schemaId value. Moving to the next registry then allocate a new EXI schemaId value. Moving to the next
letter in the alphabet is the suggested way to create the new value letter in the alphabet is the suggested way to create the new value
for the EXI schemaId. Any labels with previously blank ID values for the EXI schemaId. Any labels with previously blank ID values
SHOULD be updated in the IANA table to have their ID set to this new SHOULD be updated in the IANA table to have their ID set to this new
schemaId value. schemaId value.
Extensions that are mandatory to understand to correctly process the
Pack MUST have a label name that ends with the '_' character.
12.3. Media Type Registration 12.3. Media Type Registration
The following registrations are done following the procedure The following registrations are done following the procedure
specified in [RFC6838] and [RFC7303]. Clipboard formats are defined specified in [RFC6838] and [RFC7303]. Clipboard formats are defined
for the JSON and XML form of lists but do not make sense for streams for the JSON and XML form of lists but do not make sense for streams
or other formats. or other formats.
Note to RFC Editor - please remove this paragraph. Note that a Note to RFC Editor - please remove this paragraph. Note that a
request for media type review for senml+json was sent to the media- request for media type review for senml+json was sent to the media-
types@iana.org on Sept 21, 2010. A second request for all the types types@iana.org on Sept 21, 2010. A second request for all the types
skipping to change at page 45, line 29 skipping to change at page 45, line 29
used for additional information about a SenML Record. The definition used for additional information about a SenML Record. The definition
and usage of the contents of this value are specified in and usage of the contents of this value are specified in
[I-D.ietf-core-links-json]. [I-D.ietf-core-links-json].
For JSON and XML the attribute has a label of "l" and a value that is For JSON and XML the attribute has a label of "l" and a value that is
a string. a string.
The following shows an example of the links extension. The following shows an example of the links extension.
[ [
{"bn":"urn:dev:ow:10e2073a01080063;","bt":1.320078429e+09, {"bn":"urn:dev:ow:10e2073a01080063:","bt":1.320078429e+09,
"l":"[{\"href\":\"humidity\",\"foo\":\"bar1\"}", "l":"[{\"href\":\"humidity\",\"foo\":\"bar1\"}",
"n":"temperature","u":"Cel","v":27.2}, "n":"temperature","u":"Cel","v":27.2},
{"n":"humidity","u":"%RH","v":80} {"n":"humidity","u":"%RH","v":80}
] ]
Authors' Addresses Authors' Addresses
Cullen Jennings Cullen Jennings
Cisco Cisco
400 3rd Avenue SW 400 3rd Avenue SW
 End of changes. 15 change blocks. 
20 lines changed or deleted 24 lines changed or added

This html diff was produced by rfcdiff 1.45. The latest version is available from http://tools.ietf.org/tools/rfcdiff/