naneos.ble.partector.characteristics
Decoders for the BLE characteristics and advertisement payloads of a Partector.
Every payload is a fixed 20 byte layout of little-endian unsigned integers. Each decoder is a table of fields (name, byte slice, scaling); the generic decode() loop reads them onto a NaneosDeviceDataPoint. Only the size distribution packs its channels as 20 bit values and needs its own loop.
PartectorBleDecoderAux
Bases: PartectorBleDecoderBlueprint
The aux characteristic, also the scan response half of the advertisement.
Source code in src/naneos/ble/partector/characteristics.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
PartectorBleDecoderAuxError
Bases: PartectorBleDecoderBlueprint
The aux characteristic in error mode, marked by 0xFFFF in the first two bytes.
Source code in src/naneos/ble/partector/characteristics.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
PartectorBleDecoderBlueprint
Shared decode loop. Subclasses define FIELDS or override _decode_fields().
Source code in src/naneos/ble/partector/characteristics.py
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 | |
decode(data, data_structure=None)
classmethod
Decode the payload. If data_structure is given it is filled in place and returned.
Source code in src/naneos/ble/partector/characteristics.py
40 41 42 43 44 45 46 47 48 | |
PartectorBleDecoderSize
Bases: PartectorBleDecoderBlueprint
The size distribution: 8 channels packed as consecutive 20 bit values.
Source code in src/naneos/ble/partector/characteristics.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
PartectorBleDecoderStd
Bases: PartectorBleDecoderBlueprint
The std characteristic, also the first half of the advertisement.
Source code in src/naneos/ble/partector/characteristics.py
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 | |
PartectorBleDiagnosticsPackets
The UI curve and the pulse form, which the device streams on the aux characteristic after "UI?" and "pulse?" (firmware 418 or newer).
Byte 1 tells the kind, byte 0 is 254 on the last packet and 255 before, then the points follow from byte 2. A UI curve packet carries 5 points of uint16 LE voltage in V plus uint8 current in nA * 100 (20 packets); its last byte counts the packet, 0 to 19. A pulse form packet carries 8 samples of uint8 index plus uint8 current in nA * 100 (25 packets of 8 make the 200 samples, without overlap). Bytes 18 and 19 of a pulse form packet are reserved: the firmware leaves the first sample of the next packet there, which must not be read as a sample of this one. The device sends one packet every 2 s.
Source code in src/naneos/ble/partector/characteristics.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
pulse_form_values(data)
classmethod
(sample index, current in nA) per sample.
Source code in src/naneos/ble/partector/characteristics.py
188 189 190 191 192 193 194 | |
ui_curve_points(data)
classmethod
(voltage in V, current in nA) per point.
Source code in src/naneos/ble/partector/characteristics.py
178 179 180 181 182 183 184 185 186 | |