Device Library optional json
uuids.json
Two uses:
- Mobile application service/characteristic name, description, hints, sample payloads, nested metadata (
type,name,structure, …). - Lua
_G.uuids—lua_uuids_inject()reads each top-level key, expectsuuidinside the object; symbols withoutuuidare skipped. Extra keys ignored by injector.
UUID syntax matches: 4-char hex = 16-bit; 32/36-char (dashes optional) = 128-bit.
vars.json
Optional flat JSON object of persistent Lua state used for example in peripheral simulation.
Manifest
Top-level key vars in manifest.json (relative path, e.g. "vars.json").
If omitted or the file is missing, injection is skipped (warning in log); Lua may still create vars at runtime.
Load
After the peripheral Lua script is initialized, firmware reads the file and sets global vars to a Lua table:
| JSON value type | Lua type |
|---|---|
| string | string |
| number | number |
| boolean | boolean |
| object, array, null | skipped (not injected) |
Keys are top-level property names only (no nesting).
Injection runs before the script’s on_startup handler.
Save (vars_save())
Registered for central and peripheral Lua (lua_hook.c). Meaningful on peripheral when lua_vars_set_path was set from manifest:
- Reads global
vars(must be a table). - Writes string / number / boolean fields back to the path as unformatted JSON.
- Returns
trueif the file was opened for write, elsefalse. - Nested tables and non-scalar values in
varsare not serialized.
Example:
{
"secret": 42,
"label": "training",
"paired_once": false
}vars.counter = (vars.counter or 0) + 1
vars_save()graphics.json
Graphic elements that might be used by the dynamic scripts.
- Root
elements: required array (may be empty). - Each element
id,type:svg|png|text. - Position:
align,x,y,w,h(seegfx_coords_t). color: hex string or number; omit → firmware default tint behavior.size: 0–255 (% of smallest screen dimension).file: file name for svg/png (deviceassets).text: UTF-8 string fortexttype.