Typed config setters: set_title, set_maintenance - #11
Conversation
Thin wrappers over set_config_section (SYSTEM_CONFIG_SET_MESSAGE), both captured from AjDevTools batch dialogs and verified live on MTF45-4G_AF with a set-then-restore round-trip: - set_title(title, confirm=True): code 525 = MediaConfig/Video/Overlay. Read-modify-write of the current <Overlay> — only <TitleOverlay>'s title changes, so position/font/timestamp/user-OSD lines are preserved. The title is hex-encoded (TitleUtf8 = UTF-8 hex, legacy Title = GB2312 hex). - set_maintenance(enable, day=7, time, confirm=True): code 228 = SystemConfig/MaintainConfig (scheduled auto-reboot; day=7 = every day). const.CFG_MAINTAIN = "228". Tests: frame assertions, confirm gates, the RMW round-trip preserving sibling overlays, and the no-<Overlay> error path. Docs: the two confirmed codes + the multiline read-back note.
PR Summary by QodoAdd typed setters for camera titles and maintenance schedules
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Code Review by Qodo
1.
|
The upfront GB2312 guard rejected titles outside the legacy charset (e.g. emoji) even when the device config has no legacy Title attribute and only needs TitleUtf8 (which is stored as hex of the UTF-8 bytes and is always representable). Always set TitleUtf8; validate/encode GB2312 only inside the branch that updates an existing legacy Title. Add tests: a UTF-8-only overlay accepts a non-GB2312 title; a title outside GB2312 raises only when a legacy Title must also be updated.
|
Addressed in 372dca9: removed the upfront GB2312 guard. |
What
First typed wrappers over
set_config_section(PR #10) — one thin method per config section, both captured from AjDevTools batch dialogs and verified live on an MTF45-4G_AF with a set-then-restore round-trip.set_title(title, confirm=True)— code 525 =MediaConfig/Video/Overlay. Read-modify-write of the current<Overlay>: only<TitleOverlay>'s title changes, so position/font/timestamp and any user-OSD lines are preserved. Title is hex-encoded (TitleUtf8= UTF-8 hex, legacyTitle= GB2312 hex).set_maintenance(enable, day=7, time="HH:MM:SS", confirm=True)— code 228 =SystemConfig/MaintainConfig(scheduled auto-reboot;day=7= every day, per the vendor UI).Notes from the live captures
set_config_section); both were verified by reading the change back after a pause and then restoring the original.Time→" 2: 0: 0"), so read-backs use a multiline-aware matcher.Changes
anjoy/comm.py:set_title(RMW),set_maintenance.anjoy/const.py:CFG_MAINTAIN = "228".tests/test_comm.py: frame assertions, confirm gates, RMW round-trip preserving siblings, no-<Overlay>error path (77 tests pass).docs/devices.md: the two confirmed codes + the multiline read-back note.More section setters (time/language/encode/motion/AI/platform) follow as their codes are confirmed live.