easy_onvif 1.0.4 copy "easy_onvif: ^1.0.4" to clipboard
easy_onvif: ^1.0.4 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

New for version 1.0.0 #

As of the 1.0.0 release of this package, there is a cli utility included that can be used to return data for any API call currently supported by the package. If you want to get started quicky with the cli utility run these commands in a termainal session:

pub global activate easy_onvif

onvif --help

Please see the cli documentation README.md for more detailed usage information.

Getting Started #

To use this package in your code, first add the dependency to your project:

dependencies:
  ...
  easy_onvif: ^1.0.4

If you need additional 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 #

final onvif = await Onvif.connect(
 host: [hostname or ipaddress],
 username: [username],
 password: [password]);

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 Operation Dart Method Dart Return Type
GetCapabilities getCapabilities Future<Capabilities>
GetDeviceInformation getDeviceInformation Future<GetDeviceInformationResponse>
GetHostname getHostname Future<HostnameInformation>
GetNetworkProtocols getNetworkProtocols Future<List<NetworkProtocol>>
GetNTP getNtp Future<NtpInformation>
GetServiceCapabilities getServiceCapabilities Future<DeviceServiceCapabilities>
GetServices getServices Future<List<Service>>
GetSystemDateAndTime getSystemDateAndTime Future<SystemDateAndTime>
GetSystemUris getSystemUris Future<GetSystemUrisResponse>
GetUsers getUsers Future<List<User>>

Media #

Onvif Operation Dart Method Return Type
GetAudioSources getAudioSources Future<AudioSource>
GetProfiles getProfiles Future<List<Profile>>
GetSnapshotUri getSnapshotUri Future<MediaUri>
GetStreamUri getStreamUri Future<MediaUri>
GetVideoSources getVideoSources Future<VideoSources>
StartMulticastStreaming startMulticastStreaming Future<void>
StopMulticastStreaming stopMulticastStreaming Future<void>

PTZ #

Onvif Operation Dart Method Return Type
AbsoluteMove absoluteMove Future<void>
ContinuousMove continuousMove Future<void>
GetConfiguration getConfiguration Future<PtzConfiguration>
GetConfigurations getConfigurations Future<List<PtzConfiguration>>
GetPresets getPresets Future<List<Preset>>
GetStatus getStatus Future<PtzStatus>
GotoPreset gotoPreset Future<void>
RelativeMove relativeMove Future<void>
RemovePreset removePreset Future<void>
SetPreset setPreset Future<String>
Stop stop Future<void>

PTZ Helper Methods #

Onvif Operation Dart Method Return Type
N/A move Future<void>
N/A moveDown Future<void>
N/A moveLeft Future<void>
N/A moveRight Future<void>
N/A moveUp Future<void>
N/A zoomIn Future<void>
N/A zoomOut Future<void>
N/A getCurrentPreset Future<Preset?>

What's next #

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

A test image

21
likes
0
pub points
79%
popularity

Publisher

verified publishermuayid.com

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

License

unknown (LICENSE)

Dependencies

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

More

Packages that depend on easy_onvif