CoRE Working Group C. Groves Internet-Draft Intended status: Standards Track W. Yang Expires: October 21, 2017 Huawei April 19, 2017 SenML Base Time Offset Attribute draft-groves-core-senml-bto-01 Abstract SenML [I-D.ietf-core-senml] defines a base time attribute and time value which is used to determine the time when a value is recorded. In some applications a SenML pack will contain a series of records related to a constant sample time interval, e.g. once every 60 seconds. This means that the time attribute will be required for each record. This document defines a new "time offset" base attribute that allows a sender to include the time for the sample interval between records. If the "time offset" base attribute is used the sender will not send the time attribute for each record, minimising message and storage size. Status of This Memo This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at http://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." This Internet-Draft will expire on October 21, 2017. Copyright Notice Copyright (c) 2017 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of Groves & Yang Expires October 21, 2017 [Page 1] Internet-Draft SenML BTO April 2017 publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 3. SenML Structure and Semantics . . . . . . . . . . . . . . . . 4 3.1. Base Attributes . . . . . . . . . . . . . . . . . . . . . 4 3.2. Regular Attributes . . . . . . . . . . . . . . . . . . . 4 3.3. Considerations . . . . . . . . . . . . . . . . . . . . . 4 4. JSON Representation (application/senml+json) . . . . . . . . 5 5. CBOR Representation (application/senml+cbor) . . . . . . . . 5 6. XML representation (application/senml+xml) . . . . . . . . . 5 7. EXI Representation (application/senml-exi) . . . . . . . . . 6 8. Security Considerations . . . . . . . . . . . . . . . . . . . 7 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 7 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 8 11. Changelog . . . . . . . . . . . . . . . . . . . . . . . . . . 8 12. Normative References . . . . . . . . . . . . . . . . . . . . 8 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 8 1. Introduction SenML currently defines the base time "bt" and time "t" attributes to indicate the time that each value in a SenML record is recorded. This means that for each record (value "v") that a "t" attribute is required. The example from section 5.1.2/[I-D.ietf-core-senml] is copied below to illustrate a SenML pack with multiple records. Groves & Yang Expires October 21, 2017 [Page 2] Internet-Draft SenML BTO April 2017 [ {"bn": "urn:dev:ow:10e2073a01080063", "bt": 1320067464, "bu": "%RH", "v": 21.2, "t": 0 }, { "v": 21.3, "t": 10 }, { "v": 21.4, "t": 20 }, { "v": 21.4, "t": 30 }, { "v": 21.5, "t": 40 }, { "v": 21.5, "t": 50 }, { "v": 21.5, "t": 60 }, { "v": 21.6, "t": 70 }, { "v": 21.7, "t": 80 }, { "v": 21.5, "t": 90 }, ... Figure 1: SenML pack with multiple records As can be seen in the example above there is a fixed offset between the data points of 10 seconds. This document proposes a base time offset "bto" attribute that is used to indicate the offset between datapoints when a fixed offset is used. This negates the need to include the "t" attribute for each data point. The example below takes the above example and applies the base time offset to it. [ {"bn": "urn:dev:ow:10e2073a01080063", "bt": 1320067464, "bto": 10, "bu": "%RH", "v": 21.2}, { "v": 21.3}, { "v": 21.4}, { "v": 21.4}, { "v": 21.5}, { "v": 21.5}, { "v": 21.5}, { "v": 21.6}, { "v": 21.7}, { "v": 21.5}, ... Figure 2: SenML pack with multiple records using base time offset It can be seen that it results in a record and overall pack size reduction. The receiver of the record would use the base time "bt" for the initial data point, e.g. "v": 21.2 would have a timestamp of Groves & Yang Expires October 21, 2017 [Page 3] Internet-Draft SenML BTO April 2017 1320067464. Each subsequent record would have a time stamp equal to the previous record plus the base time offset "bto", e.g. "v": 21.3 would have a timestamp of 1320067474, "v": 21.4 would have a timestamp of 1320067484, and so on. 2. Terminology The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119]. See [I-D.ietf-core-senml] for further definitions. 3. SenML Structure and Semantics 3.1. Base Attributes This document adds an additional "base time offset" attribute. Base Time Offset: The base time offset represents a fixed time offset between each record in a SenML pack. The first record represents time zero (or the base time if provided) and the offset is then applied to each subsequent record. Either a positive or negative base time offset is allowed. 3.2. Regular Attributes This document modifies the behaviour of the time attribute. Time: If the base time offset attribute is used in a SenML pack then the time attribute shall not be used in the individual records. _Editor's note: One theoretical use case may be to include the time attribute if the entry's time deviates from the regular offset. It is not seen that such a corner case warrants the extra complexity._ 3.3. Considerations To simplify implementation, the use of base time offset is limited to: o Fixed time increasing or decreasing records from the time stamp associated with the first record in the SenML pack. This means that usages such as described by the 2nd example in 5.1.2/[I-D.ietf-core-senml] where negative time offset from time zero being provided by the last record in a SenML pack are not possible. Groves & Yang Expires October 21, 2017 [Page 4] Internet-Draft SenML BTO April 2017 _Editor's note: It could be possible to facilitate this use case by allowing a t=0 to be set on the last record with the use of a negative base time offset value. However again it's not seen that such a corner case warrants the extra complexity in having to store values and calculate offsets at the end of transmission/reception._ o It is not possible to for two records in the SenML pack to have the same time. For example the inclusion of a record for a voltage measurement followed by a current measurement would result in the records having times with a difference of the time offset. 4. JSON Representation (application/senml+json) This document defines an additional SenML label (JSON object member name) as shown in Table 1 below. +------------------+-------+-------+ | Name | label | Type | +------------------+-------+-------+ | Base Time Offset | bto | Numer | +------------------+-------+-------+ Table 1: JSON SenML Labels 5. CBOR Representation (application/senml+cbor) As per section 6/[I-D.ietf-core-senml], for CBOR the string map key "bto" shall be used to indicate the use of the base time offset. 6. XML representation (application/senml+xml) This document defines an addition XML attribute as shown in Table 2 below. +------------------+-----+--------+ | Name | XML | Type | +------------------+-----+--------+ | Base Time Offset | bto | double | +------------------+-----+--------+ Table 2: XML SenML Labels The RelaxNG schema for the XML is: Groves & Yang Expires October 21, 2017 [Page 5] Internet-Draft SenML BTO April 2017 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 bto { xsd:double }?, attribute l { xsd:string }?, 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 }? } sensml = element sensml { senml+ } start = sensml 7. EXI Representation (application/senml-exi) As per clause 8/[I-D.ietf-core-senml] extensions are indicated through the use of an EXI schemaID options. The EXI schemaID options MUST be set to the value of "b" indicating the scheme provided in this specification. The following is the XSD Schema to be used for strict schema guided EXI processing. Groves & Yang Expires October 21, 2017 [Page 6] Internet-Draft SenML BTO April 2017 8. Security Considerations No extra security issues are seen beyond those described in [I-D.ietf-core-senml]. 9. IANA Considerations This document proposes one new entry in the IANA SenML label reegistry. Label Name: Base Time Offset Label: bto Groves & Yang Expires October 21, 2017 [Page 7] Internet-Draft SenML BTO April 2017 CBOR: - XML Type: Double ID: b Reference: This specification. 10. Acknowledgements TBD 11. Changelog draft-groves-core-senml-bto-01 o General: Changed "SenML Package" to "SenML Pack" 12. Normative References [I-D.ietf-core-senml] Jennings, C., Shelby, Z., Arkko, J., Keranen, A., and C. Bormann, "Media Types for Sensor Measurement Lists (SenML)", draft-ietf-core-senml-05 (work in progress), March 2017. [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, . Authors' Addresses Christian Groves Australia Email: cngroves.std@gmail.com Weiwei Yang Huawei P.R.China Email: tommy@huawei.com Groves & Yang Expires October 21, 2017 [Page 8]