Ozeki Camera Recorder Stat

How to subscribe for camera events in C#

This article demonstrates how to subscribe Onvif camera events in C# This is useful if you would like to be informed about what events are happening on the camera side.

Onvif eventing

The ONVIF specification includes three different types of event notifications:

  • Real-time Pull-Point Notification Interface
  • Basic Notification Interface (WS-BaseNotification)
  • Notification Streaming Interface (metadata streaming)

The next parts describe the GetEventProperties action, which will inform you about which notifications a device supports and what information they contain. We will learn how to set up the subscriptions for the methods above, and how the Notification Message is processed.

GetEventProperties

The WS-BaseNotification specification defines a set of optional WS-ResouceProperties. This specification does not require the implementation of the WS-ResourceProperty interface. Instead, the subsequent direct interface shall be implemented by an ONVIF compliant device in order to provide information about the FilterDialects, Schema files and topics supported by the device.
The GetEventProperties action returns the various event topics that the device supports. The prerequisites are a device must be discovered and the service URIs must be known.

CreatePullPointSubscription

This method returns a PullPointSubscription that can be polled using PullMessages. This message contains the same elements as the SubscriptionRequest of the WS-BaseNotification without the ConsumerReference.

PullPoint subscription is used when a client wants to fetch event notifications from a service. This is an ONVIF extension to the standard WS-BaseNotification mechanisms. First, a subscription is created and a subscriptionReference is returned, which is used in PullMessages requests to fetch the actual event notifications. If no notifications are available, the response is delayed. The prerequisites are the following: a device that must be discovered and the service URIs must be known.

How to set up PullPointSubscription
Figure 1 - Setting Up PullPoint Subscription

WS-BaseNotification

A subscription is set up and the notification handling service connects to the specified URL and sends the Notification message. The producer initiates the connection where the Notification is sent through. The consumer and the entity which sets up the subscription don't have to be the same. This process requires a device that must be discovered and the service URIs that are must be known.

Related Pages

FAQ

Below you can find the answers for the most frequently asked questions related to this topic:

  1. How can I get the URL of the camera?

    You can get the URL from the producer of the camera. (In the 10th tutorial you can find information on how to create an own IP camera discoverer program.)

  2. I moved my hand and it has not been detected. Why?

    The pixel intensity (sensitivity of movement) has a default value, but in the next chapter we will learn how to change it.