idnits 2.17.1 draft-ietf-core-senml-13.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- == There are 4 instances of lines with non-RFC2606-compliant FQDNs in the document. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (March 02, 2018) is 2218 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Possible downref: Non-RFC (?) normative reference: ref. 'BIPM' -- Possible downref: Non-RFC (?) normative reference: ref. 'IEEE.754.1985' -- Possible downref: Non-RFC (?) normative reference: ref. 'NIST811' ** Obsolete normative reference: RFC 7049 (Obsoleted by RFC 8949) -- Possible downref: Non-RFC (?) normative reference: ref. 'RNC' == Outdated reference: A later version (-08) exists of draft-ietf-cbor-cddl-02 == Outdated reference: A later version (-14) exists of draft-ietf-core-interfaces-10 -- Obsolete informational reference (is this intentional?): RFC 5246 (Obsoleted by RFC 8446) -- Obsolete informational reference (is this intentional?): RFC 5751 (Obsoleted by RFC 8551) -- Obsolete informational reference (is this intentional?): RFC 7230 (Obsoleted by RFC 9110, RFC 9112) Summary: 1 error (**), 0 flaws (~~), 4 warnings (==), 8 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group C. Jennings 3 Internet-Draft Cisco 4 Intended status: Standards Track Z. Shelby 5 Expires: September 3, 2018 ARM 6 J. Arkko 7 A. Keranen 8 Ericsson 9 C. Bormann 10 Universitaet Bremen TZI 11 March 02, 2018 13 Media Types for Sensor Measurement Lists (SenML) 14 draft-ietf-core-senml-13 16 Abstract 18 This specification defines media types for representing simple sensor 19 measurements and device parameters in the Sensor Measurement Lists 20 (SenML). Representations are defined in JavaScript Object Notation 21 (JSON), Concise Binary Object Representation (CBOR), eXtensible 22 Markup Language (XML), and Efficient XML Interchange (EXI), which 23 share the common SenML data model. A simple sensor, such as a 24 temperature sensor, could use one of these media types in protocols 25 such as HTTP or CoAP to transport the measurements of the sensor or 26 to be configured. 28 Status of This Memo 30 This Internet-Draft is submitted in full conformance with the 31 provisions of BCP 78 and BCP 79. 33 Internet-Drafts are working documents of the Internet Engineering 34 Task Force (IETF). Note that other groups may also distribute 35 working documents as Internet-Drafts. The list of current Internet- 36 Drafts is at http://datatracker.ietf.org/drafts/current/. 38 Internet-Drafts are draft documents valid for a maximum of six months 39 and may be updated, replaced, or obsoleted by other documents at any 40 time. It is inappropriate to use Internet-Drafts as reference 41 material or to cite them other than as "work in progress." 43 This Internet-Draft will expire on September 3, 2018. 45 Copyright Notice 47 Copyright (c) 2018 IETF Trust and the persons identified as the 48 document authors. All rights reserved. 50 This document is subject to BCP 78 and the IETF Trust's Legal 51 Provisions Relating to IETF Documents 52 (http://trustee.ietf.org/license-info) in effect on the date of 53 publication of this document. Please review these documents 54 carefully, as they describe your rights and restrictions with respect 55 to this document. Code Components extracted from this document must 56 include Simplified BSD License text as described in Section 4.e of 57 the Trust Legal Provisions and are provided without warranty as 58 described in the Simplified BSD License. 60 Table of Contents 62 1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 3 63 2. Requirements and Design Goals . . . . . . . . . . . . . . . . 4 64 3. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 5 65 4. SenML Structure and Semantics . . . . . . . . . . . . . . . . 6 66 4.1. Base Fields . . . . . . . . . . . . . . . . . . . . . . . 6 67 4.2. Regular Fields . . . . . . . . . . . . . . . . . . . . . 7 68 4.3. SenML Labels . . . . . . . . . . . . . . . . . . . . . . 7 69 4.4. Considerations . . . . . . . . . . . . . . . . . . . . . 8 70 4.5. Resolved Records . . . . . . . . . . . . . . . . . . . . 10 71 4.6. Associating Meta-data . . . . . . . . . . . . . . . . . . 10 72 4.7. Configuration and Actuation usage . . . . . . . . . . . . 11 73 5. JSON Representation (application/senml+json) . . . . . . . . 11 74 5.1. Examples . . . . . . . . . . . . . . . . . . . . . . . . 12 75 5.1.1. Single Datapoint . . . . . . . . . . . . . . . . . . 12 76 5.1.2. Multiple Datapoints . . . . . . . . . . . . . . . . . 12 77 5.1.3. Multiple Measurements . . . . . . . . . . . . . . . . 13 78 5.1.4. Resolved Data . . . . . . . . . . . . . . . . . . . . 14 79 5.1.5. Multiple Data Types . . . . . . . . . . . . . . . . . 15 80 5.1.6. Collection of Resources . . . . . . . . . . . . . . . 15 81 5.1.7. Setting an Actuator . . . . . . . . . . . . . . . . . 16 82 6. CBOR Representation (application/senml+cbor) . . . . . . . . 17 83 7. XML Representation (application/senml+xml) . . . . . . . . . 19 84 8. EXI Representation (application/senml-exi) . . . . . . . . . 21 85 9. Fragment Identification Methods . . . . . . . . . . . . . . . 24 86 9.1. Fragment Identification Examples . . . . . . . . . . . . 24 87 10. Usage Considerations . . . . . . . . . . . . . . . . . . . . 25 88 11. CDDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 89 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 27 90 12.1. Units Registry . . . . . . . . . . . . . . . . . . . . . 27 91 12.2. SenML Label Registry . . . . . . . . . . . . . . . . . . 31 92 12.3. Media Type Registrations . . . . . . . . . . . . . . . . 32 93 12.3.1. senml+json Media Type Registration . . . . . . . . . 33 94 12.3.2. sensml+json Media Type Registration . . . . . . . . 34 95 12.3.3. senml+cbor Media Type Registration . . . . . . . . . 35 96 12.3.4. sensml+cbor Media Type Registration . . . . . . . . 36 97 12.3.5. senml+xml Media Type Registration . . . . . . . . . 37 98 12.3.6. sensml+xml Media Type Registration . . . . . . . . . 38 99 12.3.7. senml-exi Media Type Registration . . . . . . . . . 40 100 12.3.8. sensml-exi Media Type Registration . . . . . . . . . 41 101 12.4. XML Namespace Registration . . . . . . . . . . . . . . . 42 102 12.5. CoAP Content-Format Registration . . . . . . . . . . . . 42 103 13. Security Considerations . . . . . . . . . . . . . . . . . . . 43 104 14. Privacy Considerations . . . . . . . . . . . . . . . . . . . 43 105 15. Acknowledgement . . . . . . . . . . . . . . . . . . . . . . . 43 106 16. References . . . . . . . . . . . . . . . . . . . . . . . . . 44 107 16.1. Normative References . . . . . . . . . . . . . . . . . . 44 108 16.2. Informative References . . . . . . . . . . . . . . . . . 46 109 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 48 111 1. Overview 113 Connecting sensors to the Internet is not new, and there have been 114 many protocols designed to facilitate it. This specification defines 115 new media types for carrying simple sensor information in a protocol 116 such as HTTP [RFC7230] or CoAP [RFC7252]. This format was designed 117 so that processors with very limited capabilities could easily encode 118 a sensor measurement into the media type, while at the same time a 119 server parsing the data could relatively efficiently collect a large 120 number of sensor measurements. SenML can be used for a variety of 121 data flow models, most notably data feeds pushed from a sensor to a 122 collector, and the web resource model where the sensor is requested 123 as a resource representation (e.g., "GET /sensor/temperature"). 125 There are many types of more complex measurements and measurements 126 that this media type would not be suitable for. SenML strikes a 127 balance between having some information about the sensor carried with 128 the sensor data so that the data is self describing but it also tries 129 to make that a fairly minimal set of auxiliary information for 130 efficiency reason. Other information about the sensor can be 131 discovered by other methods such as using the CoRE Link Format 132 [RFC6690]. 134 SenML is defined by a data model for measurements and simple meta- 135 data about measurements and devices. The data is structured as a 136 single array that contains a series of SenML Records which can each 137 contain fields such as an unique identifier for the sensor, the time 138 the measurement was made, the unit the measurement is in, and the 139 current value of the sensor. Serializations for this data model are 140 defined for JSON [RFC8259], CBOR [RFC7049], XML 142 [W3C.REC-xml-20081126], and Efficient XML Interchange (EXI) 143 [W3C.REC-exi-20140211]. 145 For example, the following shows a measurement from a temperature 146 gauge encoded in the JSON syntax. 148 [ 149 {"n":"urn:dev:ow:10e2073a01080063","u":"Cel","v":23.1} 150 ] 152 In the example above, the array has a single SenML Record with a 153 measurement for a sensor named "urn:dev:ow:10e2073a01080063" with a 154 current value of 23.1 degrees Celsius. 156 2. Requirements and Design Goals 158 The design goal is to be able to send simple sensor measurements in 159 small packets from large numbers of constrained devices. Keeping the 160 total size of payload small makes it easy to use SenML also in 161 constrained networks, e.g., in a 6LoWPAN [RFC4944]. It is always 162 difficult to define what small code is, but there is a desire to be 163 able to implement this in roughly 1 KB of flash on a 8 bit 164 microprocessor. Experience with power meters and other large scale 165 deployments has indicated that the solution needs to support allowing 166 multiple measurements to be batched into a single HTTP or CoAP 167 request. This "batch" upload capability allows the server side to 168 efficiently support a large number of devices. It also conveniently 169 supports batch transfers from proxies and storage devices, even in 170 situations where the sensor itself sends just a single data item at a 171 time. The multiple measurements could be from multiple related 172 sensors or from the same sensor but at different times. 174 The basic design is an array with a series of measurements. The 175 following example shows two measurements made at different times. 176 The value of a measurement is given by the "v" field, the time of a 177 measurement is in the "t" field, the "n" field has a unique sensor 178 name, and the unit of the measurement is carried in the "u" field. 180 [ 181 {"n":"urn:dev:ow:10e2073a01080063","u":"Cel","t":1.276020076e+09, 182 "v":23.5}, 183 {"n":"urn:dev:ow:10e2073a01080063","u":"Cel","t":1.276020091e+09, 184 "v":23.6} 185 ] 187 To keep the messages small, it does not make sense to repeat the "n" 188 field in each SenML Record so there is a concept of a Base Name which 189 is simply a string that is prepended to the Name field of all 190 elements in that record and any records that follow it. So a more 191 compact form of the example above is the following. 193 [ 194 {"bn":"urn:dev:ow:10e2073a01080063","u":"Cel","t":1.276020076e+09, 195 "v":23.5}, 196 {"u":"Cel","t":1.276020091e+09, 197 "v":23.6} 198 ] 200 In the above example the Base Name is in the "bn" field and the "n" 201 fields in each Record are the empty string so they are omitted. 203 Some devices have accurate time while others do not so SenML supports 204 absolute and relative times. Time is represented in floating point 205 as seconds. Values greater than zero represent an absolute time 206 relative to the Unix epoch (1970-01-01T00:00Z in UTC time) and the 207 time is counted same way as the Portable Operating System Interface 208 (POSIX) "seconds since the epoch" [TIME_T]. Values of 0 or less 209 represent a relative time in the past from the current time. A 210 simple sensor with no absolute wall clock time might take a 211 measurement every second, batch up 60 of them, and then send the 212 batch to a server. It would include the relative time each 213 measurement was made compared to the time the batch was sent in each 214 SenML Record. The server might have accurate NTP time and use the 215 time it received the data, and the relative offset, to replace the 216 times in the SenML with absolute times before saving the SenML Pack 217 in a document database. 219 3. Terminology 221 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 222 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 223 "OPTIONAL" in this document are to be interpreted as described in BCP 224 14 [RFC2119] [RFC8174] when, and only when, they appear in all 225 capitals, as shown here. 227 This document also uses the following terms: 229 SenML Record: One measurement or configuration instance in time 230 presented using the SenML data model. 232 SenML Pack: One or more SenML Records in an array structure. 234 SenML Label: A short name used in SenML Records to denote different 235 SenML fields (e.g., "v" for "value"). 237 SenML Field: A component of a record that associates a value to a 238 SenML Label for this record. 240 This document uses the terms "attribute" and "tag" where they occur 241 with the underlying technologies (XML, CBOR [RFC7049], and Link 242 Format [RFC6690]), not for SenML concepts per se. Note that 243 "attribute" has been widely used previously as a synonym for SenML 244 "field", though. 246 4. SenML Structure and Semantics 248 Each SenML Pack carries a single array that represents a set of 249 measurements and/or parameters. This array contains a series of 250 SenML Records with several fields described below. There are two 251 kinds of fields: base and regular. The base fields can be included 252 in any SenML Record and they apply to the entries in the Record. 253 Each base field also applies to all Records after it up to, but not 254 including, the next Record that has that same base field. All base 255 fields are optional. Regular fields can be included in any SenML 256 Record and apply only to that Record. 258 4.1. Base Fields 260 Base Name: This is a string that is prepended to the names found in 261 the entries. 263 Base Time: A base time that is added to the time found in an entry. 265 Base Unit: A base unit that is assumed for all entries, unless 266 otherwise indicated. If a record does not contain a Unit value, 267 then the Base Unit is used. Otherwise the value found in the Unit 268 (if any) is used. 270 Base Value: A base value is added to the value found in an entry, 271 similar to Base Time. 273 Base Sum: A base sum is added to the sum found in an entry, similar 274 to Base Time. 276 Version: Version number of media type format. This field is an 277 optional positive integer and defaults to 5 if not present. [RFC 278 Editor: change the default value to 10 when this specification is 279 published as an RFC and remove this note] 281 4.2. Regular Fields 283 Name: Name of the sensor or parameter. When appended to the Base 284 Name field, this must result in a globally unique identifier for 285 the resource. The name is optional, if the Base Name is present. 286 If the name is missing, Base Name must uniquely identify the 287 resource. This can be used to represent a large array of 288 measurements from the same sensor without having to repeat its 289 identifier on every measurement. 291 Unit: Unit for a measurement value. Optional. 293 Value: Value of the entry. Optional if a Sum value is present, 294 otherwise required. Values are represented using basic data 295 types. This specification defines floating point numbers ("v" 296 field for "Value"), booleans ("vb" for "Boolean Value"), strings 297 ("vs" for "String Value") and binary data ("vd" for "Data Value"). 298 Exactly one value field MUST appear unless there is Sum field in 299 which case it is allowed to have no Value field. 301 Sum: Integrated sum of the values over time. Optional. This field 302 is in the unit specified in the Unit value multiplied by seconds. 304 Time: Time when value was recorded. Optional. 306 Update Time: Period of time in seconds that represents the maximum 307 time before this sensor will provide an updated reading for a 308 measurement. Optional. This can be used to detect the failure of 309 sensors or communications path from the sensor. 311 4.3. SenML Labels 313 Table 1 provides an overview of all SenML fields defined by this 314 document with their respective labels and data types. 316 +---------------+-------+------------+------------+------------+ 317 | Name | Label | CBOR Label | JSON Type | XML Type | 318 +---------------+-------+------------+------------+------------+ 319 | Base Name | bn | -2 | String | string | 320 | Base Time | bt | -3 | Number | double | 321 | Base Unit | bu | -4 | String | string | 322 | Base Value | bv | -5 | Number | double | 323 | Base Sum | bs | -6 | Number | double | 324 | Version | bver | -1 | Number | int | 325 | Name | n | 0 | String | string | 326 | Unit | u | 1 | String | string | 327 | Value | v | 2 | Number | double | 328 | String Value | vs | 3 | String | string | 329 | Boolean Value | vb | 4 | Boolean | boolean | 330 | Data Value | vd | 8 | String (*) | string (*) | 331 | Value Sum | s | 5 | Number | double | 332 | Time | t | 6 | Number | double | 333 | Update Time | ut | 7 | Number | double | 334 +---------------+-------+------------+------------+------------+ 336 Table 1: SenML Labels 338 Data Value is base64 encoded string with URL safe alphabet as defined 339 in Section 5 of [RFC4648], with padding omitted. 341 For details of the JSON representation see Section 5, for the CBOR 342 Section 6, and for the XML Section 7. 344 4.4. Considerations 346 The SenML format can be extended with further custom fields. Both 347 new base and regular fields are allowed. See Section 12.2 for 348 details. Implementations MUST ignore fields they don't recognize 349 unless that field has a label name that ends with the '_' character 350 in which case an error MUST be generated. 352 All SenML Records in a Pack MUST have the same version number. This 353 is typically done by adding a Base Version field to only the first 354 Record in the Pack. 356 Systems reading one of the objects MUST check for the Version field. 357 If this value is a version number larger than the version which the 358 system understands, the system SHOULD NOT use this object. This 359 allows the version number to indicate that the object contains 360 structure or semantics that is different from what is defined in the 361 present document beyond just making use of the extension points 362 provided here. New version numbers can only be defined in an RFC 363 that updates this specification or it successors. 365 The Name value is concatenated to the Base Name value to yield the 366 name of the sensor. The resulting concatenated name needs to 367 uniquely identify and differentiate the sensor from all others. The 368 concatenated name MUST consist only of characters out of the set "A" 369 to "Z", "a" to "z", "0" to "9", "-", ":", ".", "/", and "_"; 370 furthermore, it MUST start with a character out of the set "A" to 371 "Z", "a" to "z", or "0" to "9". This restricted character set was 372 chosen so that concatenated names can be used directly within various 373 URI schemes (including segments of an HTTP path with no special 374 encoding) and can be used directly in many databases and analytic 375 systems. [RFC5952] contains advice on encoding an IPv6 address in a 376 name. See Section 14 for privacy considerations that apply to the 377 use of long-term stable unique identifiers. 379 Although it is RECOMMENDED that concatenated names are represented as 380 URIs [RFC3986] or URNs [RFC8141], the restricted character set 381 specified above puts strict limits on the URI schemes and URN 382 namespaces that can be used. As a result, implementers need to take 383 care in choosing the naming scheme for concatenated names, because 384 such names both need to be unique and need to conform to the 385 restricted character set. One approach is to include a bit string 386 that has guaranteed uniqueness (such as a 1-wire address). Some of 387 the examples within this document use the device URN namespace as 388 specified in [I-D.arkko-core-dev-urn]. UUIDs [RFC4122] are another 389 way to generate a unique name. However, the restricted character set 390 does not allow the use of many URI schemes, such as the 'tag' scheme 391 [RFC4151] and the 'ni' scheme [RFC6920], in names as such. The use 392 of URIs with characters incompatible with this set, and possible 393 mapping rules between the two, are outside of the scope of the 394 present document. 396 If the Record has no Unit, the Base Unit is used as the Unit. Having 397 no Unit and no Base Unit is allowed. 399 If either the Base Time or Time value is missing, the missing field 400 is considered to have a value of zero. The Base Time and Time values 401 are added together to get the time of measurement. A time of zero 402 indicates that the sensor does not know the absolute time and the 403 measurement was made roughly "now". A negative value is used to 404 indicate seconds in the past from roughly "now". A positive value is 405 used to indicate the number of seconds, excluding leap seconds, since 406 the start of the year 1970 in UTC. 408 If only one of the Base Sum or Sum value is present, the missing 409 field is considered to have a value of zero. The Base Sum and Sum 410 values are added together to get the sum of measurement. If neither 411 the Base Sum or Sum are present, then the measurement does not have a 412 sum value. 414 If the Base Value or Value is not present, the missing field(s) are 415 considered to have a value of zero. The Base Value and Value are 416 added together to get the value of the measurement. 418 Representing the statistical characteristics of measurements, such as 419 accuracy, can be very complex. Future specification may add new 420 fields to provide better information about the statistical properties 421 of the measurement. 423 In summary, the structure of a SenML record is laid out to support a 424 single measurement per record. If multiple data values are measured 425 at the same time (e.g., air pressure and altitude), they are best 426 kept as separate records linked through their Time value; this is 427 even true where one of the data values is more "meta" than others 428 (e.g., describes a condition that influences other measurements at 429 the same time). 431 4.5. Resolved Records 433 Sometimes it is useful to be able to refer to a defined normalized 434 format for SenML records. This normalized format tends to get used 435 for big data applications and intermediate forms when converting to 436 other formats. 438 A SenML Record is referred to as "resolved" if it does not contain 439 any base values, i.e., labels starting with the character 'b', except 440 for Version fields (see below), and has no relative times. To 441 resolve the records, the base values of the SenML Pack (if any) are 442 applied to the Record. That is, name and base name are concatenated, 443 base time is added to the time of the Record, if the Record did not 444 contain Unit the Base Unit is applied to the record, etc. In 445 addition the records need to be in chronological order. An example 446 of this is show in Section 5.1.4. 448 The Version field MUST NOT be present in resolved records if the 449 SenML version defined in this document is used and MUST be present 450 otherwise in all the resolved SenML Records. 452 Future specification that defines new base fields need to specify how 453 the field is resolved. 455 4.6. Associating Meta-data 457 SenML is designed to carry the minimum dynamic information about 458 measurements, and for efficiency reasons does not carry significant 459 static meta-data about the device, object or sensors. Instead, it is 460 assumed that this meta-data is carried out of band. For web 461 resources using SenML Packs, this meta-data can be made available 462 using the CoRE Link Format [RFC6690]. The most obvious use of this 463 link format is to describe that a resource is available in a SenML 464 format in the first place. The relevant media type indicator is 465 included in the Content-Type (ct=) link attribute (which is defined 466 for the Link Format in Section 7.2.1 of [RFC7252]). 468 4.7. Configuration and Actuation usage 470 SenML can also be used for configuring parameters and controlling 471 actuators. When a SenML Pack is sent (e.g., using a HTTP/CoAP POST 472 or PUT method) and the semantics of the target are such that SenML is 473 interpreted as configuration/actuation, SenML Records are interpreted 474 as a request to change the values of given (sub)resources (given as 475 names) to given values at the given time(s). The semantics of the 476 target resource supporting this usage can be described, e.g., using 477 [I-D.ietf-core-interfaces]. Examples of actuation usage are shown in 478 Section 5.1.7. 480 5. JSON Representation (application/senml+json) 482 For the SenML fields shown in Table 2, the SenML labels are used as 483 the JSON object member names within JSON objects representing the 484 JSON SenML Records. 486 +---------------+-------+---------+ 487 | Name | label | Type | 488 +---------------+-------+---------+ 489 | Base Name | bn | String | 490 | Base Time | bt | Number | 491 | Base Unit | bu | String | 492 | Base Value | bv | Number | 493 | Base Sum | bs | Number | 494 | Version | bver | Number | 495 | Name | n | String | 496 | Unit | u | String | 497 | Value | v | Number | 498 | String Value | vs | String | 499 | Boolean Value | vb | Boolean | 500 | Data Value | vd | String | 501 | Value Sum | s | Number | 502 | Time | t | Number | 503 | Update Time | ut | Number | 504 +---------------+-------+---------+ 506 Table 2: JSON SenML Labels 508 The root JSON value consists of an array with one JSON object for 509 each SenML Record. All the fields in the above table MAY occur in 510 the records with member values of the type specified in the table. 512 Only the UTF-8 [RFC3629] form of JSON is allowed. Characters in the 513 String Value are encoded using the escape sequences defined in 514 [RFC8259]. Octets in the Data Value are base64 encoded with URL safe 515 alphabet as defined in Section 5 of [RFC4648], with padding omitted. 517 Systems receiving measurements MUST be able to process the range of 518 floating point numbers that are representable as an IEEE double 519 precision floating point numbers [IEEE.754.1985]. This allows time 520 values to have better than microsecond precision over the next 100 521 years. The number of significant digits in any measurement is not 522 relevant, so a reading of 1.1 has exactly the same semantic meaning 523 as 1.10. If the value has an exponent, the "e" MUST be in lower 524 case. In the interest of avoiding unnecessary verbosity and speeding 525 up processing, the mantissa SHOULD be less than 19 characters long 526 and the exponent SHOULD be less than 5 characters long. 528 5.1. Examples 530 5.1.1. Single Datapoint 532 The following shows a temperature reading taken approximately "now" 533 by a 1-wire sensor device that was assigned the unique 1-wire address 534 of 10e2073a01080063: 536 [ 537 {"n":"urn:dev:ow:10e2073a01080063","u":"Cel","v":23.1} 538 ] 540 5.1.2. Multiple Datapoints 542 The following example shows voltage and current now, i.e., at an 543 unspecified time. 545 [ 546 {"bn":"urn:dev:ow:10e2073a01080063:","n":"voltage","u":"V","v":120.1}, 547 {"n":"current","u":"A","v":1.2} 548 ] 550 The next example is similar to the above one, but shows current at 551 Tue Jun 8 18:01:16.001 UTC 2010 and at each second for the previous 5 552 seconds. 554 [ 555 {"bn":"urn:dev:ow:10e2073a0108006:","bt":1.276020076001e+09, 556 "bu":"A","bver":5, 557 "n":"voltage","u":"V","v":120.1}, 558 {"n":"current","t":-5,"v":1.2}, 559 {"n":"current","t":-4,"v":1.3}, 560 {"n":"current","t":-3,"v":1.4}, 561 {"n":"current","t":-2,"v":1.5}, 562 {"n":"current","t":-1,"v":1.6}, 563 {"n":"current","v":1.7} 564 ] 566 Note that in some usage scenarios of SenML the implementations MAY 567 store or transmit SenML in a stream-like fashion, where data is 568 collected over time and continuously added to the object. This mode 569 of operation is optional, but systems or protocols using SenML in 570 this fashion MUST specify that they are doing this. SenML defines 571 separate media types to indicate Sensor Streaming Measurement Lists 572 (SensML) for this usage (see Section 12.3.2). In this situation the 573 SensML stream can be sent and received in a partial fashion, i.e., a 574 measurement entry can be read as soon as the SenML Record is received 575 and not have to wait for the full SensML Stream to be complete. 577 For instance, the following stream of measurements may be sent via a 578 long lived HTTP POST from the producer of a SensML to the consumer of 579 that, and each measurement object may be reported at the time it was 580 measured: 582 [ 583 {"bn":"urn:dev:ow:10e2073a01080063","bt":1.320067464e+09, 584 "bu":"%RH","v":21.2}, 585 {"t":10,"v":21.3}, 586 {"t":20,"v":21.4}, 587 {"t":30,"v":21.4}, 588 {"t":40,"v":21.5}, 589 {"t":50,"v":21.5}, 590 {"t":60,"v":21.5}, 591 {"t":70,"v":21.6}, 592 {"t":80,"v":21.7}, 593 ... 595 5.1.3. Multiple Measurements 597 The following example shows humidity measurements from a mobile 598 device with a 1-wire address 10e2073a01080063, starting at Mon Oct 31 599 13:24:24 UTC 2011. The device also provides position data, which is 600 provided in the same measurement or parameter array as separate 601 entries. Note time is used to for correlating data that belongs 602 together, e.g., a measurement and a parameter associated with it. 603 Finally, the device also reports extra data about its battery status 604 at a separate time. 606 [ 607 {"bn":"urn:dev:ow:10e2073a01080063","bt":1.320067464e+09, 608 "bu":"%RH","v":20}, 609 {"u":"lon","v":24.30621}, 610 {"u":"lat","v":60.07965}, 611 {"t":60,"v":20.3}, 612 {"u":"lon","t":60,"v":24.30622}, 613 {"u":"lat","t":60,"v":60.07965}, 614 {"t":120,"v":20.7}, 615 {"u":"lon","t":120,"v":24.30623}, 616 {"u":"lat","t":120,"v":60.07966}, 617 {"u":"%EL","t":150,"v":98}, 618 {"t":180,"v":21.2}, 619 {"u":"lon","t":180,"v":24.30628}, 620 {"u":"lat","t":180,"v":60.07967} 621 ] 623 The size of this example represented in various forms, as well as 624 that form compressed with gzip is given in the following table. 626 +----------+------+-----------------+ 627 | Encoding | Size | Compressed Size | 628 +----------+------+-----------------+ 629 | JSON | 573 | 206 | 630 | XML | 649 | 235 | 631 | CBOR | 254 | 196 | 632 | EXI | 161 | 184 | 633 +----------+------+-----------------+ 635 Table 3: Size Comparisons 637 5.1.4. Resolved Data 639 The following shows the example from the previous section show in 640 resolved format. 642 [ 643 {"n":"urn:dev:ow:10e2073a01080063","u":"%RH","t":1.320067464e+09, 644 "v":20}, 645 {"n":"urn:dev:ow:10e2073a01080063","u":"lon","t":1.320067464e+09, 646 "v":24.30621}, 647 {"n":"urn:dev:ow:10e2073a01080063","u":"lat","t":1.320067464e+09, 648 "v":60.07965}, 649 {"n":"urn:dev:ow:10e2073a01080063","u":"%RH","t":1.320067524e+09, 650 "v":20.3}, 651 {"n":"urn:dev:ow:10e2073a01080063","u":"lon","t":1.320067524e+09, 652 "v":24.30622}, 653 {"n":"urn:dev:ow:10e2073a01080063","u":"lat","t":1.320067524e+09, 654 "v":60.07965}, 655 {"n":"urn:dev:ow:10e2073a01080063","u":"%RH","t":1.320067584e+09, 656 "v":20.7}, 657 {"n":"urn:dev:ow:10e2073a01080063","u":"lon","t":1.320067584e+09, 658 "v":24.30623}, 659 {"n":"urn:dev:ow:10e2073a01080063","u":"lat","t":1.320067584e+09, 660 "v":60.07966}, 661 {"n":"urn:dev:ow:10e2073a01080063","u":"%EL","t":1.320067614e+09, 662 "v":98}, 663 {"n":"urn:dev:ow:10e2073a01080063","u":"%RH","t":1.320067644e+09, 664 "v":21.2}, 665 {"n":"urn:dev:ow:10e2073a01080063","u":"lon","t":1.320067644e+09, 666 "v":24.30628}, 667 {"n":"urn:dev:ow:10e2073a01080063","u":"lat","t":1.320067644e+09, 668 "v":60.07967} 669 ] 671 5.1.5. Multiple Data Types 673 The following example shows a sensor that returns different data 674 types. 676 [ 677 {"bn":"urn:dev:ow:10e2073a01080063:","n":"temp","u":"Cel","v":23.1}, 678 {"n":"label","vs":"Machine Room"}, 679 {"n":"open","vb":false}, 680 {"n":"nfv-reader","vd":"aGkgCg"} 681 ] 683 5.1.6. Collection of Resources 685 The following example shows the results from a query to one device 686 that aggregates multiple measurements from another devices. The 687 example assumes that a client has fetched information from a device 688 at 2001:db8::2 by performing a GET operation on http://[2001:db8::2] 689 at Mon Oct 31 16:27:09 UTC 2011, and has gotten two separate values 690 as a result, a temperature and humidity measurement as well as the 691 results from another device at http://[2001:db8::1] that also had a 692 temperature and humidity. Note that the last record would use the 693 Base Name from the 3rd record but the Base Time from the first 694 record. 696 [ 697 {"bn":"2001:db8::2/","bt":1.320078429e+09, 698 "n":"temperature","u":"Cel","v":25.2}, 699 {"n":"humidity","u":"%RH","v":30}, 700 {"bn":"2001:db8::1/","n":"temperature","u":"Cel","v":12.3}, 701 {"n":"humidity","u":"%RH","v":67} 702 ] 704 5.1.7. Setting an Actuator 706 The following example show the SenML that could be used to set the 707 current set point of a typical residential thermostat which has a 708 temperature set point, a switch to turn on and off the heat, and a 709 switch to turn on the fan override. 711 [ 712 {"bn":"urn:dev:ow:10e2073a01080063:"}, 713 {"n":"temp","u":"Cel","v":23.1}, 714 {"n":"heat","u":"/","v":1}, 715 {"n":"fan","u":"/","v":0} 716 ] 718 In the following example two different lights are turned on. It is 719 assumed that the lights are on a network that can guarantee delivery 720 of the messages to the two lights within 15 ms (e.g. a network using 721 802.1BA [IEEE802.1ba-2011] and 802.1AS [IEEE802.1as-2011] for time 722 synchronization). The controller has set the time of the lights 723 coming on to 20 ms in the future from the current time. This allows 724 both lights to receive the message, wait till that time, then apply 725 the switch command so that both lights come on at the same time. 727 [ 728 {"bt":1.320078429e+09,"bu":"/","n":"2001:db8::3","v":1}, 729 {"n":"2001:db8::4","v":1} 730 ] 732 The following shows two lights being turned off using a non 733 deterministic network that has a high odds of delivering a message in 734 less than 100 ms and uses NTP for time synchronization. The current 735 time is 1320078429. The user has just turned off a light switch 736 which is turning off two lights. Both lights are dimmed to 50% 737 brightness immediately to give the user instant feedback that 738 something is changing. However given the network, the lights will 739 probably dim at somewhat different times. Then 100 ms in the future, 740 both lights will go off at the same time. The instant but not 741 synchronized dimming gives the user the sensation of quick responses 742 and the timed off 100 ms in the future gives the perception of both 743 lights going off at the same time. 745 [ 746 {"bt":1.320078429e+09,"bu":"/","n":"2001:db8::3","v":0.5}, 747 {"n":"2001:db8::4","v":0.5}, 748 {"n":"2001:db8::3","t":0.1,"v":0}, 749 {"n":"2001:db8::4","t":0.1,"v":0} 750 ] 752 6. CBOR Representation (application/senml+cbor) 754 The CBOR [RFC7049] representation is equivalent to the JSON 755 representation, with the following changes: 757 o For JSON Numbers, the CBOR representation can use integers, 758 floating point numbers, or decimal fractions (CBOR Tag 4); however 759 a representation SHOULD be chosen such that when the CBOR value is 760 converted back to an IEEE double precision floating point value, 761 it has exactly the same value as the original Number. For the 762 version number, only an unsigned integer is allowed. 764 o Characters in the String Value are encoded using a definite length 765 text string (type 3). Octets in the Data Value are encoded using 766 a definite length byte string (type 2). 768 o For compactness, the CBOR representation uses integers for the 769 labels, as defined in Table 4. This table is conclusive, i.e., 770 there is no intention to define any additional integer map keys; 771 any extensions will use string map keys. This allows translators 772 converting between CBOR and JSON representations to convert also 773 all future labels without needing to update implementations. 775 +---------------+-------+------------+ 776 | Name | Label | CBOR Label | 777 +---------------+-------+------------+ 778 | Version | bver | -1 | 779 | Base Name | bn | -2 | 780 | Base Time | bt | -3 | 781 | Base Unit | bu | -4 | 782 | Base Value | bv | -5 | 783 | Base Sum | bs | -6 | 784 | Name | n | 0 | 785 | Unit | u | 1 | 786 | Value | v | 2 | 787 | String Value | vs | 3 | 788 | Boolean Value | vb | 4 | 789 | Value Sum | s | 5 | 790 | Time | t | 6 | 791 | Update Time | ut | 7 | 792 | Data Value | vd | 8 | 793 +---------------+-------+------------+ 795 Table 4: CBOR representation: integers for map keys 797 o For streaming SensML in CBOR representation, the array containing 798 the records SHOULD be a CBOR indefinite length array while for 799 non-streaming SenML, a definite length array MUST be used. 801 The following example shows a dump of the CBOR example for the same 802 sensor measurement as in Section 5.1.2. 804 0000 87 a7 21 78 1b 75 72 6e 3a 64 65 76 3a 6f 77 3a |..!x.urn:dev:ow:| 805 0010 31 30 65 32 30 37 33 61 30 31 30 38 30 30 36 3a |10e2073a0108006:| 806 0020 22 fb 41 d3 03 a1 5b 00 10 62 23 61 41 20 05 00 |".A...[..b#aA ..| 807 0030 67 76 6f 6c 74 61 67 65 01 61 56 02 fb 40 5e 06 |gvoltage.aV..@^.| 808 0040 66 66 66 66 66 a3 00 67 63 75 72 72 65 6e 74 06 |fffff..gcurrent.| 809 0050 24 02 fb 3f f3 33 33 33 33 33 33 a3 00 67 63 75 |$..?.333333..gcu| 810 0060 72 72 65 6e 74 06 23 02 fb 3f f4 cc cc cc cc cc |rrent.#..?......| 811 0070 cd a3 00 67 63 75 72 72 65 6e 74 06 22 02 fb 3f |...gcurrent."..?| 812 0080 f6 66 66 66 66 66 66 a3 00 67 63 75 72 72 65 6e |.ffffff..gcurren| 813 0090 74 06 21 02 f9 3e 00 a3 00 67 63 75 72 72 65 6e |t.!..>...gcurren| 814 00a0 74 06 20 02 fb 3f f9 99 99 99 99 99 9a a3 00 67 |t. ..?.........g| 815 00b0 63 75 72 72 65 6e 74 06 00 02 fb 3f fb 33 33 33 |current....?.333| 816 00c0 33 33 33 |333| 817 00c3 818 In CBOR diagnostic notation (Section 6 of [RFC7049]), this is: 820 [{-2: "urn:dev:ow:10e2073a0108006:", 821 -3: 1276020076.001, -4: "A", -1: 5, 0: "voltage", 1: "V", 2: 120.1}, 822 {0: "current", 6: -5, 2: 1.2}, {0: "current", 6: -4, 2: 1.3}, 823 {0: "current", 6: -3, 2: 1.4}, {0: "current", 6: -2, 2: 1.5}, 824 {0: "current", 6: -1, 2: 1.6}, {0: "current", 6: 0, 2: 1.7}] 826 7. XML Representation (application/senml+xml) 828 A SenML Pack or Stream can also be represented in XML format as 829 defined in this section. 831 Only the UTF-8 form of XML is allowed. Characters in the String 832 Value are encoded using the escape sequences defined in [RFC8259]. 833 Octets in the Data Value are base64 encoded with URL safe alphabet as 834 defined in Section 5 of [RFC4648]. 836 The following example shows an XML example for the same sensor 837 measurement as in Section 5.1.2. 839 840 842 843 844 845 846 847 848 850 The SenML Stream is represented as a sensml element that contains a 851 series of senml elements for each SenML Record. The SenML fields are 852 represented as XML attributes. For each field defined in this 853 document, the following table shows the SenML labels, which are used 854 for the XML attribute name, as well as the according restrictions on 855 the XML attribute values ("type") as used in the XML senml elements. 857 +---------------+-------+---------+ 858 | Name | Label | Type | 859 +---------------+-------+---------+ 860 | Base Name | bn | string | 861 | Base Time | bt | double | 862 | Base Unit | bu | string | 863 | Base Value | bv | double | 864 | Base Sum | bs | double | 865 | Base Version | bver | int | 866 | Name | n | string | 867 | Unit | u | string | 868 | Value | v | double | 869 | String Value | vs | string | 870 | Data Value | vd | string | 871 | Boolean Value | vb | boolean | 872 | Value Sum | s | double | 873 | Time | t | double | 874 | Update Time | ut | double | 875 +---------------+-------+---------+ 877 Table 5: XML SenML Labels 879 The RelaxNG [RNC] schema for the XML is: 881 default namespace = "urn:ietf:params:xml:ns:senml" 882 namespace rng = "http://relaxng.org/ns/structure/1.0" 884 senml = element senml { 885 attribute bn { xsd:string }?, 886 attribute bt { xsd:double }?, 887 attribute bv { xsd:double }?, 888 attribute bs { xsd:double }?, 889 attribute bu { xsd:string }?, 890 attribute bver { xsd:int }?, 892 attribute n { xsd:string }?, 893 attribute s { xsd:double }?, 894 attribute t { xsd:double }?, 895 attribute u { xsd:string }?, 896 attribute ut { xsd:double }?, 898 attribute v { xsd:double }?, 899 attribute vb { xsd:boolean }?, 900 attribute vs { xsd:string }?, 901 attribute vd { xsd:string }? 902 } 904 sensml = 905 element sensml { 906 senml+ 907 } 909 start = sensml 911 8. EXI Representation (application/senml-exi) 913 For efficient transmission of SenML over e.g. a constrained network, 914 Efficient XML Interchange (EXI) can be used. This encodes the XML 915 Schema [W3C.REC-xmlschema-1-20041028] structure of SenML into binary 916 tags and values rather than ASCII text. An EXI representation of 917 SenML SHOULD be made using the strict schema-mode of EXI. This mode 918 however does not allow tag extensions to the schema, and therefore 919 any extensions will be lost in the encoding. For uses where 920 extensions need to be preserved in EXI, the non-strict schema mode of 921 EXI MAY be used. 923 The EXI header MUST include an "EXI Options", as defined in 924 [W3C.REC-exi-20140211], with an schemaId set to the value of "a" 925 indicating the schema provided in this specification. Future 926 revisions to the schema can change the value of the schemaId to allow 927 for backwards compatibility. When the data will be transported over 928 CoAP or HTTP, an EXI Cookie SHOULD NOT be used as it simply makes 929 things larger and is redundant to information provided in the 930 Content-Type header. 932 The following is the XSD Schema to be used for strict schema guided 933 EXI processing. It is generated from the RelaxNG. 935 936 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 968 The following shows a hexdump of the EXI produced from encoding the 969 following XML example. Note this example is the same information as 970 the first example in Section 5.1.2 in JSON format. 972 973 975 976 977 Which compresses with EXI to the following displayed in hexdump: 979 0000 a0 30 0d 84 80 f3 ab 93 71 d3 23 2b b1 d3 7b b9 |.0......q.#+..{.| 980 0010 d1 89 83 29 91 81 b9 9b 09 81 89 81 c1 81 81 b1 |...)............| 981 0020 99 d2 84 bb 37 b6 3a 30 b3 b2 90 1a b1 58 84 c0 |....7.:0.....X..| 982 0030 33 04 b1 ba b9 39 32 b7 3a 10 1a 09 06 40 38 |3....92.:....@8| 983 003f 985 The above example used the bit packed form of EXI but it is also 986 possible to use a byte packed form of EXI which can makes it easier 987 for a simple sensor to produce valid EXI without really implementing 988 EXI. Consider the example of a temperature sensor that produces a 989 value in tenths of degrees Celsius over a range of 0.0 to 55.0. It 990 would produce an XML SenML file such as: 992 993 994 996 The compressed form, using the byte alignment option of EXI, for the 997 above XML is the following: 999 0000 a0 00 48 80 6c 20 01 06 1d 75 72 6e 3a 64 65 76 |..H.l ...urn:dev| 1000 0010 3a 6f 77 3a 31 30 65 32 30 37 33 61 30 31 30 38 |:ow:10e2073a0108| 1001 0020 30 30 36 33 02 05 43 65 6c 01 00 e7 01 01 00 03 |0063..Cel.......| 1002 0030 01 |.| 1003 0031 1005 A small temperature sensor device that only generates this one EXI 1006 file does not really need an full EXI implementation. It can simply 1007 hard code the output replacing the 1-wire device ID starting at byte 1008 0x20 and going to byte 0x2F with it's device ID, and replacing the 1009 value "0xe7 0x01" at location 0x37 and 0x38 with the current 1010 temperature. The EXI Specification [W3C.REC-exi-20140211] contains 1011 the full information on how floating point numbers are represented, 1012 but for the purpose of this sensor, the temperature can be converted 1013 to an integer in tenths of degrees (231 in this example). EXI stores 1014 7 bits of the integer in each byte with the top bit set to one if 1015 there are further bytes. So the first bytes at is set to low 7 bits 1016 of the integer temperature in tenths of degrees plus 0x80. In this 1017 example 231 & 0x7F + 0x80 = 0xE7. The second byte is set to the 1018 integer temperature in tenths of degrees right shifted 7 bits. In 1019 this example 231 >> 7 = 0x01. 1021 9. Fragment Identification Methods 1023 A SenML Pack typically consists of multiple SenML Records and for 1024 some applications it may be useful to be able to refer with a 1025 Fragment Identifier to a single record, or a set of records, in a 1026 Pack. The fragment identifier is only interpreted by a client and 1027 does not impact retrieval of a representation. The SenML Fragment 1028 Identification is modeled after CSV Fragment Identifiers [RFC7111]. 1030 To select a single SenML Record, the "rec" scheme followed by a 1031 single number is used. For the purpose of numbering records, the 1032 first record is at position 1. A range of records can be selected by 1033 giving the first and the last record number separated by a '-' 1034 character. Instead of the second number, the '*' character can be 1035 used to indicate the last SenML Record in the Pack. A set of records 1036 can also be selected using a comma separated list of record positions 1037 or ranges. 1039 (We use the term "selecting a record" for identifying it as part of 1040 the fragment, not in the sense of isolating it from the Pack -- the 1041 record still needs to be interpreted as part of the Pack, e.g., using 1042 the base values defined in earlier records) 1044 9.1. Fragment Identification Examples 1046 The 3rd SenML Record from "coap://example.com/temp" resource can be 1047 selected with: 1049 coap://example.com/temp#rec=3 1051 Records from 3rd to 6th can be selected with: 1053 coap://example.com/temp#rec=3-6 1055 Records from 19th to the last can be selected with: 1057 coap://example.com/temp#rec=19-* 1059 The 3rd and 5th record can be selected with: 1061 coap://example.com/temp#rec=3,5 1063 To select the Records from third to fifth, the 10th record, and all 1064 from 19th to the last: 1066 coap://example.com/temp#rec=3-5,10,19-* 1068 10. Usage Considerations 1070 The measurements support sending both the current value of a sensor 1071 as well as the an integrated sum. For many types of measurements, 1072 the sum is more useful than the current value. For example, an 1073 electrical meter that measures the energy a given computer uses will 1074 typically want to measure the cumulative amount of energy used. This 1075 is less prone to error than reporting the power each second and 1076 trying to have something on the server side sum together all the 1077 power measurements. If the network between the sensor and the meter 1078 goes down over some period of time, when it comes back up, the 1079 cumulative sum helps reflect what happened while the network was 1080 down. A meter like this would typically report a measurement with 1081 the unit set to watts, but it would put the sum of energy used in the 1082 "s" field of the measurement. It might optionally include the 1083 current power in the "v" field. 1085 While the benefit of using the integrated sum is fairly clear for 1086 measurements like power and energy, it is less obvious for something 1087 like temperature. Reporting the sum of the temperature makes it easy 1088 to compute averages even when the individual temperature values are 1089 not reported frequently enough to compute accurate averages. 1090 Implementers are encouraged to report the cumulative sum as well as 1091 the raw value of a given sensor. 1093 Applications that use the cumulative sum values need to understand 1094 they are very loosely defined by this specification, and depending on 1095 the particular sensor implementation may behave in unexpected ways. 1096 Applications should be able to deal with the following issues: 1098 1. Many sensors will allow the cumulative sums to "wrap" back to 1099 zero after the value gets sufficiently large. 1101 2. Some sensors will reset the cumulative sum back to zero when the 1102 device is reset, loses power, or is replaced with a different 1103 sensor. 1105 3. Applications cannot make assumptions about when the device 1106 started accumulating values into the sum. 1108 Typically applications can make some assumptions about specific 1109 sensors that will allow them to deal with these problems. A common 1110 assumption is that for sensors whose measurement values are always 1111 positive, the sum should never get smaller; so if the sum does get 1112 smaller, the application will know that one of the situations listed 1113 above has happened. 1115 11. CDDL 1117 As a convenient reference, the JSON and CBOR representations can be 1118 described with the common CDDL [I-D.ietf-cbor-cddl] specification in 1119 Figure 1 (informative). 1121 SenML-Pack = [1* record] 1123 record = { 1124 ? bn => tstr, ; Base Name 1125 ? bt => numeric, ; Base Time 1126 ? bu => tstr, ; Base Units 1127 ? bv => numeric, ; Base Value 1128 ? bs => numeric, ; Base Sum 1129 ? bver => uint, ; Base Version 1130 ? n => tstr, ; Name 1131 ? u => tstr, ; Units 1132 ? s => numeric, ; Value Sum 1133 ? t => numeric, ; Time 1134 ? ut => numeric, ; Update Time 1135 ? ( v => numeric // ; Numeric Value 1136 vs => tstr // ; String Value 1137 vb => bool // ; Boolean Value 1138 vd => binary-value ) ; Data Value 1139 * key-value-pair 1140 } 1142 ; now define the generic versions 1143 key-value-pair = ( label => value ) 1145 label = non-b-label / b-label 1146 non-b-label = tstr .regexp "[A-Zac-z0-9][-_:.A-Za-z0-9]*" / uint 1147 b-label = tstr .regexp "b[-_:.A-Za-z0-9]+" / nint 1149 value = tstr / binary-value / numeric / bool 1150 numeric = number / decfrac 1152 Figure 1: Common CDDL specification for CBOR and JSON SenML 1154 For JSON, we use text labels and base64url-encoded binary data 1155 (Figure 2). 1157 bver = "bver" n = "n" s = "s" 1158 bn = "bn" u = "u" t = "t" 1159 bt = "bt" v = "v" ut = "ut" 1160 bu = "bu" vs = "vs" vd = "vd" 1161 bv = "bv" vb = "vb" 1162 bs = "bs" 1164 binary-value = tstr ; base64url encoded 1166 Figure 2: JSON-specific CDDL specification for SenML 1168 For CBOR, we use integer labels and native binary data (Figure 3). 1170 bver = -1 n = 0 s = 5 1171 bn = -2 u = 1 t = 6 1172 bt = -3 v = 2 ut = 7 1173 bu = -4 vs = 3 vd = 8 1174 bv = -5 vb = 4 1175 bs = -6 1177 binary-value = bstr 1179 Figure 3: CBOR-specific CDDL specification for SenML 1181 12. IANA Considerations 1183 Note to RFC Editor: Please replace all occurrences of "RFC-AAAA" with 1184 the RFC number of this specification. 1186 12.1. Units Registry 1188 IANA will create a registry of SenML unit symbols. The primary 1189 purpose of this registry is to make sure that symbols uniquely map to 1190 give type of measurement. Definitions for many of these units can be 1191 found in location such as [NIST811] and [BIPM]. Units marked with an 1192 asterisk are NOT RECOMMENDED to be produced by new implementations, 1193 but are in active use and SHOULD be implemented by consumers that can 1194 use the related base units. 1196 +----------+------------------------------------+-------+-----------+ 1197 | Symbol | Description | Type | Reference | 1198 +----------+------------------------------------+-------+-----------+ 1199 | m | meter | float | RFC-AAAA | 1200 | kg | kilogram | float | RFC-AAAA | 1201 | g | gram* | float | RFC-AAAA | 1202 | s | second | float | RFC-AAAA | 1203 | A | ampere | float | RFC-AAAA | 1204 | K | kelvin | float | RFC-AAAA | 1205 | cd | candela | float | RFC-AAAA | 1206 | mol | mole | float | RFC-AAAA | 1207 | Hz | hertz | float | RFC-AAAA | 1208 | rad | radian | float | RFC-AAAA | 1209 | sr | steradian | float | RFC-AAAA | 1210 | N | newton | float | RFC-AAAA | 1211 | Pa | pascal | float | RFC-AAAA | 1212 | J | joule | float | RFC-AAAA | 1213 | W | watt | float | RFC-AAAA | 1214 | C | coulomb | float | RFC-AAAA | 1215 | V | volt | float | RFC-AAAA | 1216 | F | farad | float | RFC-AAAA | 1217 | Ohm | ohm | float | RFC-AAAA | 1218 | S | siemens | float | RFC-AAAA | 1219 | Wb | weber | float | RFC-AAAA | 1220 | T | tesla | float | RFC-AAAA | 1221 | H | henry | float | RFC-AAAA | 1222 | Cel | degrees Celsius | float | RFC-AAAA | 1223 | lm | lumen | float | RFC-AAAA | 1224 | lx | lux | float | RFC-AAAA | 1225 | Bq | becquerel | float | RFC-AAAA | 1226 | Gy | gray | float | RFC-AAAA | 1227 | Sv | sievert | float | RFC-AAAA | 1228 | kat | katal | float | RFC-AAAA | 1229 | m2 | square meter (area) | float | RFC-AAAA | 1230 | m3 | cubic meter (volume) | float | RFC-AAAA | 1231 | l | liter (volume)* | float | RFC-AAAA | 1232 | m/s | meter per second (velocity) | float | RFC-AAAA | 1233 | m/s2 | meter per square second | float | RFC-AAAA | 1234 | | (acceleration) | | | 1235 | m3/s | cubic meter per second (flow rate) | float | RFC-AAAA | 1236 | l/s | liter per second (flow rate)* | float | RFC-AAAA | 1237 | W/m2 | watt per square meter (irradiance) | float | RFC-AAAA | 1238 | cd/m2 | candela per square meter | float | RFC-AAAA | 1239 | | (luminance) | | | 1240 | bit | bit (information content) | float | RFC-AAAA | 1241 | bit/s | bit per second (data rate) | float | RFC-AAAA | 1242 | lat | degrees latitude (note 1) | float | RFC-AAAA | 1243 | lon | degrees longitude (note 1) | float | RFC-AAAA | 1244 | pH | pH value (acidity; logarithmic | float | RFC-AAAA | 1245 | | quantity) | | | 1246 | dB | decibel (logarithmic quantity) | float | RFC-AAAA | 1247 | dBW | decibel relative to 1 W (power | float | RFC-AAAA | 1248 | | level) | | | 1249 | Bspl | bel (sound pressure level; | float | RFC-AAAA | 1250 | | logarithmic quantity)* | | | 1251 | count | 1 (counter value) | float | RFC-AAAA | 1252 | / | 1 (Ratio e.g., value of a switch, | float | RFC-AAAA | 1253 | | note 2) | | | 1254 | % | 1 (Ratio e.g., value of a switch, | float | RFC-AAAA | 1255 | | note 2)* | | | 1256 | %RH | Percentage (Relative Humidity) | float | RFC-AAAA | 1257 | %EL | Percentage (remaining battery | float | RFC-AAAA | 1258 | | energy level) | | | 1259 | EL | seconds (remaining battery energy | float | RFC-AAAA | 1260 | | level) | | | 1261 | 1/s | 1 per second (event rate) | float | RFC-AAAA | 1262 | 1/min | 1 per minute (event rate, "rpm")* | float | RFC-AAAA | 1263 | beat/min | 1 per minute (Heart rate in beats | float | RFC-AAAA | 1264 | | per minute)* | | | 1265 | beats | 1 (Cumulative number of heart | float | RFC-AAAA | 1266 | | beats)* | | | 1267 | S/m | Siemens per meter (conductivity) | float | RFC-AAAA | 1268 +----------+------------------------------------+-------+-----------+ 1270 Table 6 1272 o Note 1: Assumed to be in WGS84 unless another reference frame is 1273 known for the sensor. 1275 o Note 2: A value of 0.0 indicates the switch is off while 1.0 1276 indicates on and 0.5 would be half on. The preferred name of this 1277 unit is "/". For historical reasons, the name "%" is also 1278 provided for the same unit - but note that while that name 1279 strongly suggests a percentage (0..100) -- it is however NOT a 1280 percentage, but the absolute ratio! 1282 New entries can be added to the registration by Expert Review as 1283 defined in [RFC8126]. Experts should exercise their own good 1284 judgment but need to consider the following guidelines: 1286 1. There needs to be a real and compelling use for any new unit to 1287 be added. 1289 2. Each unit should define the semantic information and be chosen 1290 carefully. Implementers need to remember that the same word may 1291 be used in different real-life contexts. For example, degrees 1292 when measuring latitude have no semantic relation to degrees 1293 when measuring temperature; thus two different units are needed. 1295 3. These measurements are produced by computers for consumption by 1296 computers. The principle is that conversion has to be easily be 1297 done when both reading and writing the media type. The value of 1298 a single canonical representation outweighs the convenience of 1299 easy human representations or loss of precision in a conversion. 1301 4. Use of SI prefixes such as "k" before the unit is not 1302 recommended. Instead one can represent the value using 1303 scientific notation such a 1.2e3. The "kg" unit is exception to 1304 this rule since it is an SI base unit; the "g" unit is provided 1305 for legacy compatibility. 1307 5. For a given type of measurement, there will only be one unit 1308 type defined. So for length, meters are defined and other 1309 lengths such as mile, foot, light year are not allowed. For 1310 most cases, the SI unit is preferred. 1312 (Note that some amount of judgment will be required here, as 1313 even SI itself is not entirely consistent in this respect. For 1314 instance, for temperature [ISO-80000-5] defines a quantity, item 1315 5-1 (thermodynamic temperature), and a corresponding unit 5-1.a 1316 (Kelvin), and then goes ahead to define another quantity right 1317 besides that, item 5-2 ("Celsius temperature"), and the 1318 corresponding unit 5-2.a (degree Celsius). The latter quantity 1319 is defined such that it gives the thermodynamic temperature as a 1320 delta from T0 = 275.15 K. ISO 80000-5 is defining both units 1321 side by side, and not really expressing a preference. This 1322 level of recognition of the alternative unit degree Celsius is 1323 the reason why Celsius temperatures exceptionally seem 1324 acceptable in the SenML units list alongside Kelvin.) 1326 6. Symbol names that could be easily confused with existing common 1327 units or units combined with prefixes should be avoided. For 1328 example, selecting a unit name of "mph" to indicate something 1329 that had nothing to do with velocity would be a bad choice, as 1330 "mph" is commonly used to mean miles per hour. 1332 7. The following should not be used because the are common SI 1333 prefixes: Y, Z, E, P, T, G, M, k, h, da, d, c, n, u, p, f, a, z, 1334 y, Ki, Mi, Gi, Ti, Pi, Ei, Zi, Yi. 1336 8. The following units should not be used as they are commonly used 1337 to represent other measurements Ky, Gal, dyn, etg, P, St, Mx, G, 1338 Oe, Gb, sb, Lmb, mph, Ci, R, RAD, REM, gal, bbl, qt, degF, Cal, 1339 BTU, HP, pH, B/s, psi, Torr, atm, at, bar, kWh. 1341 9. The unit names are case sensitive and the correct case needs to 1342 be used, but symbols that differ only in case should not be 1343 allocated. 1345 10. A number after a unit typically indicates the previous unit 1346 raised to that power, and the / indicates that the units that 1347 follow are the reciprocal. A unit should have only one / in the 1348 name. 1350 11. A good list of common units can be found in the Unified Code for 1351 Units of Measure [UCUM]. 1353 12.2. SenML Label Registry 1355 IANA will create a new registry for SenML labels. The initial 1356 content of the registry is: 1358 +--------------+-------+----+-----------+----------+----+-----------+ 1359 | Name | Label | CL | JSON Type | XML Type | EI | Reference | 1360 +--------------+-------+----+-----------+----------+----+-----------+ 1361 | Base Name | bn | -2 | String | string | a | RFCXXXX | 1362 | Base Time | bt | -3 | Number | double | a | RFCXXXX | 1363 | Base Unit | bu | -4 | String | string | a | RFCXXXX | 1364 | Base Value | bv | -5 | Number | double | a | RFCXXXX | 1365 | Base Sum | bs | -6 | Number | double | a | RFCXXXX | 1366 | Base Version | bver | -1 | Number | int | a | RFCXXXX | 1367 | Name | n | 0 | String | string | a | RFCXXXX | 1368 | Unit | u | 1 | String | string | a | RFCXXXX | 1369 | Value | v | 2 | Number | double | a | RFCXXXX | 1370 | String Value | vs | 3 | String | string | a | RFCXXXX | 1371 | Boolean | vb | 4 | Boolean | boolean | a | RFCXXXX | 1372 | Value | | | | | | | 1373 | Data Value | vd | 8 | String | string | a | RFCXXXX | 1374 | Value Sum | s | 5 | Number | double | a | RFCXXXX | 1375 | Time | t | 6 | Number | double | a | RFCXXXX | 1376 | Update Time | ut | 7 | Number | double | a | RFCXXXX | 1377 +--------------+-------+----+-----------+----------+----+-----------+ 1379 Table 7: IANA Registry for SenML Labels, CL = CBOR Label, EI = EXI ID 1381 This is the same table as Table 1, with notes removed, and with 1382 columns added for the information that is all the same for this 1383 initial set of registrations, but will need to be supplied with a 1384 different value for new registrations. 1386 Note to RFC Editor. Please replace RFCXXXX with the number for this 1387 RFC. 1389 All new entries must define the Label Name, Label, and XML Type but 1390 the CBOR labels SHOULD be left empty as CBOR will use the string 1391 encoding for any new labels. The EI column contains the EXI schemaId 1392 value of the first Schema which includes this label or is empty if 1393 this label was not intended for use with EXI. The Note field SHOULD 1394 contain information about where to find out more information about 1395 this label. 1397 The JSON, CBOR, and EXI types are derived from the XML type. All XML 1398 numeric types such as double, float, integer and int become a JSON 1399 Number. XML boolean and string become a JSON Boolean and String 1400 respectively. CBOR represents numeric values with a CBOR type that 1401 does not lose any information from the JSON value. EXI uses the XML 1402 types. 1404 New entries can be added to the registration by Expert Review as 1405 defined in [RFC8126]. Experts should exercise their own good 1406 judgment but need to consider that shorter labels should have more 1407 strict review. New entries should not be made that counteract the 1408 advice at the end of Section 4.4. 1410 All new SenML labels that have "base" semantics (see Section 4.1) 1411 MUST start with the character 'b'. Regular labels MUST NOT start 1412 with that character. 1414 Extensions that add a label that is intended for use with XML need to 1415 create a new RelaxNG scheme that includes all the labels in the IANA 1416 registry. 1418 Extensions that add a label that is intended for use with EXI need to 1419 create a new XSD Schema that includes all the labels in the IANA 1420 registry and then allocate a new EXI schemaId value. Moving to the 1421 next letter in the alphabet is the suggested way to create the new 1422 value for the EXI schemaId. Any labels with previously blank ID 1423 values SHOULD be updated in the IANA table to have their ID set to 1424 this new schemaId value. 1426 Extensions that are mandatory to understand to correctly process the 1427 Pack MUST have a label name that ends with the '_' character. 1429 12.3. Media Type Registrations 1431 The following registrations are done following the procedure 1432 specified in [RFC6838] and [RFC7303]. This document registers media 1433 types for each serialization format of SenML (JSON, CBOR, and EXI) 1434 and also media types for the same formats of the streaming use 1435 (SensML). Clipboard formats are defined for the JSON and XML form of 1436 lists but do not make sense for streams or other formats. 1438 Note to RFC Editor - please remove this paragraph. Note that a 1439 request for media type review for senml+json was sent to the media- 1440 types@iana.org on Sept 21, 2010. A second request for all the types 1441 was sent on October 31, 2016. Please change all instances of RFC- 1442 AAAA with the RFC number of this document. 1444 12.3.1. senml+json Media Type Registration 1446 Type name: application 1448 Subtype name: senml+json 1450 Required parameters: none 1452 Optional parameters: none 1454 Encoding considerations: Must be encoded as using a subset of the 1455 encoding allowed in [RFC8259]. See RFC-AAAA for details. This 1456 simplifies implementation of very simple system and does not impose 1457 any significant limitations as all this data is meant for machine to 1458 machine communications and is not meant to be human readable. 1460 Security considerations: See Section 13 of RFC-AAAA. 1462 Interoperability considerations: Applications MUST ignore any JSON 1463 key value pairs that they do not understand unless the key ends with 1464 the '_' character in which case an error MUST be generated. This 1465 allows backwards compatible extensions to this specification. The 1466 "bver" field can be used to ensure the receiver supports a minimal 1467 level of functionality needed by the creator of the JSON object. 1469 Published specification: RFC-AAAA 1471 Applications that use this media type: The type is used by systems 1472 that report e.g., electrical power usage and environmental 1473 information such as temperature and humidity. It can be used for a 1474 wide range of sensor reporting systems. 1476 Fragment identifier considerations: Fragment identification for 1477 application/senml+json is supported by using fragment identifiers as 1478 specified by RFC-AAAA. 1480 Additional information: 1482 Magic number(s): none 1484 File extension(s): senml 1486 Windows Clipboard Name: "JSON Sensor Measurement List" 1488 Macintosh file type code(s): none 1490 Macintosh Universal Type Identifier code: org.ietf.senml-json 1491 conforms to public.text 1492 Person & email address to contact for further information: Cullen 1493 Jennings 1495 Intended usage: COMMON 1497 Restrictions on usage: None 1499 Author: Cullen Jennings 1501 Change controller: IESG 1503 12.3.2. sensml+json Media Type Registration 1505 Type name: application 1507 Subtype name: sensml+json 1509 Required parameters: none 1511 Optional parameters: none 1513 Encoding considerations: Must be encoded as using a subset of the 1514 encoding allowed in [RFC8259]. See RFC-AAAA for details. This 1515 simplifies implementation of very simple system and does not impose 1516 any significant limitations as all this data is meant for machine to 1517 machine communications and is not meant to be human readable. 1519 Security considerations: See Section 13 of RFC-AAAA. 1521 Interoperability considerations: Applications MUST ignore any JSON 1522 key value pairs that they do not understand unless the key ends with 1523 the '_' character in which case an error MUST be generated. This 1524 allows backwards compatible extensions to this specification. The 1525 "bver" field can be used to ensure the receiver supports a minimal 1526 level of functionality needed by the creator of the JSON object. 1528 Published specification: RFC-AAAA 1530 Applications that use this media type: The type is used by systems 1531 that report e.g., electrical power usage and environmental 1532 information such as temperature and humidity. It can be used for a 1533 wide range of sensor reporting systems. 1535 Fragment identifier considerations: Fragment identification for 1536 application/senml+json is supported by using fragment identifiers as 1537 specified by RFC-AAAA. 1539 Additional information: 1541 Magic number(s): none 1543 File extension(s): sensml 1545 Macintosh file type code(s): none 1547 Person & email address to contact for further information: Cullen 1548 Jennings 1550 Intended usage: COMMON 1552 Restrictions on usage: None 1554 Author: Cullen Jennings 1556 Change controller: IESG 1558 12.3.3. senml+cbor Media Type Registration 1560 Type name: application 1562 Subtype name: senml+cbor 1564 Required parameters: none 1566 Optional parameters: none 1568 Encoding considerations: Must be encoded as using [RFC7049]. See 1569 RFC-AAAA for details. 1571 Security considerations: See Section 13 of RFC-AAAA. 1573 Interoperability considerations: Applications MUST ignore any key 1574 value pairs that they do not understand unless the key ends with the 1575 '_' character in which case an error MUST be generated. This allows 1576 backwards compatible extensions to this specification. The "bver" 1577 field can be used to ensure the receiver supports a minimal level of 1578 functionality needed by the creator of the CBOR object. 1580 Published specification: RFC-AAAA 1582 Applications that use this media type: The type is used by systems 1583 that report e.g., electrical power usage and environmental 1584 information such as temperature and humidity. It can be used for a 1585 wide range of sensor reporting systems. 1587 Fragment identifier considerations: Fragment identification for 1588 application/senml+cbor is supported by using fragment identifiers as 1589 specified by RFC-AAAA. 1591 Additional information: 1593 Magic number(s): none 1595 File extension(s): senmlc 1597 Macintosh file type code(s): none 1599 Macintosh Universal Type Identifier code: org.ietf.senml-cbor 1600 conforms to public.data 1602 Person & email address to contact for further information: Cullen 1603 Jennings 1605 Intended usage: COMMON 1607 Restrictions on usage: None 1609 Author: Cullen Jennings 1611 Change controller: IESG 1613 12.3.4. sensml+cbor Media Type Registration 1615 Type name: application 1617 Subtype name: sensml+cbor 1619 Required parameters: none 1621 Optional parameters: none 1623 Encoding considerations: Must be encoded as using [RFC7049]. See 1624 RFC-AAAA for details. 1626 Security considerations: See Section 13 of RFC-AAAA. 1628 Interoperability considerations: Applications MUST ignore any key 1629 value pairs that they do not understand unless the key ends with the 1630 '_' character in which case an error MUST be generated. This allows 1631 backwards compatible extensions to this specification. The "bver" 1632 field can be used to ensure the receiver supports a minimal level of 1633 functionality needed by the creator of the CBOR object. 1635 Published specification: RFC-AAAA 1637 Applications that use this media type: The type is used by systems 1638 that report e.g., electrical power usage and environmental 1639 information such as temperature and humidity. It can be used for a 1640 wide range of sensor reporting systems. 1642 Fragment identifier considerations: Fragment identification for 1643 application/senml+cbor is supported by using fragment identifiers as 1644 specified by RFC-AAAA. 1646 Additional information: 1648 Magic number(s): none 1650 File extension(s): sensmlc 1652 Macintosh file type code(s): none 1654 Person & email address to contact for further information: Cullen 1655 Jennings 1657 Intended usage: COMMON 1659 Restrictions on usage: None 1661 Author: Cullen Jennings 1663 Change controller: IESG 1665 12.3.5. senml+xml Media Type Registration 1667 Type name: application 1669 Subtype name: senml+xml 1671 Required parameters: none 1673 Optional parameters: none 1675 Encoding considerations: Must be encoded as using 1676 [W3C.REC-xml-20081126]. See RFC-AAAA for details. 1678 Security considerations: See Section 13 of RFC-AAAA. 1680 Interoperability considerations: Applications MUST ignore any XML 1681 tags or attributes that they do not understand unless the attribute 1682 name ends with the '_' character in which case an error MUST be 1683 generated. This allows backwards compatible extensions to this 1684 specification. The "bver" attribute in the senml XML tag can be used 1685 to ensure the receiver supports a minimal level of functionality 1686 needed by the creator of the XML SenML Pack. 1688 Published specification: RFC-AAAA 1690 Applications that use this media type: The type is used by systems 1691 that report e.g., electrical power usage and environmental 1692 information such as temperature and humidity. It can be used for a 1693 wide range of sensor reporting systems. 1695 Fragment identifier considerations: Fragment identification for 1696 application/senml+xml is supported by using fragment identifiers as 1697 specified by RFC-AAAA. 1699 Additional information: 1701 Magic number(s): none 1703 File extension(s): senmlx 1705 Windows Clipboard Name: "XML Sensor Measurement List" 1707 Macintosh file type code(s): none 1709 Macintosh Universal Type Identifier code: org.ietf.senml-xml conforms 1710 to public.xml 1712 Person & email address to contact for further information: Cullen 1713 Jennings 1715 Intended usage: COMMON 1717 Restrictions on usage: None 1719 Author: Cullen Jennings 1721 Change controller: IESG 1723 12.3.6. sensml+xml Media Type Registration 1725 Type name: application 1727 Subtype name: sensml+xml 1729 Required parameters: none 1730 Optional parameters: none 1732 Encoding considerations: Must be encoded as using 1733 [W3C.REC-xml-20081126]. See RFC-AAAA for details. 1735 Security considerations: See Section 13 of RFC-AAAA. 1737 Interoperability considerations: Applications MUST ignore any XML 1738 tags or attributes that they do not understand unless the attribute 1739 name ends with the '_' character in which case an error MUST be 1740 generated. This allows backwards compatible extensions to this 1741 specification. The "bver" attribute in the senml XML tag can be used 1742 to ensure the receiver supports a minimal level of functionality 1743 needed by the creator of the XML SenML Pack. 1745 Published specification: RFC-AAAA 1747 Applications that use this media type: The type is used by systems 1748 that report e.g., electrical power usage and environmental 1749 information such as temperature and humidity. It can be used for a 1750 wide range of sensor reporting systems. 1752 Fragment identifier considerations: Fragment identification for 1753 application/senml+xml is supported by using fragment identifiers as 1754 specified by RFC-AAAA. 1756 Additional information: 1758 Magic number(s): none 1760 File extension(s): sensmlx 1762 Macintosh file type code(s): none 1764 Person & email address to contact for further information: Cullen 1765 Jennings 1767 Intended usage: COMMON 1769 Restrictions on usage: None 1771 Author: Cullen Jennings 1773 Change controller: IESG 1775 12.3.7. senml-exi Media Type Registration 1777 Type name: application 1779 Subtype name: senml-exi 1781 Required parameters: none 1783 Optional parameters: none 1785 Encoding considerations: Must be encoded as using 1786 [W3C.REC-exi-20140211]. See RFC-AAAA for details. 1788 Security considerations: See Section 13 of RFC-AAAA. 1790 Interoperability considerations: Applications MUST ignore any XML 1791 tags or attributes that they do not understand unless the attribute 1792 name ends with the '_' character in which case an error MUST be 1793 generated. This allows backwards compatible extensions to this 1794 specification. The "bver" attribute in the senml XML tag can be used 1795 to ensure the receiver supports a minimal level of functionality 1796 needed by the creator of the XML SenML Pack. Further information on 1797 using schemas to guide the EXI can be found in RFC-AAAA. 1799 Published specification: RFC-AAAA 1801 Applications that use this media type: The type is used by systems 1802 that report e.g., electrical power usage and environmental 1803 information such as temperature and humidity. It can be used for a 1804 wide range of sensor reporting systems. 1806 Fragment identifier considerations: Fragment identification for 1807 application/senml-exi is supported by using fragment identifiers as 1808 specified by RFC-AAAA. 1810 Additional information: 1812 Magic number(s): none 1814 File extension(s): senmle 1816 Macintosh file type code(s): none 1818 Macintosh Universal Type Identifier code: org.ietf.senml-exi conforms 1819 to public.data 1821 Person & email address to contact for further information: Cullen 1822 Jennings 1823 Intended usage: COMMON 1825 Restrictions on usage: None 1827 Author: Cullen Jennings 1829 Change controller: IESG 1831 12.3.8. sensml-exi Media Type Registration 1833 Type name: application 1835 Subtype name: sensml-exi 1837 Required parameters: none 1839 Optional parameters: none 1841 Encoding considerations: Must be encoded as using 1842 [W3C.REC-exi-20140211]. See RFC-AAAA for details. 1844 Security considerations: See Section 13 of RFC-AAAA. 1846 Interoperability considerations: Applications MUST ignore any XML 1847 tags or attributes that they do not understand unless the attribute 1848 name ends with the '_' character in which case an error MUST be 1849 generated. This allows backwards compatible extensions to this 1850 specification. The "bver" attribute in the senml XML tag can be used 1851 to ensure the receiver supports a minimal level of functionality 1852 needed by the creator of the XML SenML Pack. Further information on 1853 using schemas to guide the EXI can be found in RFC-AAAA. 1855 Published specification: RFC-AAAA 1857 Applications that use this media type: The type is used by systems 1858 that report e.g., electrical power usage and environmental 1859 information such as temperature and humidity. It can be used for a 1860 wide range of sensor reporting systems. 1862 Fragment identifier considerations: Fragment identification for 1863 application/senml-exi is supported by using fragment identifiers as 1864 specified by RFC-AAAA. 1866 Additional information: 1868 Magic number(s): none 1870 File extension(s): sensmle 1871 Macintosh file type code(s): none 1873 Person & email address to contact for further information: Cullen 1874 Jennings 1876 Intended usage: COMMON 1878 Restrictions on usage: None 1880 Author: Cullen Jennings 1882 Change controller: IESG 1884 12.4. XML Namespace Registration 1886 This document registers the following XML namespaces in the IETF XML 1887 registry defined in [RFC3688]. 1889 URI: urn:ietf:params:xml:ns:senml 1891 Registrant Contact: The IESG. 1893 XML: N/A, the requested URIs are XML namespaces 1895 12.5. CoAP Content-Format Registration 1897 IANA is requested to assign CoAP Content-Format IDs for the SenML 1898 media types in the "CoAP Content-Formats" sub-registry, within the 1899 "CoRE Parameters" registry [RFC7252]. All IDs are assigned from the 1900 "Expert Review" (0-255) range. The assigned IDs are show in Table 8. 1902 +-------------------------+-----+ 1903 | Media type | ID | 1904 +-------------------------+-----+ 1905 | application/senml+json | TBD | 1906 | application/sensml+json | TBD | 1907 | application/senml+cbor | TBD | 1908 | application/sensml+cbor | TBD | 1909 | application/senml+xml | TBD | 1910 | application/sensml+xml | TBD | 1911 | application/senml-exi | TBD | 1912 | application/sensml-exi | TBD | 1913 +-------------------------+-----+ 1915 Table 8: CoAP Content-Format IDs 1917 13. Security Considerations 1919 Sensor data can contain a wide range of information ranging from 1920 information that is very public, such as the outside temperature in a 1921 given city, to very private information that requires integrity and 1922 confidentiality protection, such as patient health information. The 1923 SenML formats do not provide any security and instead rely on the 1924 protocol that carries them to provide security. Applications using 1925 SenML need to look at the overall context of how these media types 1926 will be used to decide if the security is adequate. The SenML 1927 formats defined by this specification do not contain any executable 1928 content. However, future extensions could potentially embed 1929 application specific executable content in the data. 1931 See also Section 14. 1933 14. Privacy Considerations 1935 Sensor data can range from information with almost no security 1936 considerations, such as the current temperature in a given city, to 1937 highly sensitive medical or location data. This specification 1938 provides no security protection for the data but is meant to be used 1939 inside another container or transport protocol such as S/MIME 1940 [RFC5751] or HTTP with TLS [RFC5246] that can provide integrity, 1941 confidentiality, and authentication information about the source of 1942 the data. 1944 The name fields need to uniquely identify the sources or destinations 1945 of the values in a SenML Pack. However, the use of long-term stable 1946 unique identifiers can be problematic for privacy reasons [RFC6973], 1947 depending on the application and the potential of these identifiers 1948 to be used in correlation with other information. They should be 1949 used with care or avoided as for example described for IPv6 addresses 1950 in [RFC7721]. 1952 15. Acknowledgement 1954 We would like to thank Alexander Pelov, Alexey Melnikov, Andrew 1955 McClure, Andrew McGregor, Bjoern Hoehrmann, Christian Amsuess, 1956 Christian Groves, Daniel Peintner, Jan-Piet Mens, Jim Schaad, Joe 1957 Hildebrand, John Klensin, Karl Palsson, Lennart Duhrsen, Lisa 1958 Dusseault, Lyndsay Campbell, Martin Thomson, Michael Koster, Peter 1959 Saint-Andre, and Stephen Farrell, for their review comments. 1961 16. References 1963 16.1. Normative References 1965 [BIPM] Bureau International des Poids et Mesures, "The 1966 International System of Units (SI)", 8th edition, 2006. 1968 [IEEE.754.1985] 1969 Institute of Electrical and Electronics Engineers, 1970 "Standard for Binary Floating-Point Arithmetic", IEEE 1971 Standard 754, August 1985. 1973 [NIST811] Thompson, A. and B. Taylor, "Guide for the Use of the 1974 International System of Units (SI)", NIST Special 1975 Publication 811, 2008. 1977 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1978 Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/ 1979 RFC2119, March 1997, . 1982 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 1983 10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November 1984 2003, . 1986 [RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, 1987 DOI 10.17487/RFC3688, January 2004, . 1990 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 1991 Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006, 1992 . 1994 [RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type 1995 Specifications and Registration Procedures", BCP 13, RFC 1996 6838, DOI 10.17487/RFC6838, January 2013, 1997 . 1999 [RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object 2000 Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, 2001 October 2013, . 2003 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 2004 Application Protocol (CoAP)", RFC 7252, DOI 10.17487/ 2005 RFC7252, June 2014, . 2008 [RFC7303] Thompson, H. and C. Lilley, "XML Media Types", RFC 7303, 2009 DOI 10.17487/RFC7303, July 2014, . 2012 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2013 Writing an IANA Considerations Section in RFCs", BCP 26, 2014 RFC 8126, DOI 10.17487/RFC8126, June 2017, 2015 . 2017 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2018 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2019 May 2017, . 2021 [RFC8259] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data 2022 Interchange Format", STD 90, RFC 8259, DOI 10.17487/ 2023 RFC8259, December 2017, . 2026 [RNC] ISO/IEC, "Information technology -- Document Schema 2027 Definition Language (DSDL) -- Part 2: Regular-grammar- 2028 based validation -- RELAX NG", ISO/IEC 19757-2, Annex C: 2029 RELAX NG Compact syntax, December 2008. 2031 [TIME_T] The Open Group Base Specifications, "Vol. 1: Base 2032 Definitions, Issue 7", Section 4.15 'Seconds Since the 2033 Epoch', IEEE Std 1003.1, 2013 Edition, 2013, 2034 . 2037 [W3C.REC-exi-20140211] 2038 Schneider, J., Kamiya, T., Peintner, D., and R. Kyusakov, 2039 "Efficient XML Interchange (EXI) Format 1.0 (Second 2040 Edition)", World Wide Web Consortium Recommendation REC- 2041 exi-20140211, February 2014, 2042 . 2044 [W3C.REC-xml-20081126] 2045 Bray, T., Paoli, J., Sperberg-McQueen, M., Maler, E., and 2046 F. Yergeau, "Extensible Markup Language (XML) 1.0 (Fifth 2047 Edition)", World Wide Web Consortium Recommendation REC- 2048 xml-20081126, November 2008, 2049 . 2051 [W3C.REC-xmlschema-1-20041028] 2052 Thompson, H., Beech, D., Maloney, M., and N. Mendelsohn, 2053 "XML Schema Part 1: Structures Second Edition", World Wide 2054 Web Consortium Recommendation REC-xmlschema-1-20041028, 2055 October 2004, 2056 . 2058 16.2. Informative References 2060 [I-D.arkko-core-dev-urn] 2061 Arkko, J., Jennings, C., and Z. Shelby, "Uniform Resource 2062 Names for Device Identifiers", draft-arkko-core-dev-urn-05 2063 (work in progress), October 2017. 2065 [I-D.ietf-cbor-cddl] 2066 Birkholz, H., Vigano, C., and C. Bormann, "Concise data 2067 definition language (CDDL): a notational convention to 2068 express CBOR data structures", draft-ietf-cbor-cddl-02 2069 (work in progress), February 2018. 2071 [I-D.ietf-core-interfaces] 2072 Shelby, Z., Vial, M., Koster, M., Groves, C., Zhu, J., and 2073 B. Silverajan, "Reusable Interface Definitions for 2074 Constrained RESTful Environments", draft-ietf-core- 2075 interfaces-10 (work in progress), September 2017. 2077 [IEEE802.1as-2011] 2078 IEEE, "IEEE Standard for Local and Metropolitan Area 2079 Networks - Timing and Synchronization for Time-Sensitive 2080 Applications in Bridged Local Area Networks", 2011. 2082 [IEEE802.1ba-2011] 2083 IEEE, "IEEE Standard for Local and metropolitan area 2084 networks--Audio Video Bridging (AVB) Systems", 2011. 2086 [ISO-80000-5] 2087 "Quantities and units - Part 5: Thermodynamics", ISO 2088 80000-5, Edition 1.0, May 2007. 2090 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 2091 Resource Identifier (URI): Generic Syntax", STD 66, RFC 2092 3986, DOI 10.17487/RFC3986, January 2005, 2093 . 2095 [RFC4122] Leach, P., Mealling, M., and R. Salz, "A Universally 2096 Unique IDentifier (UUID) URN Namespace", RFC 4122, DOI 2097 10.17487/RFC4122, July 2005, . 2100 [RFC4151] Kindberg, T. and S. Hawke, "The 'tag' URI Scheme", RFC 2101 4151, DOI 10.17487/RFC4151, October 2005, 2102 . 2104 [RFC4944] Montenegro, G., Kushalnagar, N., Hui, J., and D. Culler, 2105 "Transmission of IPv6 Packets over IEEE 802.15.4 2106 Networks", RFC 4944, DOI 10.17487/RFC4944, September 2007, 2107 . 2109 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 2110 (TLS) Protocol Version 1.2", RFC 5246, DOI 10.17487/ 2111 RFC5246, August 2008, . 2114 [RFC5751] Ramsdell, B. and S. Turner, "Secure/Multipurpose Internet 2115 Mail Extensions (S/MIME) Version 3.2 Message 2116 Specification", RFC 5751, DOI 10.17487/RFC5751, January 2117 2010, . 2119 [RFC5952] Kawamura, S. and M. Kawashima, "A Recommendation for IPv6 2120 Address Text Representation", RFC 5952, DOI 10.17487/ 2121 RFC5952, August 2010, . 2124 [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link 2125 Format", RFC 6690, DOI 10.17487/RFC6690, August 2012, 2126 . 2128 [RFC6920] Farrell, S., Kutscher, D., Dannewitz, C., Ohlman, B., 2129 Keranen, A., and P. Hallam-Baker, "Naming Things with 2130 Hashes", RFC 6920, DOI 10.17487/RFC6920, April 2013, 2131 . 2133 [RFC6973] Cooper, A., Tschofenig, H., Aboba, B., Peterson, J., 2134 Morris, J., Hansen, M., and R. Smith, "Privacy 2135 Considerations for Internet Protocols", RFC 6973, DOI 2136 10.17487/RFC6973, July 2013, . 2139 [RFC7111] Hausenblas, M., Wilde, E., and J. Tennison, "URI Fragment 2140 Identifiers for the text/csv Media Type", RFC 7111, DOI 2141 10.17487/RFC7111, January 2014, . 2144 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 2145 Protocol (HTTP/1.1): Message Syntax and Routing", RFC 2146 7230, DOI 10.17487/RFC7230, June 2014, . 2149 [RFC7721] Cooper, A., Gont, F., and D. Thaler, "Security and Privacy 2150 Considerations for IPv6 Address Generation Mechanisms", 2151 RFC 7721, DOI 10.17487/RFC7721, March 2016, 2152 . 2154 [RFC8141] Saint-Andre, P. and J. Klensin, "Uniform Resource Names 2155 (URNs)", RFC 8141, DOI 10.17487/RFC8141, April 2017, 2156 . 2158 [UCUM] Schadow, G. and C. McDonald, "The Unified Code for Units 2159 of Measure (UCUM)", Regenstrief Institute and Indiana 2160 University School of Informatics, 2013, 2161 . 2163 Authors' Addresses 2165 Cullen Jennings 2166 Cisco 2167 400 3rd Avenue SW 2168 Calgary, AB T2P 4H2 2169 Canada 2171 Email: fluffy@iii.ca 2173 Zach Shelby 2174 ARM 2175 150 Rose Orchard 2176 San Jose 95134 2177 USA 2179 Phone: +1-408-203-9434 2180 Email: zach.shelby@arm.com 2182 Jari Arkko 2183 Ericsson 2184 Jorvas 02420 2185 Finland 2187 Email: jari.arkko@piuha.net 2188 Ari Keranen 2189 Ericsson 2190 Jorvas 02420 2191 Finland 2193 Email: ari.keranen@ericsson.com 2195 Carsten Bormann 2196 Universitaet Bremen TZI 2197 Postfach 330440 2198 Bremen D-28359 2199 Germany 2201 Phone: +49-421-218-63921 2202 Email: cabo@tzi.org