nx_iot_capability.nx
buildroot/runtime/nx_iot_capability.nx
about
nx_iot_capability.nx -- per-device capability model for the hub UI.
Roadmap: NISHI_IOT_HUB_ROADMAP.md Epoch 6 (CALIBRATE) + the
nishifamily.com/iot control-panel substrate. Operator ask
(2026-06-18): manage devices "with the ability to change the lights
on what capabilities they have like color and light intensity."
The triad: nx_iot_anchor = WHO (stable identity), the vendor driver
= HOW (wire protocol), this = WHAT-IT-CAN-DO. The /iot UI reads a
device's capability set and renders exactly the right controls -- a
toggle for a switch, a slider for a dimmer, a colour wheel + temp
slider for a colour bulb. Data-driven (CLAUDE.md #11): the UI never
hardcodes per-device controls; it asks this model.
Capabilities are bit flags so a device advertises a SET. Device
classes map to default capability sets; per-vendor quirks refine.
Pure caller-buffer, no syscalls, no imports -> portable + sovereign.
license_tier: ORIGINAL
nx_capability_claims:
needs: [pointer_arithmetic, bit_ops]
provides: [capability_flags, class_to_caps, caps_has,
caps_clamp_level, caps_emit_json]
safety: [no_unchecked_deref, no_floating_point, no_syscall,
bounded_iteration, data_driven]
verdict: [sealed_enum_class, no_silent_failure]
license: ORIGINAL
kind: iot_runtime_primitive
sss: [S6, S7]
dependencies 0 imports · 3 importers
imports: none
imported by: nx_iot_capability_test.nxnx_iot_control_page.nxnx_iot_page.nx
structs
| none |
consts
| 35 | const NX_IOT_CAP_ONOFF: i64 = 1 // bit 0 -> render a toggle |
| 36 | const NX_IOT_CAP_BRIGHTNESS: i64 = 2 // bit 1 -> render a 0-100 slider |
| 37 | const NX_IOT_CAP_COLOR: i64 = 4 // bit 2 -> render a hue/sat picker |
| 38 | const NX_IOT_CAP_COLOR_TEMP: i64 = 8 // bit 3 -> render a Kelvin slider |
| 39 | const NX_IOT_CAP_SCENE: i64 = 16 // bit 4 -> render a scene list |
| 40 | const NX_IOT_CAP_ENERGY: i64 = 32 // bit 5 -> render energy readout |
| 44 | const NX_IOT_CLASS_UNKNOWN: i64 = 0 |
| 45 | const NX_IOT_CLASS_SWITCH: i64 = 1 |
| 46 | const NX_IOT_CLASS_PLUG: i64 = 2 |
| 47 | const NX_IOT_CLASS_PLUG_ENERGY: i64 = 3 |
| 48 | const NX_IOT_CLASS_DIMMER: i64 = 4 |
| 49 | const NX_IOT_CLASS_BULB_WHITE: i64 = 5 |
| 50 | const NX_IOT_CLASS_BULB_TUNABLE: i64 = 6 |
| 51 | const NX_IOT_CLASS_BULB_COLOR: i64 = 7 |
| 52 | const NX_IOT_CLASS_N: i64 = 8 |
| 62 | const NX_IOT_BRIGHTNESS_MIN: i64 = 0 |
| 63 | const NX_IOT_BRIGHTNESS_MAX: i64 = 100 |
| 64 | const NX_IOT_COLOR_TEMP_MIN: i64 = 2700 // warm white, Kelvin |
| 65 | const NX_IOT_COLOR_TEMP_MAX: i64 = 6500 // cool daylight, Kelvin |
functions
| 54 | func nx_iot_class_is_valid(c: i64) -> i64 called by 1: main |
| 69 | func nx_iot_cap_puts_z(out: *u8, off: i64, s: *u8) -> i64 called by 1: nx_iot_cap_emit_json |
| 85 | func nx_iot_cap_for_class(vendor: i64, dev_class: i64) -> i64 |
| 108 | func nx_iot_cap_has(caps: i64, flag: i64) -> i64 |
| 115 | func nx_iot_cap_clamp_brightness(caps: i64, v: i64) -> i64 |
| 122 | func nx_iot_cap_clamp_color_temp(caps: i64, k: i64) -> i64 |
| 136 | func nx_iot_cap_emit_json(caps: i64, out: *u8, out_cap: i64) -> i64 |