Mar 5 – 7, 2024
Julius-Maximilians-Universität Würzburg
Europe/Berlin timezone

libjapi: An Open Source C Library for Seamless JSON Messaging Across Platforms

Mar 6, 2024, 10:50 AM
20m
HS3

HS3

Talk (15min + 5min) Research Software in C/C++ Cross-Platform Development with C/C++

Speakers

Katja Vornberger (Fraunhofer IIS)Mr Michael Baron (Fraunhofer IIS)

Description

Creating an architecture for distributed system consisting of several machines operating different software with different programming languages can be a challenge. Do you find yourself designing new interfaces over and over again with only use case specific differences? We present a solution to that: libjapi.

libjapi is an abstract and reliable C library that can be integrated in existing software to provide a configurable API. Download it from https://github.com/Fraunhofer-IIS/libjapi and use it under MIT license.

libjapi receives newline-delimited JSON messages via TCP and calls registered C functions. A JSON response is returned for each request. The benefit to you: All string handling is done by the library. Multiple users can be connected at the same time. Furthermore, it is also possible to create push services, which asynchronously push JSON messages to the clients subscribed to them. The behaviour is highly customizable at the server side. The clients can be implemented in any other language or framework as long as they can receive and transmit JSON messages over TCP. Different clients can interact with the same server as in the following use case.

We use libjapi to control the settings of an SDR (software defined radio) modem. libjapi is used by the GnuRadio based system to provide an API, that can change settings like the center frequency of the received or transmitted signals. Also measured values like received channel power and an overview of the most important settings are provided as push service. Three different clients were implemented, one command line tool in Python and a Vue based interactive web frontend. Both can operate at the same time. Additionally another service in C listens to the push service and records all these values into a database.

The library is provided as free open source software to ease the life of other developers like you. Feel free to use it, provide feedback through GitHub and add your own contributions and improvements. Ideas for future improvements include authentication, the integration of a JSON schema validator and usability improvements.

Primary author

Mr Michael Baron (Fraunhofer IIS)

Co-authors

Katja Vornberger (Fraunhofer IIS) Mr Moritz Thome (Fraunhofer IIS)

Presentation materials