code wiki / (root) / nx_iot_control_page.nx

nx_iot_control_page.nx

buildroot/runtime/nx_iot_control_page.nx

8802 B160 linesdepth 2pulls 3 transitivereach 9 importersview sourcekind tooltopic iot
docsdependenciesstructsconstsfunctions

about

nx_iot_control_page.nx -- emit a ZERO-JS, CROSS-BROWSER IoT CONTROL page. Operator 2026-06-22: "work via nishi browser and 3rd party like chrome/firefox/edge and simple for other people to use aka reproducible." The cross-browser + reproducible answer is SERVER-RENDERED HTML + CSS with ZERO <script>: controls are real <form> POSTs to the hub's /home/cmd, so they actuate in EVERY browser with nothing to install (the same no-JS doctrine the reader arc proved). Capability-driven (nx_iot_capability): a switch gets On/Off, a colour bulb gets brightness/colour/warmth/scene -- chosen per device, never hardcoded. Library organ: cp_head/cp_card/cp_foot/cp_find + a demo main() (the gate calls the functions; on import the demo main is stripped). NEVER-BRICK #26: the page only emits on/off/brightness/scene COMMANDS (no firmware). license_tier: ORIGINAL

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_iot_capability.nx nx_iot_control_page.nx nx_iot_control_page_gate.nx nx_iot_dashboard.nx

imports: nx_syscalls.nxnx_iot_capability.nx

imported by: nx_iot_control_page_gate.nxnx_iot_dashboard.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap cp_head cp_cat cp_card nx_iot_cap_for_class cp_cat ↻ cp_widgets nx_iot_cap_has cp_cmd_open cp_cat ↻ cp_cat ↻ cp_catn sys_mmap ↻ cp_foot cp_cat ↻ sys_openat_wr sys_write sys_exit sys_close

structs

none

consts

18const CP_OUT: *u8 = "web_assets/iot_control.html"
19const CP_CAP: i64 = 262144

functions

21func cp_cat(dst: *u8, off: i64, s: *u8) -> i64
27func cp_catn(dst: *u8, off: i64, v: i64) -> i64
called by 2: cp_widgetsdb_card calls 1: sys_mmap
40func cp_find(buf: *u8, len: i64, pat: *u8, pat_len: i64) -> i64
called by 1: main
60func cp_cmd_open(h: *u8, off: i64, id: *u8) -> i64
called by 1: cp_widgets calls 1: cp_cat
69func cp_widgets(h: *u8, off: i64, id: *u8, caps: i64, is_on: i64) -> i64
101func cp_card(h: *u8, off: i64, id: *u8, name: *u8, room: *u8, vlabel: *u8, dev_class: i64, is_on: i64) -> i64
116func cp_head(h: *u8, off: i64) -> i64
137func cp_foot(h: *u8, off: i64) -> i64
145func main() -> i64