Overview
Besides the ready-made converters, AMMC ships as a library you can link into your own application. The library is the protocol part of AMMC only, so it comes with limits worth knowing before you start:
- it converts the decoder's binary messages to JSON — mainly
PASSING, plus the version, status, ping and network-discovery replies - it does no networking: opening the socket to the decoder, reading from it and reconnecting stay in your application
- it covers AMB-based decoders and their P3 protocol only
If you want the socket handling, the database writer, the WebSocket server and
the UDP broadcast as well, run ammc-amb and read its output instead — see
WebSockets and UDP broadcast.
Which binding to use
| Your language | Use | Ships in |
|---|---|---|
| JavaScript, TypeScript | WASM module | npm |
| C, C++, C# | C ABI shared library | AMMC zip |
| Python | C ABI via cffi | AMMC zip |
| Java, Kotlin, Android | JNI surface | AMMC zip |
The C ABI and the JNI surface are the same shared library — ammc.dll,
libammc.so or libammc.dylib — one file per platform folder in the zip, next
to the header libammc.h.
The JSON you get back
Every binding returns the same thing: a JSON array, because one read from the decoder can carry several messages. The array is empty when nothing in the input could be decoded.
[
{
"msg": "PASSING",
"decoder_id": "041350",
"passing_number": 122,
"transponder": 5625887,
"rtc_time": "2013-03-19 21:36:33.607 +02:00",
"strength": 109.0,
"hits": 80,
"low_battery": false,
"resend": false,
"modified": false,
"gps_locked": false
}
]
Fields the decoder did not send are left out; see Introduction for what each one means.