ExOxvif.Events (ex_oxvif v0.1.0)

Copy Markdown View Source

Events service: pull-point subscriptions.

{:ok, sub} = ExOxvif.Events.create_pull_point(session, termination: 60_000)
{:ok, messages} = ExOxvif.Events.pull_messages(session, sub, wait: 5_000)

Durations are given in milliseconds and sent to the device as ISO 8601 durations. A subscription expires unless renewed with renew/3.

Summary

Functions

Create a pull-point subscription.

Pull pending messages, waiting on the device for up to :wait milliseconds (default 5000) for at least one.

Extend a subscription to termination milliseconds from now. Returns the new termination time reported by the device.

Functions

create_pull_point(session, opts \\ [])

@spec create_pull_point(ExOxvif.Session.t(), keyword()) ::
  {:ok, ExOxvif.Events.Subscription.t()} | {:error, ExOxvif.Error.t()}

Create a pull-point subscription.

Options:

  • :filter - a topic expression, e.g. "tns1:VideoSource/MotionAlarm"
  • :termination - initial lifetime in milliseconds (device default if omitted)

pull_messages(session, subscription, opts \\ [])

@spec pull_messages(
  ExOxvif.Session.t(),
  ExOxvif.Events.Subscription.t() | String.t(),
  keyword()
) ::
  {:ok, [ExOxvif.Events.Message.t()]} | {:error, ExOxvif.Error.t()}

Pull pending messages, waiting on the device for up to :wait milliseconds (default 5000) for at least one.

Options: :wait, :max_messages (default 100). The call :timeout defaults to :wait plus 15 seconds.

renew(session, subscription, termination, opts \\ [])

Extend a subscription to termination milliseconds from now. Returns the new termination time reported by the device.

unsubscribe(session, subscription, opts \\ [])

@spec unsubscribe(
  ExOxvif.Session.t(),
  ExOxvif.Events.Subscription.t() | String.t(),
  ExOxvif.call_opts()
) :: :ok | {:error, ExOxvif.Error.t()}

Cancel a subscription.