Previous Topic

Next Topic

Book Contents

Book Index

Concepts and Tasks

Creating New ONVIF Device Objects

To create new instances of ONVIF device objects, e.g. a camera, your Java application first needs to obtain the provided OSGI service com.prosyst.mbs.services.onvif.OnvifFactory. As a next step, invoke the service method "login" using the IP address and login credentials of the specific ONVIF camera device.

Obtaining ONVIF Services

ONVIF Services can be obtained in two different ways - either by invoking the method getServices() or the method getService(Class<C> type)and providing the service class name as a parameter.

Device Management and Network Configuration

Device management and network configuration can be accessed through the DeviceService which can be obtained by invoking the method OnvifDevice.getService(DeviceService.class).

Media Configuration

Video stream configuration and image and video streaming can be accessed through the MediaService.

Getting Image Snapshots

To receive an image snapshot from the camera follow these steps:

  1. get MediaService instance by invoking OnvifDevice.getService(MediaService);
  2. get supported media profiles from MediaService.getProfiles()
  3. get MediaSubService by invoking MediaService.getSubService(String profileToken)
  4. invoke the method getSnapshotUri of MediaSubService – it will return a URL (typically HTTP URL) with the content of the snapshot image taken at the same moment
  5. save to a file the content from the URL or open it in a web browser

Getting Video Stream

spacer-1x8To receive Video Stream as a URL, call the method getStreamUri of MediaSubService.

Pan-Tilt-Zoom Configuration

PtzService allows configuring the Pan-Tilt-Zoom camera functionality. Pan-Tilt-Zoom functions if supported by the camera can be invoked using the PtzSubService which is obtained from the PtzService.getSubService() method.

Motion Alarm Events

Motion Alarm events can be received by registering the OSGi EventHandler service with topic com.prosyst.mbs.services.onvif.EventConstants.TOPIC_NOTIFICATION

The received event of a typical ONVIF motion alarm will have the following properties