Tech-invite3GPPspaceIETF RFCsSIP
929190898887868584838281807978777675747372717069686766656463626160595857565554535251504948474645444342414039383736353433323130292827262524232221201918171615141312111009080706050403020100
in Index   Prev   Next

RFC 8428

Sensor Measurement Lists (SenML)

Pages: 54
Proposed Standard
Errata
Updated by:  9100
Part 2 of 3 – Pages 19 to 36
First   Prev   Next

Top   ToC   RFC8428 - Page 19   prevText

6. CBOR Representation (application/senml+cbor)

The CBOR [RFC7049] representation is equivalent to the JSON representation, with the following changes: o For JSON Numbers, the CBOR representation can use integers, floating-point numbers, or decimal fractions (CBOR Tag 4); however, a representation SHOULD be chosen such that when the CBOR value is converted to an IEEE double-precision, floating-point value, it has exactly the same value as the original JSON Number converted to that form. For the version number, only an unsigned integer is allowed. o Characters in the String Value are encoded using a text string with a definite length (major type 3). Octets in the Data Value are encoded using a byte string with a definite length (major type 2). o For compactness, the CBOR representation uses integers for the labels, as defined in Table 4. This table is conclusive, i.e., there is no intention to define any additional integer map keys; any extensions will use string map keys. This allows translators converting between CBOR and JSON representations to also convert all future labels without needing to update implementations. Base values are given negative CBOR labels, and others are given non-negative labels.
Top   ToC   RFC8428 - Page 20
                  +---------------+-------+------------+
                  |          Name | Label | CBOR Label |
                  +---------------+-------+------------+
                  |  Base Version | bver  |         -1 |
                  |     Base Name | bn    |         -2 |
                  |     Base Time | bt    |         -3 |
                  |     Base Unit | bu    |         -4 |
                  |    Base Value | bv    |         -5 |
                  |      Base Sum | bs    |         -6 |
                  |          Name | n     |          0 |
                  |          Unit | u     |          1 |
                  |         Value | v     |          2 |
                  |  String Value | vs    |          3 |
                  | Boolean Value | vb    |          4 |
                  |           Sum | s     |          5 |
                  |          Time | t     |          6 |
                  |   Update Time | ut    |          7 |
                  |    Data Value | vd    |          8 |
                  +---------------+-------+------------+

            Table 4: CBOR Representation: Integers for Map Keys

   o  For streaming SenSML in CBOR representation, the array containing
      the records SHOULD be a CBOR array with an indefinite length; for
      non-streaming SenML, an array with a definite length MUST be used.

   The following example shows a dump of the CBOR example for the same
   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:|
 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 ..|
 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.|
 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.#..?......|
 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|
 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|
 00b0 63 75 72 72 65 6e 74 06 00 02 fb 3f fb 33 33 33 |current....?.333|
 00c0 33 33 33                                        |333|
 00c3
Top   ToC   RFC8428 - Page 21
   In CBOR diagnostic notation (Section 6 of [RFC7049]), this is:

  [{-2: "urn:dev:ow:10e2073a0108006:",
    -3: 1276020076.001, -4: "A", -1: 5, 0: "voltage", 1: "V", 2: 120.1},
   {0: "current", 6: -5, 2: 1.2}, {0: "current", 6: -4, 2: 1.3},
   {0: "current", 6: -3, 2: 1.4}, {0: "current", 6: -2, 2: 1.5},
   {0: "current", 6: -1, 2: 1.6}, {0: "current", 6: 0, 2: 1.7}]

7. XML Representation (application/senml+xml)

A SenML Pack or Stream can also be represented in XML format as defined in this section. Only the UTF-8 form of XML is allowed. Octets in the Data Value are base64 encoded with the URL-safe alphabet as defined in Section 5 of [RFC4648], with padding omitted. The following shows an XML example for the same sensor measurement as in Section 5.1.2. <sensml xmlns="urn:ietf:params:xml:ns:senml"> <senml bn="urn:dev:ow:10e2073a0108006:" bt="1.276020076001e+09" 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="-4" v="1.3"></senml> <senml n="current" t="-3" v="1.4"></senml> <senml n="current" t="-2" v="1.5"></senml> <senml n="current" t="-1" v="1.6"></senml> <senml n="current" v="1.7"></senml> </sensml> The SenML Stream is represented as a sensml element that contains a series of senml elements for each SenML Record. The SenML fields are represented as XML attributes. For each field defined in this document, the following table shows the SenML Labels, which are used for the XML attribute name, as well as the according restrictions on the XML attribute values ("type") as used in the XML senml elements.
Top   ToC   RFC8428 - Page 22
                   +---------------+-------+----------+
                   |          Name | Label | XML Type |
                   +---------------+-------+----------+
                   |     Base Name | bn    | string   |
                   |     Base Time | bt    | double   |
                   |     Base Unit | bu    | string   |
                   |    Base Value | bv    | double   |
                   |      Base Sum | bs    | double   |
                   |  Base Version | bver  | int      |
                   |          Name | n     | string   |
                   |          Unit | u     | string   |
                   |         Value | v     | double   |
                   |  String Value | vs    | string   |
                   |    Data Value | vd    | string   |
                   | Boolean Value | vb    | boolean  |
                   |           Sum | s     | double   |
                   |          Time | t     | double   |
                   |   Update Time | ut    | double   |
                   +---------------+-------+----------+

                         Table 5: XML SenML Labels

   The RelaxNG [RNC] Schema for the XML is:

   default namespace = "urn:ietf:params:xml:ns:senml"
   namespace rng = "http://relaxng.org/ns/structure/1.0"

   senml = element senml {
     attribute bn { xsd:string }?,
     attribute bt { xsd:double }?,
     attribute bv { xsd:double }?,
     attribute bs { xsd:double }?,
     attribute bu { xsd:string }?,
     attribute bver { xsd:int }?,

     attribute n { xsd:string }?,
     attribute s { xsd:double }?,
     attribute t { xsd:double }?,
     attribute u { xsd:string }?,
     attribute ut { xsd:double }?,

     attribute v { xsd:double }?,
     attribute vb { xsd:boolean }?,
     attribute vs { xsd:string }?,
     attribute vd { xsd:string }?
   }
Top   ToC   RFC8428 - Page 23
   sensml =
     element sensml {
       senml+
   }

   start = sensml

8. EXI Representation (application/senml-exi)

For efficient transmission of SenML over, e.g., a constrained network, EXI can be used. This encodes the XML Schema [W3C.REC-xmlschema-1-20041028] structure of SenML into binary tags and values rather than ASCII text. An EXI representation of SenML SHOULD be made using the strict schema mode of EXI. However, this mode does not allow tag extensions to the schema; therefore, any extensions will be lost in the encoding. For uses where extensions need to be preserved in EXI, the non-strict schema mode of EXI MAY be used. The EXI header MUST include "EXI Options", as defined in [W3C.REC-exi-20140211], with a schemaId set to the value of "a", indicating the schema provided in this specification. Future revisions to the schema can change the value of the schemaId to allow for backwards compatibility. When the data will be transported over CoAP or HTTP, an EXI Cookie SHOULD NOT be used as it simply makes things larger and is redundant to information provided in the Content-Type header.
Top   ToC   RFC8428 - Page 24
   The following is the XSD Schema to be used for strict schema-guided
   EXI processing.  It is generated from the RelaxNG.

   <?xml version="1.0" encoding="utf-8"?>
   <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
   elementFormDefault="qualified"
   targetNamespace="urn:ietf:params:xml:ns:senml"
   xmlns:ns1="urn:ietf:params:xml:ns:senml">
     <xs:element name="senml">
       <xs:complexType>
         <xs:attribute name="bn" type="xs:string" />
         <xs:attribute name="bt" type="xs:double" />
         <xs:attribute name="bv" type="xs:double" />
         <xs:attribute name="bs" type="xs:double" />
         <xs:attribute name="bu" type="xs:string" />
         <xs:attribute name="bver" type="xs:int" />
         <xs:attribute name="n" type="xs:string" />
         <xs:attribute name="s" type="xs:double" />
         <xs:attribute name="t" type="xs:double" />
         <xs:attribute name="u" type="xs:string" />
         <xs:attribute name="ut" type="xs:double" />
         <xs:attribute name="v" type="xs:double" />
         <xs:attribute name="vb" type="xs:boolean" />
         <xs:attribute name="vs" type="xs:string" />
         <xs:attribute name="vd" type="xs:string" />
       </xs:complexType>
     </xs:element>
     <xs:element name="sensml">
       <xs:complexType>
         <xs:sequence>
           <xs:element maxOccurs="unbounded" ref="ns1:senml" />
         </xs:sequence>
       </xs:complexType>
     </xs:element>
   </xs:schema>

   The following shows a hexdump of the EXI produced from encoding the
   following XML example.  Note that this example is the same
   information as the first example in Section 5.1.2 but in JSON format.

   <sensml xmlns="urn:ietf:params:xml:ns:senml">
     <senml bn="urn:dev:ow:10e2073a01080063:" n="voltage" u="V"
     v="120.1"></senml>
     <senml n="current" u="A" v="1.2"></senml>
   </sensml>
Top   ToC   RFC8428 - Page 25
   Which compresses with EXI to the following displayed in hexdump:

 0000 a0 30 0d 84 80 f3 ab 93 71 d3 23 2b b1 d3 7b b9 |.0......q.#+..{.|
 0010 d1 89 83 29 91 81 b9 9b 09 81 89 81 c1 81 81 b1 |...)............|
 0020 99 d2 84 bb 37 b6 3a 30 b3 b2 90 1a b1 58 84 c0 |....7.:0.....X..|
 0030 33 04 b1 ba b9 39 32 b7 3a 10 1a 09 06 40 38    |3....92.:....@8|
 003f

   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 make it easier
   for a simple sensor to produce valid EXI without really implementing
   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
   would produce an XML SenML file such as:

   <sensml xmlns="urn:ietf:params:xml:ns:senml">
     <senml n="urn:dev:ow:10e2073a01080063" u="Cel" v="23.1"></senml>
   </sensml>

   The compressed form, using the byte-alignment option of EXI, for the
   above XML is the following:

 0000 a0 00 48 80 6c 20 01 06 1d 75 72 6e 3a 64 65 76 |..H.l ...urn:dev|
 0010 3a 6f 77 3a 31 30 65 32 30 37 33 61 30 31 30 38 |:ow:10e2073a0108|
 0020 30 30 36 33 02 05 43 65 6c 01 00 e7 01 01 00 03 |0063..Cel.......|
 0030 01                                              |.|
 0031

   A small temperature sensor device that only generates this one EXI
   file does not really need a full EXI implementation.  It can simply
   hard code the output, replacing the 1-wire device ID starting at byte
   0x14 and going to byte 0x23 with its device ID and replacing the
   value "0xe7 0x01" at location 0x2b and 0x2c with the current
   temperature.  The EXI specification [W3C.REC-exi-20140211] contains
   the full information on how floating-point numbers are represented,
   but for the purpose of this sensor, the temperature can be converted
   to an integer in tenths of degrees (231 in this example).  EXI stores
   7 bits of the integer in each byte with the top bit set to one if
   there are further bytes.  So, the first byte is set to the low 7 bits
   of the integer temperature in tenths of degrees plus 0x80.  In this
   example, 231 & 0x7F + 0x80 = 0xE7.  The second byte is set to the
   integer temperature in tenths of degrees right-shifted 7 bits.  In
   this example, 231 >> 7 = 0x01.
Top   ToC   RFC8428 - Page 26

9. Fragment Identification Methods

A SenML Pack typically consists of multiple SenML Records, and for some applications, it may be useful to be able to refer to a single Record, or a set of Records, in a Pack with a fragment identifier. The fragment identifier is only interpreted by a client and does not impact retrieval of a representation. The SenML fragment identification is modeled after Comma-Separated Value (CSV) fragment identifiers [RFC7111]. To select a single SenML Record, the "rec" scheme followed by a single number is used. For the purpose of numbering Records, the first Record is at position 1. A range of records can be selected by giving the first and the last record number separated by a "-" character. Instead of the second number, the "*" character can be used to indicate the last SenML Record in the Pack. A set of Records can also be selected using a comma-separated list of Record positions or ranges. (We use the term "selecting a Record" for identifying it as part of the fragment, not in the sense of isolating it from the Pack -- the Record still needs to be interpreted as part of the Pack, e.g., using the base values defined in earlier Records.)

9.1. Fragment Identification Examples

The 3rd SenML Record from the "coap://example.com/temp" resource can be selected with: coap://example.com/temp#rec=3 Records from 3rd to 6th can be selected with: coap://example.com/temp#rec=3-6 Records from 19th to the last can be selected with: coap://example.com/temp#rec=19-* The 3rd and 5th Records can be selected with: coap://example.com/temp#rec=3,5 To select the Records from third to fifth, the 10th Record, and all Records from 19th to the last: coap://example.com/temp#rec=3-5,10,19-*
Top   ToC   RFC8428 - Page 27

9.2. Fragment Identification for XML and EXI Formats

In addition to the SenML fragment identifiers described above, with the XML and EXI SenML formats, the syntax defined in the XPointer element() Scheme [XPointerElement] of the XPointer Framework [XPointerFramework] can be used. (This is required by [RFC7303] for media types using the syntax suffix structured with "+xml". For consistency, SenML allows this for the EXI formats as well.) Note that fragment identifiers are available to the client side only; they are not provided in transfer protocols such as CoAP or HTTP. Thus, they cannot be used by the server in deciding which media type to send. Where a server has multiple representations available for a resource identified by a URI, it might send a JSON or CBOR representation when the client was directed to use an XML/EXI fragment identifier with it. Clients can prevent running into this problem by explicitly requesting an XML or EXI media type (e.g., using the CoAP Accept option) when XML-/EXI-only fragment identifier syntax is in use in the URI.

10. Usage Considerations

The measurements support sending both the current value of a sensor as well as an integrated sum. For many types of measurements, the sum is more useful than the current value. For historical reasons, this field is called "Sum" instead of "integral", which would more accurately describe its function. For example, an electrical meter that measures the energy a given computer uses will typically want to measure the cumulative amount of energy used. This is less prone to error than reporting the power each second and trying to have something on the server side sum together all the power measurements. If the network between the sensor and the meter goes down over some period of time, when it comes back up, the cumulative sum helps reflect what happened while the network was down. A meter like this would typically report a measurement with the unit set to watts, but it would put the sum of energy used in the "s" field of the measurement. It might optionally include the current power in the "v" field. While the benefit of using the integrated sum is fairly clear for measurements like power and energy, it is less obvious for something like temperature. Reporting the sum of the temperature makes it easy to compute averages even when the individual temperature values are not reported frequently enough to compute accurate averages. Implementers are encouraged to report the cumulative sum as well as the raw value of a given sensor.
Top   ToC   RFC8428 - Page 28
   Applications that use the cumulative Sum values need to understand
   they are very loosely defined by this specification, and depending on
   the particular sensor implementation, they may behave in unexpected
   ways.  Applications should be able to deal with the following issues:

   1.  Many sensors will allow the cumulative sums to "wrap" back to
       zero after the value gets sufficiently large.

   2.  Some sensors will reset the cumulative sum back to zero when the
       device is reset, loses power, or is replaced with a different
       sensor.

   3.  Applications cannot make assumptions about when the device
       started accumulating values into the sum.

   Typically, applications can make some assumptions about specific
   sensors that will allow them to deal with these problems.  A common
   assumption is that for sensors whose measurement values are non-
   negative, the sum should never get smaller; if the sum does get
   smaller, the application will know that one of the situations listed
   above has happened.

   Despite the name "Sum", the Sum field is not useful for applications
   that maintain a running count of the number of times an event
   happened or that keep track of a counter such as the total number of
   bytes sent on an interface.  Data like that can be sent directly in
   the Value field.
Top   ToC   RFC8428 - Page 29

11. CDDL

As a convenient reference, the JSON and CBOR representations can be described with the common Concise Data Definition Language (CDDL) specification [CDDL-CBOR] in Figure 1 (informative). SenML-Pack = [1* record] record = { ? bn => tstr, ; Base Name ? bt => numeric, ; Base Time ? bu => tstr, ; Base Units ? bv => numeric, ; Base Value ? bs => numeric, ; Base Sum ? bver => uint, ; Base Version ? n => tstr, ; Name ? u => tstr, ; Units ? s => numeric, ; Sum ? t => numeric, ; Time ? ut => numeric, ; Update Time ? ( v => numeric // ; Numeric Value vs => tstr // ; String Value vb => bool // ; Boolean Value vd => binary-value ) ; Data Value * key-value-pair } ; now define the generic versions key-value-pair = ( label => value ) label = non-b-label / b-label non-b-label = tstr .regexp "[A-Zac-z0-9][-_:.A-Za-z0-9]*" / uint b-label = tstr .regexp "b[-_:.A-Za-z0-9]+" / nint value = tstr / binary-value / numeric / bool numeric = number / decfrac Figure 1: Common CDDL Specification for CBOR and JSON SenML
Top   ToC   RFC8428 - Page 30
   For JSON, we use text labels and base64url-encoded binary data
   (Figure 2).

   bver = "bver" n  = "n"   s  = "s"
   bn  = "bn"    u  = "u"   t  = "t"
   bt  = "bt"    v  = "v"   ut = "ut"
   bu  = "bu"    vs = "vs"  vd = "vd"
   bv  = "bv"    vb = "vb"
   bs  = "bs"

   binary-value = tstr             ; base64url encoded

           Figure 2: JSON-Specific CDDL Specification for SenML

   For CBOR, we use integer labels and native binary data (Figure 3).

   bver = -1  n  = 0   s  = 5
   bn  = -2   u  = 1   t  = 6
   bt  = -3   v  = 2   ut = 7
   bu  = -4   vs = 3   vd = 8
   bv  = -5   vb = 4
   bs  = -6

   binary-value = bstr

           Figure 3: CBOR-Specific CDDL Specification for SenML

12. IANA Considerations

IANA has created a new "Sensor Measurement Lists (SenML)" registry that contains the subregistries defined in Sections 12.1 and 12.2.

12.1. SenML Units Registry

IANA has created a registry of SenML unit symbols called the "SenML Units" registry. The primary purpose of this registry is to make sure that symbols uniquely map to indicate a type of measurement. Definitions for many of these units can be found in other publications such as [NIST811] and [BIPM]. Units marked with an asterisk are NOT RECOMMENDED to be produced by new implementations but are in active use and SHOULD be implemented by consumers that can use the corresponding SenML units that are closer to the unscaled SI units.
Top   ToC   RFC8428 - Page 31
   +----------+------------------------------------+-------+-----------+
   |   Symbol | Description                        | Type  | Reference |
   +----------+------------------------------------+-------+-----------+
   |        m | meter                              | float | RFC 8428  |
   |       kg | kilogram                           | float | RFC 8428  |
   |        g | gram*                              | float | RFC 8428  |
   |        s | second                             | float | RFC 8428  |
   |        A | ampere                             | float | RFC 8428  |
   |        K | kelvin                             | float | RFC 8428  |
   |       cd | candela                            | float | RFC 8428  |
   |      mol | mole                               | float | RFC 8428  |
   |       Hz | hertz                              | float | RFC 8428  |
   |      rad | radian                             | float | RFC 8428  |
   |       sr | steradian                          | float | RFC 8428  |
   |        N | newton                             | float | RFC 8428  |
   |       Pa | pascal                             | float | RFC 8428  |
   |        J | joule                              | float | RFC 8428  |
   |        W | watt                               | float | RFC 8428  |
   |        C | coulomb                            | float | RFC 8428  |
   |        V | volt                               | float | RFC 8428  |
   |        F | farad                              | float | RFC 8428  |
   |      Ohm | ohm                                | float | RFC 8428  |
   |        S | siemens                            | float | RFC 8428  |
   |       Wb | weber                              | float | RFC 8428  |
   |        T | tesla                              | float | RFC 8428  |
   |        H | henry                              | float | RFC 8428  |
   |      Cel | degrees Celsius                    | float | RFC 8428  |
   |       lm | lumen                              | float | RFC 8428  |
   |       lx | lux                                | float | RFC 8428  |
   |       Bq | becquerel                          | float | RFC 8428  |
   |       Gy | gray                               | float | RFC 8428  |
   |       Sv | sievert                            | float | RFC 8428  |
   |      kat | katal                              | float | RFC 8428  |
   |       m2 | square meter (area)                | float | RFC 8428  |
   |       m3 | cubic meter (volume)               | float | RFC 8428  |
   |        l | liter (volume)*                    | float | RFC 8428  |
   |      m/s | meter per second (velocity)        | float | RFC 8428  |
   |     m/s2 | meter per square second            | float | RFC 8428  |
   |          | (acceleration)                     |       |           |
   |     m3/s | cubic meter per second (flow rate) | float | RFC 8428  |
   |      l/s | liter per second (flow rate)*      | float | RFC 8428  |
   |     W/m2 | watt per square meter (irradiance) | float | RFC 8428  |
   |    cd/m2 | candela per square meter           | float | RFC 8428  |
   |          | (luminance)                        |       |           |
   |      bit | bit (information content)          | float | RFC 8428  |
   |    bit/s | bit per second (data rate)         | float | RFC 8428  |
   |      lat | degrees latitude (Note 1)          | float | RFC 8428  |
   |      lon | degrees longitude (Note 1)         | float | RFC 8428  |
Top   ToC   RFC8428 - Page 32
   |       pH | pH value (acidity; logarithmic     | float | RFC 8428  |
   |          | quantity)                          |       |           |
   |       dB | decibel (logarithmic quantity)     | float | RFC 8428  |
   |      dBW | decibel relative to 1 W (power     | float | RFC 8428  |
   |          | level)                             |       |           |
   |     Bspl | bel (sound pressure level;         | float | RFC 8428  |
   |          | logarithmic quantity)*             |       |           |
   |    count | 1 (counter value)                  | float | RFC 8428  |
   |        / | 1 (ratio, e.g., value of a switch; | float | RFC 8428  |
   |          | Note 2)                            |       |           |
   |        % | 1 (ratio, e.g., value of a switch; | float | RFC 8428  |
   |          | Note 2)*                           |       |           |
   |      %RH | percentage (relative humidity)     | float | RFC 8428  |
   |      %EL | percentage (remaining battery      | float | RFC 8428  |
   |          | energy level)                      |       |           |
   |       EL | seconds (remaining battery energy  | float | RFC 8428  |
   |          | level)                             |       |           |
   |      1/s | 1 per second (event rate)          | float | RFC 8428  |
   |    1/min | 1 per minute (event rate, "rpm")*  | float | RFC 8428  |
   | beat/min | 1 per minute (heart rate in beats  | float | RFC 8428  |
   |          | per minute)*                       |       |           |
   |    beats | 1 (cumulative number of heart      | float | RFC 8428  |
   |          | beats)*                            |       |           |
   |      S/m | siemens per meter (conductivity)   | float | RFC 8428  |
   +----------+------------------------------------+-------+-----------+

                  Table 6: IANA Registry for SenML Units

   o  Note 1: Assumed to be in World Geodetic System 1984 (WGS84),
      unless another reference frame is known for the sensor.

   o  Note 2: A value of 0.0 indicates the switch is off, 1.0 indicates
      on, and 0.5 indicates half on.  The preferred name of this unit is
      "/".  For historical reasons, the name "%" is also provided for
      the same unit, but note that while that name strongly suggests a
      percentage (0..100), it is NOT a percentage but the absolute
      ratio!
Top   ToC   RFC8428 - Page 33
   New entries can be added to the registration by Expert Review as
   defined in [RFC8126].  Experts should exercise their own good
   judgment but need to consider the following guidelines:

   1.   There needs to be a real and compelling use for any new unit to
        be added.

   2.   Each unit should define the semantic information and be chosen
        carefully.  Implementers need to remember that the same word may
        be used in different real-life contexts.  For example, degrees
        when measuring latitude have no semantic relation to degrees
        when measuring temperature; thus, two different units are
        needed.

   3.   These measurements are produced by computers for consumption by
        computers.  The principle is that conversion has to be easily
        done when both reading and writing the media type.  The value of
        a single canonical representation outweighs the convenience of
        easy human representations or loss of precision in a conversion.

   4.   Use of System of Units (SI) prefixes such as "k" before the unit
        is not recommended.  Instead, one can represent the value using
        scientific notation such as 1.2e3.  The "kg" unit is an
        exception to this rule since it is an SI base unit; the "g" unit
        is provided for legacy compatibility.

   5.   For a given type of measurement, there will only be one unit
        type defined.  So for length, meter is defined, and other
        lengths such as mile, foot, and light year are not allowed.  For
        most cases, the SI unit is preferred.

        (Note that some amount of judgment will be required here, as
        even SI itself is not entirely consistent in this respect.  For
        instance, for temperature, [ISO-80000-5] defines a quantity,
        item 5-1 (thermodynamic temperature), and a corresponding unit
        of 5-1.a (Kelvin); [ISO-80000-5] goes on to define another
        quantity, item 5-2 ("Celsius temperature"), and the
        corresponding unit of 5-2.a (degree Celsius).  The latter
        quantity is defined such that it gives the thermodynamic
        temperature as a delta from T0 = 275.15 K.  ISO 80000-5 is
        defining both units side by side and not really expressing a
        preference.  This level of recognition of the alternative unit
        degree Celsius is the reason why Celsius temperatures seem
        exceptionally acceptable in the SenML units list alongside
        Kelvin.)
Top   ToC   RFC8428 - Page 34
   6.   Symbol names that could be easily confused with existing common
        units or units combined with prefixes should be avoided.  For
        example, selecting a unit name of "mph" to indicate something
        that had nothing to do with velocity would be a bad choice, as
        "mph" is commonly used to mean "miles per hour".

   7.   The following should not be used because they are common SI
        prefixes: Y, Z, E, P, T, G, M, k, h, da, d, c, u, n, p, f, a, z,
        y, Ki, Mi, Gi, Ti, Pi, Ei, Zi, and Yi.

   8.   The following units should not be used as they are commonly used
        to represent other measurements: Ky, Gal, dyn, etg, P, St, Mx,
        G, Oe, Gb, sb, Lmb, mph, Ci, R, RAD, REM, gal, bbl, qt, degF,
        Cal, BTU, HP, pH, B/s, psi, Torr, atm, at, bar, and kWh.

   9.   The unit names are case sensitive, and the correct case needs to
        be used; however, symbols that differ only in case should not be
        allocated.

   10.  A number after a unit typically indicates the previous unit
        raised to that power, and "/" indicates that the units that
        follow are the reciprocals.  A unit should have only one "/" in
        the name.

   11.  A good list of common units can be found in the Unified Code for
        Units of Measure [UCUM].
Top   ToC   RFC8428 - Page 35

12.2. SenML Labels Registry

IANA has created a new registry for SenML Labels called the "SenML Labels" registry. The initial contents of the registry are as follows: +--------------+-------+----+-----------+----------+----+-----------+ | Name | Label | CL | JSON Type | XML Type | EI | Reference | +--------------+-------+----+-----------+----------+----+-----------+ | Base Name | bn | -2 | String | string | a | RFC 8428 | | Base Time | bt | -3 | Number | double | a | RFC 8428 | | Base Unit | bu | -4 | String | string | a | RFC 8428 | | Base Value | bv | -5 | Number | double | a | RFC 8428 | | Base Sum | bs | -6 | Number | double | a | RFC 8428 | | Base Version | bver | -1 | Number | int | a | RFC 8428 | | Name | n | 0 | String | string | a | RFC 8428 | | Unit | u | 1 | String | string | a | RFC 8428 | | Value | v | 2 | Number | double | a | RFC 8428 | | String Value | vs | 3 | String | string | a | RFC 8428 | | Boolean | vb | 4 | Boolean | boolean | a | RFC 8428 | | Value | | | | | | | | Data Value | vd | 8 | String | string | a | RFC 8428 | | Sum | s | 5 | Number | double | a | RFC 8428 | | Time | t | 6 | Number | double | a | RFC 8428 | | Update Time | ut | 7 | Number | double | a | RFC 8428 | +--------------+-------+----+-----------+----------+----+-----------+ Note that CL = CBOR Label and EI = EXI ID. Table 7: IANA Registry for SenML Labels This is the same table as Table 1, with notes removed and columns added for the information that is all the same for this initial set of registrations, but it will need to be supplied with different values for new registrations. All new entries must define the Name, Label, and XML Type, but the CBOR labels SHOULD be left empty as CBOR will use the string encoding for any new labels. The EI column contains the EXI schemaId value of the first schema that includes this label, or it is empty if this label was not intended for use with EXI. The Reference column SHOULD contain information about where to find out more information about this label. The JSON, CBOR, and EXI types are derived from the XML type. All XML numeric types such as double, float, integer, and int become a JSON Number. XML boolean and string become a JSON Boolean and String,
Top   ToC   RFC8428 - Page 36
   respectively.  CBOR represents numeric values with a CBOR type that
   does not lose any information from the JSON value.  EXI uses the XML
   types.

   New entries can be added to the registration by Expert Review as
   defined in [RFC8126].  Experts should exercise their own good
   judgment but need to consider that shorter labels should have more
   strict review.  New entries should not be made that counteract the
   advice at the end of Section 4.5.4.

   All new SenML Labels that have "base" semantics (see Section 4.1)
   MUST start with the character "b".  Regular labels MUST NOT start
   with that character.  All new SenML Labels with Value semantics (see
   Section 4.2) MUST have "Value" in their (long-form) name.

   Extensions that add a label intended for use with XML need to create
   a new RelaxNG Schema that includes all the labels in the "SenML
   Labels" registry.

   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 "SenML
   Labels" registry and then allocate a new EXI schemaId value.  Moving
   to the next letter in the alphabet is the suggested way to create the
   new value for the EXI schemaId.  Any labels with previously blank ID
   values SHOULD be updated in the "SenML Labels" registry to have their
   ID set to this new schemaId value.

   Extensions that are mandatory to understand to correctly process the
   Pack MUST have a label name that ends with the "_" character.



(page 36 continued on part 3)

Next Section