User Defined Telemetry API¶
API for Extended Telemetry - User Defined¶
Overview¶
Read the documentation carefully
This library is flexible. So flexible, in fact, that you may use it incorrectly.
Background
A core feature of Extended Telemetry is that data is sent structured, and that well-known enumerated types can be added over time.
However, prototyping and experimentation by developers is key.
So, baked into Extended Telemetry is a well-known "User-Defined" message type, which only stipulates that the data not clash with all other Extended Telemetry.
No other structure is defined, and transmitters are free to send what they want, when they want.
This library makes that work.
API Background
This library makes sending structured encoded data easy by providing an API which lets you:
- Define the data you want to send
- Then extract the encoded form of that data
- Without ever seeing the internals
It "just works" when used correctly.
Gotchas
- This is a template class, where you specify the number of fields you want to encode
- The library has return values which indicate if you overflow, or other errors, but you have to actually check them
- There is a limited 29.178 bits of encodable space in the message
- The compaction scheme is very efficient, but you can run out without realizing if you don't check the return codes on the API functions
- The instantiated memory size of of the codec is proportional to the number of fields in the template parameter
- Baseline of around 300 bytes
- Plus each new field is an additional 56 bytes
- 5 fields is nearly 600 bytes.
- 10 fields is nearly 900 bytes.
- Accessing fields is done by a c-string field name
- It is easy to typo these, and the compiler will have no way of warning you
- A best practice is to set up a set of a
const char *fieldNameLabel
variables and use them everywhere as field name so you don't mess it up
- Not checking return values (as stated above)
- Changing the encoding of a message later (totally fine), just be aware that:
- Any previously-sent messages can only be decoded using the schema that was in use when they were sent
You can decode any messages you create online, also, at the Extended Telemetry playground
API Guide¶
API Guide
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
Encoding Example¶
Example minimal program
Decoding Example¶
Example minimal program