Skip to content

Commit

Permalink
feat(raw sensor (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ernst79 authored Nov 7, 2023
1 parent c116ca7 commit 853d4c9
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/format.html
Original file line number Diff line number Diff line change
Expand Up @@ -663,9 +663,9 @@ <h4 id="sensor-data">Sensor data</h4>
<td>see below</td>
<td>-</td>
<td>
<code>540C48656c6c6f20576f726c6421</code>
<code>540C48656C6C6F20576F726C6421</code>
</td>
<td>"48656c6c6f20576f726c6421"</td>
<td>48656c6c6f20576f726c6421</td>
<td>
<code></code>
</td>
Expand Down Expand Up @@ -740,7 +740,7 @@ <h4 id="sensor-data">Sensor data</h4>
<td>
<code>530C48656C6C6F20576F726C6421</code>
</td>
<td>"Hello World!"</td>
<td>Hello World!</td>
<td>
<code></code>
</td>
Expand Down Expand Up @@ -910,15 +910,15 @@ <h5 id="timestamp">Timestamp</h5>
<code>datetime(2023, 5, 14, 19, 41, 17, tzinfo=timezone.utc)</code>
</p>

<h5 id="text">Text and Ras sensors</h5>
<h5 id="text and raw">Text and Raw sensors</h5>
<p>
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
<code>0x530C48656C6C6F20576F726C6421</code>, the 2nd byte (<code>0x0C</code>)
gives the length of the text string (12 bytes). The text has to be encoded in
UTF-8. The byte string <code>0x48656C6C6F20576F726C6421</code> in text is
<code>Hello World!</code>. In Raw format <code>0x54</code>, the bytes are
reported in hex format, as <code>48656C6C6F20576F726C6421</code>.
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
<code>0x48656C6C6F20576F726C6421</code> in text is <code>Hello World!</code>, while
in raw sensor will give <code>48656c6c6f20576f726c6421</code> as result.
Make sure the length is specified correct in the second byte.
</p>

Expand Down
37 changes: 37 additions & 0 deletions src/v1.html
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,36 @@ <h4 id="sensor-data">Sensor data</h4>
<code>°/s</code>
</td>
</tr>
<tr>
<td>
<code>0x53</code>
</td>
<td>text</td>
<td>see below</td>
<td>-</td>
<td>
<code>0D5348656C6C6F20576F726C6421</code>
</td>
<td>Hello World!</td>
<td>
<code></code>
</td>
</tr>
<tr>
<td>
<code>0x54</code>
</td>
<td>raw</td>
<td>see below</td>
<td>-</td>
<td>
<code>0D5448656C6C6F20576F726C6421</code>
</td>
<td>48656c6c6f20576f726c6421</td>
<td>
<code></code>
</td>
</tr>
</tbody>
</table>
</div>
Expand All @@ -601,6 +631,13 @@ <h5 id="timestamp">Timestamp</h5>
19:41:17. The corresponding datetime object that is returned is:
<code>datetime(2023, 5, 14, 19, 41, 17, tzinfo=timezone.utc)</code>
</p>
<h5 id="text and raw">Text and Raw sensors</h5>
<p>
Text has to be encoded in UTF-8, while the raw sensor is reported back as
hexadecimal string. The byte string <code>0x48656C6C6F20576F726C6421</code>
in text is <code>Hello World!</code>, while in raw sensor will give
<code>48656c6c6f20576f726c6421</code> as result.
</p>
<h5 id="multiple_measurements">Multiple measurements of the same type</h5>
<p>
If you want to send multiple measurements of the same type, e.g. three
Expand Down

0 comments on commit 853d4c9

Please sign in to comment.