Skip to content
Device Library Central

Device Library Central

menu.json

Central-role static menu tree (main/interface/interface_central.c). Loaded when central connects (ble_central_core.c calls interface_central_init(paths->central->menu)).

Root

FieldRequiredNotes
menusYesNon-empty array of menu nodes.
initial_menuNoString id of the first visible node; if omitted, the first valid entry in menus becomes initial.
statesNoRegisters named UI state keys for set_state / state bar (key strings only parsed; name is ignored by firmware). At most 10 keys (CENTRAL_STATE_MAX_ENTRIES). key length capped at 9 usable characters (CENTRAL_STATE_KEY_LEN).

Menu node (menus[])

FieldNotes
idRequired. Used with push_menu("id") and WebSocket central / menu_select.
titleOptional; defaults to id if missing.
on_enterOptional Lua field string; dispatched with lua_call_from_field when the node becomes active (initial load, push_menu, or pop_menu back). Same syntax as items[].id (see below).
itemsArray of selectable rows (optional); omit or [] for an empty panel. Rows need id and label or they are skipped. At most 8 entries (CENTRAL_MENU_MAX_ITEMS); extras are dropped with a log warning.

Item id → Lua dispatch

Selecting a row passes items[].id through lua_call_from_field (also used for on_enter):

  • Plain name: e.g. turn_on → calls global Lua handler turn_on with no argument.
  • name(args): e.g. set_color(FF0000) → function set_color with argument string FF0000 (lua_call_parse in lua_hook.c). Matching ) required.

Reserved menu actions are Lua-side (e.g. scripts may define wrappers that call push_menu / pop_menu).

Navigation limits

Menu stack depth is 4 (CENTRAL_MENU_STACK_DEPTH).


© BLESPlo.it · BLE Research Tool · GitHub