Skip to content

Commit 3bd3b29

Browse files
authored
docs(ep-235): Update document structure
1 parent 8a874a0 commit 3bd3b29

File tree

1 file changed

+59
-4
lines changed

1 file changed

+59
-4
lines changed

doc/ep/235-daq-data-package.rst

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,69 @@
22
EP-235: DAQ data package
33
===========================================
44

5+
.. sectnum::
6+
:suffix: .
7+
58
.. image:: https://img.shields.io/badge/Status-Draft-blue
69

710
.. image:: https://img.shields.io/badge/plumCore-0.8.0--dev-gray?labelColor=purple
811

912

13+
.. contents::
14+
15+
16+
Introduction
17+
=====================
18+
19+
As the plumCore framework continues to develop into a generic DAQ platform, managing data processing,
20+
transmission, and storage is becoming increasingly challenging. To address this, it would be beneficial
21+
for the platform to adopt a universal, generic storage format that can be used across various media, including:
22+
23+
- FIFO buffers in RAM for short-term storage
24+
- FIFO buffers in flash for long-term, power outage-resistant storage
25+
- Message queue-like transports such as MQTT and CoAP
26+
- Long-term archiving solutions
27+
28+
This storage format should be capable of containing the following information:
29+
30+
- A single sensor value or a time series (measurement)
31+
- The time at which the measurement was taken, along with relevant time metadata (e.g., clock precision, clock type)
32+
- Metadata related to the sensor value or time series (e.g., uncertainty, conditions)
33+
- Sampling strategy details (e.g., arbitrary intervals, equal intervals)
34+
- Calibration data used during sample processing
35+
- Optionally, the raw sensor value
36+
- Identification of the data source
37+
- Electronic signature and, optionally, encryption
1038

11-
TBD introduction
39+
Having a common storage format would simplify data management and facilitate seamless data exchange
40+
across different media and applications.
41+
42+
Key-word usage
43+
--------------------
44+
45+
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
46+
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
47+
"OPTIONAL" in this document are to be interpreted as described in
48+
BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all
49+
capitals, as shown here.
50+
51+
License
52+
---------------
53+
54+
This work is licensed under CC BY-SA 4.0. To view a copy of this license, visit https://creativecommons.org/licenses/by-sa/4.0/
55+
56+
© 2025 Marek Koza <qyx@krtko.org>
1257

1358

1459
The data format
1560
=====================
1661

17-
Top level format structure is a CBOR map with indefinite length with a ``PPKG = 1`` key/value
18-
pair at the beginning. ``PPKG`` is an abbreviation for *plumCore package*, ``1`` is the current
19-
format version. This results in the following encoding:
62+
Package, the top-level data structure
63+
-----------------------------------------
64+
65+
Top level data structure is a CBOR map with indefinite length with a ``PPKG = 1`` key/value
66+
pair at the beginning. It is called a *package*. ``PPKG`` is an abbreviation for *plumCore package*,
67+
``1`` is the current format version. This results in the following encoding:
2068

2169
.. code-block:: python
2270
@@ -48,3 +96,10 @@ In case a ``COSE`` signature is used, the header changes:
4896
# COSE signature goes here
4997
0xff # End of map
5098
99+
100+
Using an indefinite length CBOR map to encode a package has an interesting property.
101+
Since it uses the ``0xff`` byte to finish the map, we may freely append more than one
102+
package one after the other in a common flash memory media which contains
103+
``0xff`` bytes when erased. However, beginning of a package needs to be aligned to
104+
a 8 byte boundary in the media region (RAM region, file, flash media partition).
105+
The padding between the successive packages SHALL be filled with ``0xff`` bytes.

0 commit comments

Comments
 (0)