Config section write: set_config_section (SYSTEM_CONFIG_SET_MESSAGE) - #10
Conversation
AjDevTools' per-feature batch buttons write one config section at a time: SYSTEM_CONFIG_SET_MESSAGE carries the section's numeric Msg_code and the section element as the body; the device acks with the same type+code and an empty body. A partial section is accepted (the device merges it), and the write is applied asynchronously (it reaches /mnt/nand/config.xml a moment after the ack). Captured "Batch Set Title" against a live MTF45-4G_AF: code 525 = MediaConfig/Video/Overlay (OSD title + timestamp; title is hex-ASCII). Verified live by setting the OSD title to "Test" then back to "Camera". Reads stay on the full-config download (get_config) — the device's per-section GET returned an empty body to every request form tried, so it is not used (which is also what the vendor tool does). - anjoy/comm.py: set_config_section(code, body, confirm=True) - anjoy/const.py: CFG_OVERLAY = "525" + the section-code namespace - tests/fake_server.py: SYSTEM_CONFIG_SET branch (records config_sets) - tests/test_comm.py: frame/ack, confirm gate, GB2312 reject, round-trip - docs/devices.md: config section write block
PR Summary by QodoAdd confirmed per-section camera configuration writes
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Code Review by Qodo
1.
|
Qodo review: success is defined as the same type+code with an EMPTY MESSAGE_BODY, but the ack check delegated to _recv_until (which matches only type+code). A device that replied with the matching type+code carrying an error/status payload would be treated as success. Parse the ack's MESSAGE_BODY after _recv_until; raise AnjoyError (surfacing the payload) when it is non-empty. Add _message_body() helper + a test that a matching-type/code frame with a payload is rejected.
|
Addressed the review finding in 92af268: |
What
Adds
AnjoyCommClient.set_config_section(code, body, confirm=True)— the primitive for the vendor's per-feature batch-config operations, captured live from AjDevTools driving an MTF45-4G_AF.Protocol (captured + verified live)
AjDevTools' per-feature batch buttons write one config section at a time:
SYSTEM_CONFIG_SET_MESSAGEwith the section's numericMsg_codeand the section element as the body./mnt/nand/config.xml(andget_config) a moment later.Captured "Batch Set Title": code
525=MediaConfig/Video/Overlay(OSD title + timestamp; title is hex-ASCII,43616d657261= "Camera"). Verified live by setting the OSD title to "Test" then back to "Camera".Reads stay on the full-config download (
get_config) — the device's per-section GET returned an empty body to every request form tried, so it is not used (also what the vendor tool does).Changes
anjoy/comm.py:set_config_section(confirm-gated, GB2312-validated, echo-ack).anjoy/const.py:CFG_OVERLAY = "525"and the section-code namespace (further codes added as captured).tests/fake_server.py:SYSTEM_CONFIG_SET_MESSAGEbranch (recordsconfig_sets).tests/test_comm.py: frame/ack, confirm gate, non-GB2312 reject, round-trip (71 tests pass).docs/devices.md: config-section-write block.This is the foundation for the typed batch setters (title/time/encode/motion/AI/maintenance/platform) that follow.