diff --git a/libonvif/CMakeLists.txt b/libonvif/CMakeLists.txt index 0549f0d9..f09a87bd 100644 --- a/libonvif/CMakeLists.txt +++ b/libonvif/CMakeLists.txt @@ -21,7 +21,7 @@ cmake_minimum_required(VERSION 3.17) -project(libonvif VERSION 3.2.1) +project(libonvif VERSION 3.2.2) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) diff --git a/libonvif/include/onvif_data.h b/libonvif/include/onvif_data.h index 1670f71e..2af40f4b 100644 --- a/libonvif/include/onvif_data.h +++ b/libonvif/include/onvif_data.h @@ -45,6 +45,7 @@ class Data std::function setSetting = nullptr; std::function getSetting = nullptr; std::function getProxyURI; + std::function errorCallback = nullptr; OnvifData* data; bool cancelled = false; @@ -450,7 +451,7 @@ class Data thread.detach(); } - void manual_fill() +void manual_fill() { bool first_pass = true; int count = 0; @@ -458,7 +459,6 @@ class Data *this = getCredential(*this); if (!cancelled) { - getCapabilities(data); if (!getTimeOffset(data)) { time_t rawtime; struct tm timeinfo; @@ -468,10 +468,17 @@ class Data #else localtime_r(&rawtime, &timeinfo); #endif - if (timeinfo.tm_isdst) + if (timeinfo.tm_isdst && !dst()) setTimeOffset(time_offset() - 3600); } + if (getCapabilities(data) < 0) { + std::stringstream str; + str << "Camera get capabilities error " << alias << " : " << xaddrs() << " : " << last_error(); + if (errorCallback) errorCallback(str.str()); + break; + } + if (getDeviceInformation(data) == 0) { int index = 0; while (true) { diff --git a/libonvif/include/session.h b/libonvif/include/session.h index aad4361a..e15362ba 100644 --- a/libonvif/include/session.h +++ b/libonvif/include/session.h @@ -76,7 +76,6 @@ class Session data = getCredential(data); if (!data.cancelled) { - getCapabilities(data); if (!getTimeOffset(data)) { time_t rawtime; struct tm timeinfo; @@ -89,6 +88,7 @@ class Session if (timeinfo.tm_isdst && !data.dst()) data.setTimeOffset(data.time_offset() - 3600); } + getCapabilities(data); if (getDeviceInformation(data) == 0) { int index = 0; diff --git a/libonvif/pyproject.toml b/libonvif/pyproject.toml index bf0eb76d..2f6cf9b4 100644 --- a/libonvif/pyproject.toml +++ b/libonvif/pyproject.toml @@ -25,7 +25,7 @@ build-backend = "setuptools.build_meta" [project] name = "libonvif" -version = "3.2.1" +version = "3.2.2" authors = [ { name="Stephen Rhodes", email="sr99622@gmail.com" }, ] diff --git a/libonvif/setup.py b/libonvif/setup.py index 893aa8ef..1354b0d6 100644 --- a/libonvif/setup.py +++ b/libonvif/setup.py @@ -28,7 +28,7 @@ from setuptools.command.build_ext import build_ext PKG_NAME = "libonvif" -VERSION = "3.2.1" +VERSION = "3.2.2" class CMakeExtension(Extension): def __init__(self, name, sourcedir=""): diff --git a/libonvif/src/onvif.cpp b/libonvif/src/onvif.cpp index 1c90475f..5e2191c2 100644 --- a/libonvif/src/onvif.cpp +++ b/libonvif/src/onvif.cpp @@ -177,6 +177,7 @@ PYBIND11_MODULE(libonvif, m) .def_readwrite("getSetting", &Data::getSetting) .def_readwrite("setSetting", &Data::setSetting) .def_readwrite("getProxyURI", &Data::getProxyURI) + .def_readwrite("errorCallback", &Data::errorCallback) .def_readwrite("preset", &Data::preset) .def_readwrite("x", &Data::x) .def_readwrite("y", &Data::y) diff --git a/onvif-gui/gui/main.py b/onvif-gui/gui/main.py index b1a3bbc3..9c5cecc8 100644 --- a/onvif-gui/gui/main.py +++ b/onvif-gui/gui/main.py @@ -51,7 +51,7 @@ import avio import liblivemedia -VERSION = "2.2.8" +VERSION = "2.2.9" class TimerSignals(QObject): timeoutPlayer = pyqtSignal(str) @@ -423,7 +423,8 @@ def closeEvent(self, event): def mediaPlayingStarted(self, uri): if self.isCameraStreamURI(uri): - logger.debug(f'camera stream opened {self.getCameraName(uri)} : {uri}') + #logger.debug(f'camera stream opened {self.getCameraName(uri)} : {uri}') + logger.debug(f'camera stream opened {self.getCameraName(uri)}') if self.pm.auto_start_mode: finished = True diff --git a/onvif-gui/gui/panels/camerapanel.py b/onvif-gui/gui/panels/camerapanel.py index 2c9b90f1..252cd8bf 100644 --- a/onvif-gui/gui/panels/camerapanel.py +++ b/onvif-gui/gui/panels/camerapanel.py @@ -290,11 +290,13 @@ def btnDiscoverClicked(self): self.cached_serial_numbers.append(serial_number) key = f'{serial_number}/XAddrs' xaddrs = self.mw.settings.value(key) + alias = self.mw.settings.value(f'{serial_number}/Alias') data = onvif.Data() data.getData = self.getData data.getCredential = self.getCredential data.setXAddrs(xaddrs) - data.setDeviceService(xaddrs) + data.setDeviceService("POST /onvif/device_service HTTP/1.1\n") + data.alias = alias self.fillers.append(data) data.startManualFill() diff --git a/onvif-gui/gui/panels/options/discover.py b/onvif-gui/gui/panels/options/discover.py index c81a7c4f..1c978a93 100644 --- a/onvif-gui/gui/panels/options/discover.py +++ b/onvif-gui/gui/panels/options/discover.py @@ -160,7 +160,7 @@ def btnAddCameraClicked(self): data.getData = self.mw.cameraPanel.getData data.getCredential = self.mw.cameraPanel.getCredential data.setXAddrs(xaddrs) - data.setDeviceService(xaddrs) + data.setDeviceService("POST /onvif/device_service HTTP/1.1\n") data.manual_fill() def autoDiscoverChecked(self, state): diff --git a/onvif-gui/pyproject.toml b/onvif-gui/pyproject.toml index 470ac6f8..0668782a 100644 --- a/onvif-gui/pyproject.toml +++ b/onvif-gui/pyproject.toml @@ -19,7 +19,7 @@ [project] name = "onvif-gui" -version = "2.2.8" +version = "2.2.9" dynamic = ["gui-scripts"] description = "A client gui for Onvif" readme = "README.md" @@ -38,7 +38,7 @@ classifiers = [ ] dependencies = [ - 'libonvif==3.2.1', 'avio==3.2.1', 'liblivemedia==1.0.3', 'numpy', 'loguru', + 'libonvif==3.2.2', 'avio==3.2.1', 'liblivemedia==1.0.3', 'numpy', 'loguru', 'opencv-python', 'PyQt6-Qt6', 'pyqt6' ] diff --git a/onvif-gui/setup.py b/onvif-gui/setup.py index 7dda8fa7..5a4d44eb 100644 --- a/onvif-gui/setup.py +++ b/onvif-gui/setup.py @@ -24,7 +24,7 @@ setup( name="onvif-gui", - version="2.2.8", + version="2.2.9", author="Stephen Rhodes", author_email="sr99622@gmail.com", description="GUI program for onvif",