v0.7.0: pure C core + Zephyr module

- Extract all decode/decrypt into a dependency-free C99 core
  (include/victronble.h, src/victronble_core.c): victronble_decode(),
  is_product_adv/key_matches pre-filters, NAN sentinels, LE accessors.
- AES-128-CTR behind a hook: weak-symbol bundled tiny-AES default,
  runtime override (victronble_set_aes_ctr) for PSA/mbedTLS/hardware.
- Arduino VictronBLE class becomes a thin wrapper over the core
  (registry + nonce dedup + rate limit); public C++ API unchanged,
  NAN converted back to the legacy 0 convention.
- Host test vectors (tests/vectors): openssl-generated ciphertext,
  independent of the bundled AES; all five payload shapes + negatives.
- Zephyr module: zephyr/module.yml + Kconfig (CONFIG_VICTRONBLE) +
  observer backend (victronble_zephyr.{h,c}) — scan cb pre-filters and
  queues, dedicated decode thread, listener callbacks, slow passive
  scan defaults, stats counters. docs/ZEPHYR_PORT.md records the plan.
- library.properties: fix URL (gitea, not the nonexistent GitHub).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-21 11:59:19 +10:00
co-authored by Claude Fable 5
parent cc8c4d36d5
commit 037af33154
20 changed files with 2145 additions and 284 deletions
+42
View File
@@ -1,5 +1,47 @@
# Version History
## 0.7.0 (2026-08-21)
Pure C core + Zephyr support. One repo now serves three ecosystems: Arduino
(unchanged public API), PlatformIO, and Zephyr west workspaces.
### Pure C99 core (`include/victronble.h`, `src/victronble_core.c`)
- All decoding and decryption extracted into a dependency-free, reentrant,
allocation-free C core: `victronble_decode(mfg, len, key, out)` plus the
cheap pre-filters `victronble_is_product_adv()` / `victronble_key_matches()`
and helpers (`victronble_parse_key`, `strerror`, `device_type_str`,
`state_str`). Explicit little-endian accessors — no packed-struct punning.
- Absent wire fields are now NAN in the core (test with `isnan()`); the
Arduino wrapper converts back to the legacy `0` convention, so existing
sketches see identical values.
- AES is behind a CTR-shaped hook (`victronble_aes_ctr_fn`): weak-symbol
default = the bundled tiny-AES (linker-droppable), runtime override via
`victronble_set_aes_ctr()` for PSA/mbedTLS/hardware backends.
- `VictronBLE` (Arduino) is now a thin wrapper over the core — registry,
nonce dedup and rate limiting only. Public C++ API unchanged.
### Host test vectors (`tests/vectors/`)
- Plain-gcc harness (`run.sh`), no framework. Positive vectors for all five
payload shapes are generated by `gen_vectors.py` and encrypted with the
openssl CLI — independent of the bundled AES, so the CTR/nonce semantics
are cross-checked — plus negative cases (truncated, wrong vendor, wrong
key, unsupported record type).
### Zephyr module (`zephyr/module.yml`, `Kconfig`, `CMakeLists.txt`)
- `CONFIG_VICTRONBLE` (needs `CONFIG_BT_OBSERVER`): passive-scan observer
(`include/victronble_zephyr.h`, `src/victronble_zephyr.c`). The scan
callback only pre-filters and queues; a dedicated thread decrypts, decodes,
nonce-dedups and fans out to registered listeners
(`victronble_device_add(addr, key)` / `victronble_cb_register()` /
`victronble_start()`), with `victronble_get_stats()` counters. Default scan
is slow/low-duty (1.28 s / 11.25 ms — Victron advertises ~1 Hz). Consume as
a west project or via `-DZEPHYR_EXTRA_MODULES=<path>`; see
`docs/ZEPHYR_PORT.md` for the porting plan this implements.
### Fixed
- `library.properties` URL now points at the real repo (gitea) instead of a
nonexistent GitHub mirror.
## 0.6.0 (2026-06-04)
Multi-platform support. The library now runs on **nRF52840** (Adafruit/Seeed