la_mojo ONVIF: wait for the real end of an AbsoluteMove #11
Merged
ClaudeAI
merged 1 commits from feature/onvif-abs-move-wait into master 19 minutes ago
Loading…
Reference in new issue
There is no content yet.
Delete Branch 'feature/onvif-abs-move-wait'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Summary
After an ONVIF
AbsoluteMove, la_mojo now waits until the camera reports that the move is finished, instead of a fixed time. When the camera reports nothing, it falls back to a fixed 3 s wait.How the camera is checked
Right after
protocolPTZ_ONVIF::create()connects:GetServiceCapabilities: reads theMoveStatus/StatusPositionattributes.GetStatuscall: shows what the camera actually sends.An explicit
falsein the capabilities wins, because some cameras send fixed values. The result is logged once:PTZ status support: MoveStatus=yes Position=yes (...) -> wait for IDLEHow
waitMoveIsDone()waitsRules applied in all cases:
GetStatuscalls in a row it falls back to the fixed wait.The constants are in
protocolPTZ_ONVIF.h.Fixes needed for this
pOnvif::ptz_GetStatus:hasPosition,hasZoomPosition,isMoving).pOnvif::_send_request: the reply flag is set up before the request is queued. Late replies to requests that already timed out are ignored. Without this, a status poll could get the answer to the previous request.pOnvif::ptz_GetServiceCapabilities().Testing
g++ -fsyntax-onlywith the la_mojo flags, no new warnings.PTZ status supportlog line.EVT_CAMERA_ON_POSITIONnow follows the real move.Notes
deviceNodeCamerais unchanged. With video output enabled (m_bSkeepPositioningWait), it still does not wait at all.Generated with Claude Code
https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16
waitMoveIsDone() used to poll GetStatus for at most ~4 s and only understood MoveStatus. Cameras that report only the position (or report MoveStatus only away from 0/0/0) always ran into the timeout. - After create(), protocolPTZ_ONVIF detects what the camera reports: PTZ GetServiceCapabilities (MoveStatus / StatusPosition attributes) plus a real GetStatus probe. The result is logged ("PTZ status support: ..."). - waitMoveIsDone(): * MoveStatus cameras: poll every 200 ms until pan/tilt and zoom are IDLE (IDLE right after the command is ignored for 1 s unless the camera was seen MOVING or is already on target); * position-only cameras: until the AbsoluteMove target is reached or the position stops changing; * cameras reporting neither: fixed 3 s wait. Gives up after 10 s, falls back to the fixed wait after 3 failed GetStatus calls. - pOnvif::ptz_GetStatus: Position and MoveStatus are optional in the schema; read every element NULL-safe, always read MoveStatus, report hasPosition / hasZoomPosition / isMoving. - pOnvif::_send_request: arm the reply flag before queuing the request and ignore late replies of timed-out requests, so a poll can no longer get the answer of the previous request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN169a1d4a7023.