APIs

Calling AMMC using API from other languages does not invoke complete AMMC but has rather several limitations:

  • only subset of messages is implemented like PASSING, STATUS etc
  • socket handling must be done inside calling application and send received bytes to the API

The API contains 4 functions

  • p3_to_json - converts binary protocol to JSON
  • encode - encodes JSON to binary protocol
  • time_to_millis - converts ISO time to milliseconds. From "%Y-%m-%d %H:%M:%S%.3f" to milliseconds since epoch
  • version - returns AMMC version for reference

JavaScript developers

AMMC is compiled to WASM modules that can be linked to your JavaScript based application. The module in NPM repository with description

C/C++/C# developers

AMMC zip file contains libammc.h and dll/so files. This contains functions char *p3_to_json(const char *msg); that converts AMB's binary messages to JSON.

Python developers

Python developers can use DLL loading that is delivered in AMMC zip file. There is also example script in Python lib_test.py that converts binary message into JSON:

# pip install cffi
from cffi import FFI

lib = "windows64\\libammc.dll"
print(f"Trying to open AMMC lib from path: {lib}")
C = ffi.dlopen(lib)
p3_msg = "8e023300e5630000010001047a00000003041fd855000408589514394cd8040005026d0006025000080200008104501304008f"
result = C.p3_to_json(p3_msg.encode('ascii'))
assert 'PASSING' in result

Java/Kotlin Android Developers

Java developers can use JNI to call dll or so libraries from operating system that are part of AMMC zip file delivery. For an example how to call the API from Kotlin / Android see an example project on Github