Bring the protocol library and frame_bench up to the merged spec #52
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/spec-pull-model-update"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Transcribes the pull-model firmware update change from
docs/can-protocol.mdatfe5309e, sections 8.1, 8.9 and 11. Both transcriptions move together:protocol/catalogue.pyandtools/frame_bench/protocol.py.SYS_WIFI_CONTROLaction 3 now carries the update server address in bytes 2-5 and its port in bytes 6-7. Actions 0-2 have nothing to put there and send two bytes, so a field can now say which values of another field put it on the wire, and a sender stops at the shortest DLC that carries what it means. Decoding was already length-driven and is unchanged.BULK_BEGINgains content type 2, the session credential set held in RAM, andBULK_ENDbecomes addressed because the receiver sends it back to whoever sent the transfer.tools/frame_bench/examples/send-the-lighting-node-for-its-firmware.jsonplays the section 11 session as far as the bench can: session credentials, then action 3. The credentials are an exact multiple of six bytes so the example does not have to guess whether a final shortBULK_DATAframe is right — the specification does not say.CCS-UHA-10.
Tested with the existing suite, plus a check in
tests/test_bench_agrees_with_the_protocol.pythat both sides agree on which fields a frame carries, which is otherwise invisible in the bytes. No shared vectors coverSYS_WIFI_CONTROLorCLASS_BULKyet, sotests/vectors/frames.jsonis untouched; the wire namesupdateServerIpv4andupdateServerPortare this repository's guess until the firmware settles them.f17a40768b52771ae842One finding, in the bench's
carried.tools/frame_bench/protocol.py:322matcheswhen_isagainst the choice name only, so the same frame written two legal ways gives two different outputs with no error:A number is a legal value for a
ChoiceFieldeverywhere else in the bench —_choice_valueaccepts one, and the form's "Something else, by number" produces one — so a saved document or a CLI call with"action": 3silently builds a two-byte frame with no update server in it.static/app.js:414hides the fields for the same reason, so the page agrees with the wrong answer rather than showing it.Resolve the decider through its choices before the comparison: for a
ChoiceField, map the supplied value to its number and compare against the numberswhen_isnames, so a name and its value behave identically.Worth a case in
tests/test_frame_bench.pyalongsidetest_a_wifi_control_frame_stops_where_the_action_does— the named form is covered, the numeric one is not.856af15fixes it. Nothing blocking left.One latent trap, not reachable today:
static/app.js,carried()doesNumber(chosen), andNumber("")is0. An empty "other" box therefore reads as the choice numbered 0. Harmless forSYS_WIFI_CONTROL, where 0 isdisableandwhenIsis["ota"], but the first conditional field whose trigger value is 0 will show on the page while the server refuses the frame.if (chosen === "") return false;closes it.34d078e5033f61406325