easy_onvif 0.0.6
easy_onvif: ^0.0.6 copied to clipboard

A pure Dart library designed primarily for command line automation of Onvif compatible devices, but can be used anywhere Dart is used.

ONVIF Client protocol Profile S (Live Streaming) Dart implementation.

This is a wrapper to ONVIF protocol which allows you to get information about your NVT (network video transmitter) device, its media sources, control PTZ (pan-tilt-zoom) movements and manage presets. It will also allow you to get information about your NVR (network video recorder).

pub package Build Status

Getting Started #

In your project add the dependency:

dependencies:
  ...
  easy_onvif: ^0.0.6

For help getting started with dart, check out these guides.

Usage Example #

Import the easy_onvif library.

import 'package:easy_onvif/onvif.dart';

Connecting to an Onvif device #

var onvif =
	Onvif(host: '[your onvif device ip]', username: '[theUser]', password: '[thePassword]');

await onvif.initialize();

Interacting with the device through Onvif operations #

Refer to the tables below for the supported operations.

Through the deviceManagement operations you can get information about the connected device.

var deviceInfo = await onvif.deviceManagement.getDeviceInformation();

print(deviceInfo.model);

Many operations require you to supply a profileToken which can be retrieved through media operations.

var profiles = await onvif.media.getProfiles();

profiles.forEach((element) {
	print(element.name + ' ' + element.token);
});

var profileToken = profiles[0].token;

With the ptz operations you can get a list of camera presets from the connected device.

var presets = await onvif.ptz.getPresets(profileToken);

//get a specific preset
var preset = presets[11];

//print the preset values
print(
	'preset: ${preset.position.panTilt?.x}  ${preset.position.panTilt?.y}  ${preset.position.zoom?.x}');

//use the GotoPreset operation to point the camera to the given preset
await onvif.ptz.gotoPreset(profileToken, preset);

Be sure to look through the API Reference for information about the parameters required for the supported Onvif operations.

Supported Onvif Operations #

Device Management: #

Onvif OperationDart MethodDart Return Type
GetCapabilitiesgetCapabilitiesFuture<Capabilities>
GetDeviceInformationgetDeviceInformationFuture<GetDeviceInformationResponse>
GetHostnamegetHostnameFuture<HostnameInformation>
GetNetworkProtocolsgetNetworkProtocolsFuture<List<NetworkProtocol>>
GetNtpResponsegetNtpResponseFuture<NtpInformation>
GetServicesgetServicesFuture<List<Service>>
GetSystemDateAndTimegetSystemDateAndTimeFuture<SystemDateAndTime>
GetSystemUrisgetSystemUrisFuture<GetSystemUrisResponse>
GetUsersgetUsersFuture<List<User>>

Media: #

Onvif OperationDart MethodReturn Type
GetAudioSourcesgetAudioSourcesFuture<AudioSource>
GetProfilesgetProfilesFuture<List<Profile>>
GetSnapshotUrigetSnapshotUriFuture<MediaUri>
GetStreamUrigetStreamUriFuture<MediaUri>
GetVideoSourcesgetVideoSourcesFuture<VideoSources>
StartMulticastStreamingstartMulticastStreamingFuture<void>
StopMulticastStreamingstopMulticastStreamingFuture<void>

PTZ: #

Onvif OperationDart MethodReturn Type
AbsoluteMoveabsoluteMoveFuture<void>
ContinuousMovecontinuousMoveFuture<void>
GetPresetsgetPresetsFuture<List<Preset>>
GetStatusgetStatusFuture<PtzStatus>
GotoPresetgotoPresetFuture<void>
RelativeMoverelativeMoveFuture<void>
RemovePresetremovePresetFuture<void>
SetPresetsetPresetFuture<String>
StopstopFuture<void>

PTZ Helper Methods: #

Onvif OperationDart MethodReturn Type
N/AmoveDownFuture<void>
N/AmoveLeftFuture<void>
N/AmoveRightFuture<void>
N/AmoveUpFuture<void>
N/AzoomInFuture<void>
N/AzoomOutFuture<void>

What's next #

Device discovery is planned for the 1.x release of the library.

2
likes
130
pub points
9%
popularity

Publisher

Unknown

A pure Dart library designed primarily for command line automation of Onvif compatible devices, but can be used anywhere Dart is used.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

crypto, dio, easy_enum, json_annotation, universal_io, uuid, xml, xml2json, yaml

More

Packages that depend on easy_onvif