From 853d4c9d1fbe9ddddb724c0a252885b4d4b97e0d Mon Sep 17 00:00:00 2001 From: Ernst Klamer Date: Tue, 7 Nov 2023 20:54:22 +0100 Subject: [PATCH] feat(raw sensor (#44) --- src/format.html | 20 ++++++++++---------- src/v1.html | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/src/format.html b/src/format.html index a192fe5..f6baf23 100644 --- a/src/format.html +++ b/src/format.html @@ -663,9 +663,9 @@

Sensor data

see below - - 540C48656c6c6f20576f726c6421 + 540C48656C6C6F20576F726C6421 - "48656c6c6f20576f726c6421" + 48656c6c6f20576f726c6421 @@ -740,7 +740,7 @@

Sensor data

530C48656C6C6F20576F726C6421 - "Hello World!" + Hello World! @@ -910,15 +910,15 @@
Timestamp
datetime(2023, 5, 14, 19, 41, 17, tzinfo=timezone.utc)

-
Text and Ras sensors
+
Text and Raw sensors

- The Text and Raw sensors have a variable length. You therefore have to specify - the length in the first byte after the `object id`. In the text sensor example + The text and raw sensor have a variable length. You therefore have to specify + the length in the first byte after the `object id`. In the example of the text sensor 0x530C48656C6C6F20576F726C6421, the 2nd byte (0x0C) - gives the length of the text string (12 bytes). The text has to be encoded in - UTF-8. The byte string 0x48656C6C6F20576F726C6421 in text is - Hello World!. In Raw format 0x54, the bytes are - reported in hex format, as 48656C6C6F20576F726C6421. + gives the length of the text string (12 bytes). Text has to be encoded in + UTF-8, while the raw sensor is reported back as hexadecimal string. The byte string + 0x48656C6C6F20576F726C6421 in text is Hello World!, while + in raw sensor will give 48656c6c6f20576f726c6421 as result. Make sure the length is specified correct in the second byte.

diff --git a/src/v1.html b/src/v1.html index b263706..d22dbac 100644 --- a/src/v1.html +++ b/src/v1.html @@ -587,6 +587,36 @@

Sensor data

°/s + + + 0x53 + + text + see below + - + + 0D5348656C6C6F20576F726C6421 + + Hello World! + + + + + + + 0x54 + + raw + see below + - + + 0D5448656C6C6F20576F726C6421 + + 48656c6c6f20576f726c6421 + + + + @@ -601,6 +631,13 @@
Timestamp
19:41:17. The corresponding datetime object that is returned is: datetime(2023, 5, 14, 19, 41, 17, tzinfo=timezone.utc)

+
Text and Raw sensors
+

+ Text has to be encoded in UTF-8, while the raw sensor is reported back as + hexadecimal string. The byte string 0x48656C6C6F20576F726C6421 + in text is Hello World!, while in raw sensor will give + 48656c6c6f20576f726c6421 as result. +

Multiple measurements of the same type

If you want to send multiple measurements of the same type, e.g. three