A small, embeddable, portable C library implementing the APEX protocol — both Host and Device roles for Core (framing, discovery, heartbeat) and for the first device class, Activation.
- Pure C99, no dynamic allocation, no
stdio, no platform headers. - Transport-agnostic: the caller pushes received bytes in and registers a TX callback. There is no built-in UART driver.
- Drop-in source: copy
src/andinclude/into your project and add the.cfiles to your build. No submodules, no third-party deps. - Trivial standalone build: a 20-line
Makefileproduceslibapex.a.
make # produces build/libapex.a
make test # builds and runs unit tests (needs GoogleTest; see test/Makefile)
make cleanThe library compiles with any reasonable C99 toolchain. There is no configure,
no CMake, no autotools. To cross-compile, override CC and AR:
make CC=arm-none-eabi-gcc AR=arm-none-eabi-ar CFLAGS="-mcpu=cortex-m7 -mthumb -Os"include/apex/ public headers (this is what consumers #include)
apex.h umbrella header
apex_core.h constants, types, and outer-header layout from spec §3.1
apex_cobs.h COBS encode/decode
apex_crc.h CRC-16/CCITT-FALSE
apex_framer.h decoded-frame pack/unpack + byte-stream ingress
apex_host.h host: device table, discovery, heartbeat
apex_device.h device: discovery client, heartbeat
apex_activation.h Activation class — both Host and Device sides
src/ one .c per public header
test/ gtest-based unit tests; mirrors the byte-level worked
example from APEX_Device_Class_Activation.md §9.4
make
gcc my_app.c -Iapex/include -Lapex/build -lapexAppend the .c files to your source list:
APEX_SRC = \
apex/src/apex_cobs.c \
apex/src/apex_crc.c \
apex/src/apex_framer.c \
apex/src/apex_host.c \
apex/src/apex_device.c \
apex/src/apex_activation.cAdd apex/include to your include path. That's it.
| Feature | Status |
|---|---|
| COBS framing, CRC-16/CCITT-FALSE | ✅ |
| Outer header pack/unpack | ✅ |
| Host discovery + device table + lifecycle (NEW → CONNECTED → EXPENDED / FAULT) | ✅ |
| Device discovery + 1 Hz heartbeat + 5 s watchdog | ✅ |
| NAME_REQUEST / NAME_REPLY | ✅ |
| HOST_STATE broadcast | ✅ |
| Activation class — Device state machine + COMMAND/ACK/STATUS/CAPABILITY | ✅ |
| Activation class — Host driver | ✅ |
| Multi-class on a single link (host side) | ✅ |
| Passthrough / hub nodes | ⛔ — spec marks the area as not well defined |
| Baud-rate negotiation | ⛔ — spec does not define a CONFIG message for this yet |
MIT. See LICENSE.