From 6502f7ccb1240814f29bac09a4ce745d95990941 Mon Sep 17 00:00:00 2001 From: Chris D Date: Sat, 21 Oct 2023 10:38:23 -0400 Subject: [PATCH] 'depencency bump, Media2 - DeleteProfile' --- CHANGELOG.md | 6 ++++++ README.md | 2 +- lib/meta.dart | 6 +++--- lib/src/cmd/onvif_probe_command.dart | 2 +- lib/src/media2.dart | 16 ++++++++++++++++ lib/src/soap/media2.dart | 12 ++++++++++++ pubspec.yaml | 10 +++++----- 7 files changed, 44 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb23665..f8d34fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 2.1.3+2 + +* depencency bump +* Media2 + * DeleteProfile + ## 2.1.3+1 * workaround for [#53477](https://github.com/flutter/flutter/issues/53477) diff --git a/README.md b/README.md index 2bdcaea..262e94b 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ To use this package in your code, first add the dependency to your project: ```yml dependencies: ... - easy_onvif: ^2.1.3+1 + easy_onvif: ^2.1.3+2 ``` If you need additional help getting started with dart, check out these [guides](https://dart.dev/guides). diff --git a/lib/meta.dart b/lib/meta.dart index 1e50b11..89b5988 100644 --- a/lib/meta.dart +++ b/lib/meta.dart @@ -1,6 +1,6 @@ -/// DO NOT EDIT THIS FILE -/// THIS FILE IS AUTOMATICALLY OVER WRITTEN BY PublishTools +// DO NOT EDIT THIS FILE +// THIS FILE IS AUTOMATICALLY OVER WRITTEN BY PublishTools import 'dart:convert' show json; final pubSpec = json.decode( - '{"name":"easy_onvif","version":"2.1.3+1","homepage":"https://github.com/faithoflifedev/easy_onvif","environment":{"sdk":">=3.0.0 <4.0.0"},"description":"A pure Dart library designed primarily for command line automation of Onvif compatible devices, but can be used anywhere Dart is used.","dependencies":{"args":"^2.4.2","crypto":"^3.0.3","dio":"^5.3.3","ffi":"^2.1.0","html_unescape":"^2.0.0","intl":"^0.18.1","json_annotation":"^4.8.1","loggy":"^2.0.3","path":"^1.8.3","shelf":"^1.4.1","shelf_router":"^1.1.4","sprintf":"^7.0.0","universal_io":"^2.2.2","uuid":"^3.0.7","xml":"^6.3.0","xml2json":"^6.2.0","yaml":"^3.1.2"},"dev_dependencies":{"build_runner":"^2.4.5","grinder":"^0.9.4","json_serializable":"^6.7.1","lints":"^2.1.1","mustache_template":"^2.0.0","process_run":"^0.13.0","pub_semver":"^2.1.4","publish_tools":"^0.1.0+10","pubspec":"^2.3.0","test":"^1.24.3"},"executables":{"onvif":""},"repository":"https://github.com/faithoflifedev/easy_onvif.git"}'); + '{"name":"easy_onvif","version":"2.1.3+2","homepage":"https://github.com/faithoflifedev/easy_onvif","environment":{"sdk":">=3.0.0 <4.0.0"},"description":"A pure Dart library designed primarily for command line automation of Onvif compatible devices, but can be used anywhere Dart is used.","dependencies":{"args":"^2.4.2","crypto":"^3.0.3","dio":"^5.3.3","ffi":"^2.1.0","html_unescape":"^2.0.0","intl":"^0.18.1","json_annotation":"^4.8.1","loggy":"^2.0.3","path":"^1.8.3","shelf":"^1.4.1","shelf_router":"^1.1.4","sprintf":"^7.0.0","universal_io":"^2.2.2","uuid":"^4.1.0","xml":"^6.3.0","xml2json":"^6.2.0","yaml":"^3.1.2"},"dev_dependencies":{"build_runner":"^2.4.5","grinder":"^0.9.4","json_serializable":"^6.7.1","lints":"^3.0.0","mustache_template":"^2.0.0","process_run":"^0.13.0","pub_semver":"^2.1.4","publish_tools":"^0.1.0+12","pubspec":"^2.3.0","test":"^1.24.8"},"executables":{"onvif":""},"repository":"https://github.com/faithoflifedev/easy_onvif.git"}'); diff --git a/lib/src/cmd/onvif_probe_command.dart b/lib/src/cmd/onvif_probe_command.dart index 648ee86..507506e 100644 --- a/lib/src/cmd/onvif_probe_command.dart +++ b/lib/src/cmd/onvif_probe_command.dart @@ -50,7 +50,7 @@ class DevicesController { headers: {'Content-type': 'application/json'}, )); - return router; + return router.call; } } diff --git a/lib/src/media2.dart b/lib/src/media2.dart index 09467f2..e78e2bb 100644 --- a/lib/src/media2.dart +++ b/lib/src/media2.dart @@ -12,6 +12,22 @@ class Media2 with UiLoggy { required this.uri, }); + Future deleteProfile(String referenceToken) async { + loggy.debug('deleteProfile'); + + final envelope = await transport.sendRequest( + uri, + transport + .securedEnvelope(soap.Media2Request.deleteProfile(referenceToken))); + + if (envelope.body.hasFault) { + throw Exception(envelope.body.fault.toString()); + } + + return envelope.body.response?.containsKey('DeleteProfileResponse') ?? + false; + } + Future getMetadataConfigurationOptions({ String? configurationToken, String? profileToken, diff --git a/lib/src/soap/media2.dart b/lib/src/soap/media2.dart index 54944f9..c1d4e65 100644 --- a/lib/src/soap/media2.dart +++ b/lib/src/soap/media2.dart @@ -5,6 +5,18 @@ import 'transport.dart'; import 'xmlns.dart'; class Media2Request { + /// XML for the [deleteProfile] + static XmlDocumentFragment deleteProfile(String referenceToken) { + Transport.builder.element('DeleteProfile', nest: () { + Transport.builder.namespace(Xmlns.tr2); + Transport.builder.element('ReferenceToken', nest: () { + Transport.builder.text(referenceToken); + }); + }); + + return Transport.builder.buildFragment(); + } + /// XML for the [getMetadataConfigurationOptions] static XmlDocumentFragment getMetadataConfigurationOptions( {String? configurationToken, String? profileToken}) => diff --git a/pubspec.yaml b/pubspec.yaml index 3914181..ad27022 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: easy_onvif -version: 2.1.3+1 +version: 2.1.3+2 homepage: https://github.com/faithoflifedev/easy_onvif description: A pure Dart library designed primarily for command line automation of Onvif compatible devices, but can be used anywhere Dart is used. repository: https://github.com/faithoflifedev/easy_onvif.git @@ -20,7 +20,7 @@ dependencies: shelf_router: ^1.1.4 sprintf: ^7.0.0 universal_io: ^2.2.2 - uuid: ^3.0.7 + uuid: ^4.1.0 xml: ^6.3.0 xml2json: ^6.2.0 yaml: ^3.1.2 @@ -28,12 +28,12 @@ dev_dependencies: build_runner: ^2.4.5 grinder: ^0.9.4 json_serializable: ^6.7.1 - lints: ^2.1.1 + lints: ^3.0.0 mustache_template: ^2.0.0 process_run: ^0.13.0 pub_semver: ^2.1.4 - publish_tools: ^0.1.0+10 + publish_tools: ^0.1.0+12 pubspec: ^2.3.0 - test: ^1.24.3 + test: ^1.24.8 executables: onvif: