This page describes how to get information out of the OpenStint decoder software.
The decoder protocol costsis of one-way text-based messages over a ZeroMQ pub-sub channel.
- ZeroMQ makes sure messages are consumed as a single entity, in a fault-tolearant manner. There is no need for custom frame detection (ie. P3's
0x8Dor Cano's\n), ZeroMQ does this for us ("consumed as a single entity"). There is also little to no need to worry about lost TCP connections, the ZeroMQ client reconnects when possible ("fault tolerant"). Note, the pub-sub structure does not buffer messages though, meaning unseen messages are lost. - Messages are human-readable. Check out example subscriber for a quick demo.
The protocol defines 3 types of messages. Each message type is identified by the first character of the message. The message attributes (ie. transponder_id, timestamp, etc.) are space-separared. Attribute types are defined by their position in the stream. This makes processing as easy as:
parts = msg.split()
if len(parts) < 5:
continue # malformed message
msg_type = parts[0] # "P" for passing, "T" for timesync, ...
if msg_type != "P":
continue # not interrested
try:
timecode = int(parts[1])
transponder_type = parts[2]
transponder_id = int(parts[3])
rssi = float(parts[4])
hit_count = int(parts[5])
except ValueError:
continue # skip malformed dataFor a working laptimer example, check out laptimer.py.
Other message parameters are reserved for future use. As such, do not do something like this, as it might fail with future versions:
msg_type, timecode, transponder_type, transponder_id, rssi, hit_count = msg.split()Structure:
P <decoder_timestamp:uint64> <transponder_type:string> <transponder_id:uint32_t> <rssi:float> <hit_count:uint32_t> <evm:float> [other future parameters]
Example:
P 1618706341 OPN 1615544 3.50 64 0.30
P 1618714251 OPN 1615544 3.08 40 0.25
P 1658197240 AMB 3616557 3.88 21 0.29
P 1658197696 AMB 3616557 4.24 30 0.34
decoder_timestampis a milliseconds-resolution steady clock epoch, counting from the startup of the decoder process. As such, it is insensitive to updates to system time (NTP syncs). Treat it as a monotonic counter. When the decoder process restarts, the counter restarts as well.transponder_typedefines if the passing is from an OpenStint (OPN) or legacy/RC3 transponder (AMB). The OpenStint transponder protocol is an error-corrected, highly sensitive, well-documented transponder protocol, and it is the preferred protocol of this project. The legacy/RC3 is there to provide backwards-compatibility with existing transponders (MyLaps/MRT/Vostok/etc.). RC4 support is not actively pursued.transponder_idis a non-negative number. Both OpenStint and AMB/RC3 defines it as "up to 7 digits", but future transponder options might increase it's width. With OpenStint transponders, even single-digit (ie.0) transponder ids are possible.RSSIis the maximum "Relative Signal Strenght Indicator. It is expressed in terms of power, in decibel scale. The reference point (0 dB) is the maximum power the radio can receive, and every measured value is negative. It is calculated from (an approximation of) RMS value. As such, the value-3.0means the full scale is used, larger values indicate clipping (decrease amplifier gains). Reliable reception is possible at 3 dB above noise floor (repored in status messages).hit_counttells about the number of successfully decoded tranponder messages during the passing. OpenStint transponders should transmit a message on average every 1.5 ms. RC4-hybrid transponders send at a similar rate, but only every ~4th is an RC3 message (which is the supported message format).evmis Error Vector Magnitude; it's a measure of demodulation efficiency. If you build custom transponders, and this value is unusally high, the transponder is probably mis-tuned.
Possible future extensions:
- Passing speed detection
Structure:
<decoder_timestamp:uint64> <transponder_type:string> <transponder_id:uint32_t> <transponder_timecode:uint32_t>
Example:
T 1618721816 OPN 1615544 905370
Time syncronization messages are sent by OpenStint transponders with precise internal clock. These messages are meant to syncronize distinct decoder installations for sector timing.
You can read further info in the transponder protocol document.
The gist is though, if the laptimer software receive one-one timesync messages from two decoders, it can synchronize decoder_timestamp with a high precision.
Possible future extensions:
- Frequency offset between the transponders carrier and the radio's master clock
Structure:
S <decoder_timestamp:uint64> <noise_power:float> <dc_offset_magnitude:uint8> <frames_received> <frames_processed> [other future parameters]
Example:
S 1792039754 1.018744 5 0 0
S 1792040804 1.2333267 5 77 52
S 1792041851 0.9898376 5 184 135
S 1792042901 1.0032545 5 0 0
decoder_timestampis the same monotoic clock as used in other messages.noise_poweris the average received signal level when no transponder messages are received. It is expressed in dBFS (decibel full-scale), just like the RSSI values. As it is log-scale, you can get the signal-to-noise ratio asSNR = frame_power-noise_power.- The
dc_offset_magnitudeis the absolute value of the DC-offset. It is radio-dependent error, and usually caused by phase-imbalance in the mixer stages. Post-mixer amplifiers (hackrf: VGA) amplifiy it. If the magnitude is larger than ~10.0, consider decreasing the VGA gain of the radio. frames_receivedandframes_processedcount the total and successfully processed transponder transmissions in the given reporting period. A large difference indicates a bad signal-to-noise environment or high inter-symbol interfecence (caused by bad LC-tuning). If you're experimenting with your own transponders, this is a good metric to track while tuning the capacitors of the "antenna loop".
Possible future extensions:
- Low-bin (ie. 64) FFT on the received signal. It would help setting up preamps and amplifiers gains.