Skip to content
Device Library optional json

Device Library optional json

uuids.json

Two uses:

  1. Mobile application service/characteristic name, description, hints, sample payloads, nested metadata (type, name, structure, …).
  2. Lua _G.uuidslua_uuids_inject() reads each top-level key, expects uuid inside the object; symbols without uuid are 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 typeLua type
stringstring
numbernumber
booleanboolean
object, array, nullskipped (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 true if the file was opened for write, else false.
  • Nested tables and non-scalar values in vars are 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 (see gfx_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 (device assets).
  • text: UTF-8 string for text type.

© BLESPlo.it · BLE Research Tool · GitHub