Skip to content

v0.9.6

Choose a tag to compare

@smiti1642 smiti1642 released this 26 May 07:16
· 20 commits to master since this release

Headline: a built-in mock ONVIF device so downstream crates can unit-test
client code without a real camera — every vendor's ONVIF differs and depending
on a physical IP camera in tests is painful. Also rolls in the session-level
push subscribe and vendor-tolerant OSD parsing.

Added

  • Built-in mock ONVIF device — oxvif::mock (opt-in, behind features).
    Stateful (Set persists, Get reflects it) and covers every operation oxvif
    implements; state is in-memory (the library never writes to disk — opt into
    persistence via MockState::set_on_change).
    • mock feature → MockTransport, an in-process Transport (no sockets, no
      axum) — the fast unit-test path:
      OnvifClient::new("http://mock").with_transport(Arc::new(MockTransport::new())).
    • mock-server feature → MockServer, a real axum HTTP server on an
      ephemeral port (MockServer::start().await), shutting down on drop — for
      cross-process / non-Rust clients.
    • Both default to no auth (call .with_auth() / .enforce_auth(true) to
      exercise WS-Security) and support inject_fault(...) for error-path tests.
    • axum / serde are optional deps enabled only by these features — the
      default build is unchanged and axum-free.
    • The examples/mock_server binary is now a thin wrapper over MockServer
      with TOML file persistence (--features mock-server); the mock engine moved
      from examples/ into src/mock/. New tests/mock_workflow.rs drives one
      command from every service against a real MockServer.
  • OnvifSession::subscribe — delegates the WS-BaseNotification push
    subscription that was previously only on OnvifClient.
  • OsdOptions::max_per_text_type. New HashMap<String, u32>
    exposing the per-text-type quotas (Plain, Date, Time,
    DateAndTime) some cameras advertise via XML attributes on
    <MaximumNumberOfOSDs> (Genetec, recent Hikvision). Lets clients
    pre-validate CreateOSD calls against per-type limits instead of
    parsing opaque ter:InvalidArgs fault strings after the fact.
    Populated only when fetched via OnvifSession::get_osd_options
    OnvifClient::get_osd_options leaves it empty (spec-strict).
  • OnvifSession::get_osd_options now layers vendor-extension
    parsing
    on top of the spec-strict OnvifClient result. Two
    real-world shapes handled:
    • <MaximumNumberOfOSDs Total="8" Plain="7" DateAndTime="1" .../>
      — count from Total attribute when element body is empty, plus
      per-type quotas from named attributes.
    • <PositionOption>UpperLeft</PositionOption> flat siblings, when
      the textbook nested-<Type> shape produces nothing.