Skip to content

projectiota/erpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Erpc

Minimal JSON RPC library based on Jsmn.

It has no other dependencies than Jsmn and fits in one C file, suitable for embbeding in constrained devices.

Being minimal, erpc has certain limitations:

  • No nested objects in parameters. This comes from Jsmn implementation, and it would be complicated to parse recursively.
  • We do not use id field, as all calls in Electrolink are blocking: client calls the functions and waits until it gets the response (via MQTT publish)

Erpc library was created for the needs of Electrolink protocol implementation, so many design decisions come from there.

However, erpc can be used as an independant library in various applications as mentioned limitations most often are not critical in lightweight embedded context.

We use 1KB hash map for function look-up table. If it takes too much memory, it should be possible to reduce it's size in the code without collisions (if number of attached fncs is not big)

Install

TL;DR

# Clone the repo
git clone --recursive https://github.com/projectiota/erpc && cd erpc
make

Static library liberpc.a will be created.

Jsmn Dependency

Erpc depends on Jsmn. Jsmn code is included in Erpc repo via git submodule, so that the code can be fetched via git submodule init && git submodule update, or git recursive clone.

However, many embedded build system have Jsmn already included - like RIOT or esp-open-rtos for example. In that case you can tell the GNU Make where to look for jsmn source files:

make JSMNDIR=<path_to_jsmn>

Build Example and Test

make test
./test

Author

Erpc was engineered by @drasko.

License

Apache-2.0

About

Lightweight JSON RPC based on Jsmn

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published