1. Faults are no longer reported as success: every request waits for the
answer, checks the HTTP status and the SOAP Fault (logged with
Code/Subcode/Reason); getLastError()/getLastFault() tell the caller.
protocolPTZ_ONVIF clears m_bStatus (-> reconnect) only on
communication errors, not on a Fault from a reachable camera.
AbsoluteMove now waits for its answer too.
2. Request/reply race: already fixed in #11 (checked).
3. NULL-safe parsing of optional elements (safeCopy/safeAtoi/safeAtof),
videoSource zero-filled, Imaging values parsed as float, IrCutFilter
AUTO no longer read as OFF, missing XAddr no longer becomes "(null)",
GetSystemDateAndTime without UTCDateTime no longer breaks the token
time (falls back to the local clock).
4. GetProfiles parses PTZConfiguration; the PTZ profile is the first one
that has it (fallback to profile 0 with an error log); create() fails
cleanly when the device has no profiles instead of throwing.
5. Pan/tilt and zoom in one ContinuousMove with Timeout PT10S
(PONVIF_CONTINUOUS_MOVE_TIMEOUT_S); Stop honours its pantilt/zoom flags.
6. WS-Security: 16-byte RAND_bytes nonce, no fixed-size digest buffer,
header only when a user name is set (anonymous devices), user name and
all string arguments XML-escaped. Requests are built by _buildRequest()
from body templates. HTTP auth mode 0 now uses CURLAUTH_ANY (sends no
password until the device asks; Digest preferred) instead of Basic;
no HTTP auth without credentials.
Also: Content-Type without the trailing ';', GetServices/
GetDeviceInformation sent to the device service, printf format-string
bugs on device replies fixed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16
Target-driven moves of deviceNodePTZCamControl (AbsoluteMove) and
deviceNodePresetCamControl (preset for the ROI) both end in
CAM_WS_WAIT_ONPOS, which waits for the end of the move and then
broadcasts EVT_CAMERA_ON_POSITION (EVT_CLASS_CAMERA_CTRL).
- AbsoluteMove: with video output enabled (m_bSkeepPositioningWait) the
event was broadcast right after the command, before the camera moved.
It now always goes through CAM_WS_WAIT_ONPOS, like the preset path.
- New m_bNoMoveDoneReport: set when the protocol cannot report the end
of a move (waitMoveIsDone() returns false). Then a fixed
CAM_MOVE_FIXED_WAIT_MS (3 s) wait is used before the event. Before, the
same failure set m_bSkeepPositioningWait, which made every later
AbsoluteMove broadcast the event immediately. Reset when the protocol
is (re)created.
- protocolPTZ_ONVIF::goPreset: forget the last AbsoluteMove target so
waitMoveIsDone() cannot end early by comparing with it.
Homing, init go-home and web/IR/wiper presets are unchanged (no event).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: 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_0139veDo3XyavMuVhdnHcN16