easy_onvif 1.0.0-dev.2 copy "easy_onvif: ^1.0.0-dev.2" to clipboard
easy_onvif: ^1.0.0-dev.2 copied to clipboard

outdated

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

example/example.dart

import 'package:easy_onvif/onvif.dart';
import 'package:universal_io/io.dart';
import 'package:yaml/yaml.dart';

void main(List<String> arguments) async {
  //get connection infomration from the config.yaml file
  final config = loadYaml(File('example/config.yaml').readAsStringSync());

  //configure device connection
  final onvif = await Onvif.connect(
      host: config['host'],
      username: config['username'],
      password: config['password']);

  //get service capabilities
  var deviceServiceCapabilities =
      await onvif.deviceManagement.getServiceCapabilities();

  print(
      'max password length: ${deviceServiceCapabilities.security.maxPasswordLength}');

  //get service addresses
  var serviceList = await onvif.deviceManagement.getServices();

  for (Service service in serviceList) {
    print('${service.nameSpace} ${service.xAddr}');
  }

  //get device info
  var deviceInfo = await onvif.deviceManagement.getDeviceInformation();

  print('Model: ${deviceInfo.model}');

  var ptzConfigs = await onvif.ptz.getConfigurations();

  for (var ptzConfiguration in ptzConfigs) {
    print(ptzConfiguration.name + ' ' + ptzConfiguration.token);
  }

  print('xMax: ${ptzConfigs[0].panTiltLimits!.range.xRange.max}');
  print('xMin: ${ptzConfigs[0].panTiltLimits!.range.xRange.min}');
  print('yMax: ${ptzConfigs[0].panTiltLimits!.range.yRange.max}');
  print('yMin: ${ptzConfigs[0].panTiltLimits!.range.yRange.min}');

  // get device profiles
  var profs = await onvif.media.getProfiles();

  for (var profile in profs) {
    print('name: ${profile.name}, token: ${profile.token}');
  }

  final uri = await onvif.media.getStreamUri(profs[2].token);

  final rtsp = OnvifUtil.authenticatingUri(
      uri.uri, config['username'], config['password']);

  print('stream uri: $rtsp');

  var ntpInformation = await onvif.deviceManagement.getNtp();

  print(ntpInformation);
}
23
likes
0
pub points
85%
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