Skip to content

Write image flip together with its direction - #161

Open
baylanger wants to merge 1 commit into
mezz64:masterfrom
baylanger:image-flip
Open

baylanger wants to merge 1 commit into
mezz64:masterfrom
baylanger:image-flip

Conversation

@baylanger

Copy link
Copy Markdown
Contributor

Some cameras (seen on a DS-2CD2385G1) omit ImageFlip/ImageFlipStyle from /ISAPI/Image/channels/1 while flip is off, and refuse ImageFlip/enabled set to true without it. So the switch and the select pyHik reported could not be used:

Setting ImageFlip/enabled failed: badXmlContent
Image setting ImageFlip/ImageFlipStyle not found in /ISAPI/Image/channels/1
Setting ImageFlip/ImageFlipStyle failed: pathNotFound

The camera UI shows them as one control ("Mirror": OFF, Left/Right, Up/Down, Center). pyHik now reports them the same way, as one linked select like BLC mode:

  • ImageFlip/ImageFlipStyle gets linked_enabled_path="ImageFlip/enabled", and ImageFlip/enabled is no longer reported on its own.
  • The direction has no off option, so pyHik adds OFF (ImageSetting.off_value). The new ImageSetting.off_value_written field is False for it: choosing OFF writes only enabled=false, never OFF to the direction element. It is True for every other linked select, so BLC is unchanged.
  • Any other option turns flip on with that direction in one PUT (set_image_linked_setting), inserting the direction element when it is absent.
  • The value is OFF while flip is off, the direction while it is on.

Tests: parsing (merged, options, value off and on, BLC unchanged), and writes against the fake device, which now refuses flip on without a direction as the camera does (on with a direction, another direction, off writes only the flag, off while off). README updated.

Note for consumers: an ImageFlip/enabled switch no longer appears; its function is the OFF option of the direction select.

The camera omits ImageFlip/ImageFlipStyle while flip is off, and refuses
ImageFlip/enabled set to true without it (badXmlContent). So the two were
reported as a switch and a select that could not be used: turning flip on
failed, and choosing a direction while off failed with pathNotFound.

They are now one linked select, like BLC mode, as the camera UI shows them
("Mirror"). The direction has no off option, so pyhik adds OFF; choosing it
writes only the flag (ImageSetting.off_value_written is false). Any other
option turns flip on with that direction in one PUT, inserting the element
when it is absent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CqtSBY5RLaetEg5m4j4r6U

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant