code wiki / (root) / nx_iot_local_magic_home.nx

nx_iot_local_magic_home.nx

buildroot/runtime/nx_iot_local_magic_home.nx

13568 B378 linesdepth 0pulls 0 transitivereach 1 importersview sourcekind librarytopic iot
docsdependenciesstructsconstsfunctions

about

nx_iot_local_magic_home.nx -- Magic Home / Flux LED LAN protocol. Roadmap: NISHI_IOT_HUB_ROADMAP.md Epoch 2 (SPEAK). S-class invariants: S0 (bit-equal frame encode), S6 (no cloud), S7 (sealed-enum verdicts), S8 (kind-isolated — does not import any other nx_iot_local_* primitive). Kind generator (one of N per cardinal feedback-kind-specific-generators-not-broad-noise). Sibling kind generators: nx_iot_local_tuya_v33, nx_iot_local_wiz (next), nx_iot_local_yeelight (queued). Wire format (observed via flux_led / Saberlight RE notes, INDEPENDENT_REDERIVE per iot-hub-research.toml): Transport: TCP/5577 (control), UDP/48899 (discovery) Crypto: none Frame: <cmd_byte> <args...> [<persist=0x0F or no-persist=0x00>] <checksum> checksum = sum of all preceding bytes mod 256 Discovery (UDP/48899 broadcast): ASCII "HF-A11ASSISTHREAD" Discovery reply: ASCII "<ip>,<mac>,<model>" Common commands (controller variants v8/v9/v10+): 0x71 0x23 0x0F <chk> Power ON 0x71 0x24 0x0F <chk> Power OFF 0x31 R G B W 0xF0 0x0F <chk> Set RGBW (persist) 0x31 R G B W 0xF0 0x00 <chk> Set RGBW (no persist) 0x31 R G B 0x00 0xF0 0x0F <chk> Set RGB only 0x31 0x00 0x00 0x00 W 0x0F 0x0F <chk> Set warm-white only 0x81 0x8A 0x8B <chk> Query status 0x61 <preset> <speed> 0x0F <chk> Set preset mode Status reply (14 bytes for v8/v9, 16 bytes for v10+): [0] 0x81 (response sentinel) [1] model byte [2] power: 0x23=ON, 0x24=OFF [3] mode (0x61=custom RGB, 0x62=preset, ...) [4] speed (preset only) [5] R

dependencies 0 imports · 1 importers

nx_iot_local_magic_home.nx nx_iot_local_magic_home_test.nx

imports: none

imported by: nx_iot_local_magic_home_test.nx

structs

150struct IotMhStatus

consts

111const NX_IOT_MH_VERDICT_UNKNOWN: i64 = 0
112const NX_IOT_MH_VERDICT_OK: i64 = 1
113const NX_IOT_MH_VERDICT_BAD_LEN: i64 = 2
114const NX_IOT_MH_VERDICT_BAD_SENTINEL: i64 = 3
115const NX_IOT_MH_VERDICT_BAD_CHECKSUM: i64 = 4
116const NX_IOT_MH_VERDICT_BUF_TOO_SMALL: i64 = 5
117const NX_IOT_MH_VERDICT_BAD_ARG: i64 = 6
118const NX_IOT_MH_VERDICT_N: i64 = 7
128const NX_IOT_MH_POWER_UNKNOWN: i64 = 0
129const NX_IOT_MH_POWER_ON: i64 = 1
130const NX_IOT_MH_POWER_OFF: i64 = 2
131const NX_IOT_MH_POWER_N: i64 = 3
133const NX_IOT_MH_POWER_BYTE_ON: i64 = 0x23
134const NX_IOT_MH_POWER_BYTE_OFF: i64 = 0x24
138const NX_IOT_MH_PORT_CONTROL: i64 = 5577
139const NX_IOT_MH_PORT_DISCOVERY: i64 = 48899
141const NX_IOT_MH_RESPONSE_SENTINEL: i64 = 0x81
142const NX_IOT_MH_PERSIST: i64 = 0x0F
143const NX_IOT_MH_NO_PERSIST: i64 = 0x00
145const NX_IOT_MH_STATUS_LEN_V9: i64 = 14
146const NX_IOT_MH_STATUS_LEN_V10: i64 = 16

functions

120func nx_iot_mh_verdict_is_valid(v: i64) -> i64
called by 1: main
164func nx_iot_mh_checksum(buf: *u8, len: i64) -> i64
179func nx_iot_mh_build_power(out: *u8, out_cap: i64, on: i64) -> i64
called by 1: main calls 1: nx_iot_mh_checksum
191func nx_iot_mh_build_rgbw(out: *u8, out_cap: i64,
called by 1: main calls 1: nx_iot_mh_checksum
208func nx_iot_mh_build_rgb(out: *u8, out_cap: i64,
called by 1: main calls 1: nx_iot_mh_checksum
223func nx_iot_mh_build_warm_white(out: *u8, out_cap: i64, w: i64) -> i64
called by 1: main calls 1: nx_iot_mh_checksum
237func nx_iot_mh_build_query(out: *u8, out_cap: i64) -> i64
called by 1: main calls 1: nx_iot_mh_checksum
247func nx_iot_mh_build_preset(out: *u8, out_cap: i64,
called by 1: main calls 1: nx_iot_mh_checksum
265func nx_iot_mh_build_discovery(out: *u8, out_cap: i64) -> i64
called by 1: main
288func nx_iot_mh_find_byte(buf: *u8, len: i64, c: i64) -> i64
300func nx_iot_mh_parse_discovery_reply(buf: *u8, len: i64,
called by 1: main calls 1: nx_iot_mh_find_byte
332func nx_iot_mh_parse_status(buf: *u8, len: i64,
called by 1: main calls 1: nx_iot_mh_checksum