Skip to content

Commit

Permalink
fix manual add camera login
Browse files Browse the repository at this point in the history
  • Loading branch information
sr99622 committed Oct 4, 2024
1 parent 729bb63 commit dc16d9e
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 14 deletions.
2 changes: 1 addition & 1 deletion libonvif/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 10 additions & 3 deletions libonvif/include/onvif_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Data
std::function<void(const std::string&, const std::string&)> setSetting = nullptr;
std::function<const std::string(const std::string& key, const std::string& default_value)> getSetting = nullptr;
std::function<const std::string(const std::string&)> getProxyURI;
std::function<void(const std::string&)> errorCallback = nullptr;

OnvifData* data;
bool cancelled = false;
Expand Down Expand Up @@ -450,15 +451,14 @@ class Data
thread.detach();
}

void manual_fill()
void manual_fill()
{
bool first_pass = true;
int count = 0;
while (true) {
*this = getCredential(*this);
if (!cancelled) {

getCapabilities(data);
if (!getTimeOffset(data)) {
time_t rawtime;
struct tm timeinfo;
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion libonvif/include/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ class Session
data = getCredential(data);
if (!data.cancelled) {

getCapabilities(data);
if (!getTimeOffset(data)) {
time_t rawtime;
struct tm timeinfo;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion libonvif/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]" },
]
Expand Down
2 changes: 1 addition & 1 deletion libonvif/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=""):
Expand Down
1 change: 1 addition & 0 deletions libonvif/src/onvif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions onvif-gui/gui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
import avio
import liblivemedia

VERSION = "2.2.8"
VERSION = "2.2.9"

class TimerSignals(QObject):
timeoutPlayer = pyqtSignal(str)
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion onvif-gui/gui/panels/camerapanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion onvif-gui/gui/panels/options/discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions onvif-gui/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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'
]

Expand Down
2 changes: 1 addition & 1 deletion onvif-gui/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

setup(
name="onvif-gui",
version="2.2.8",
version="2.2.9",
author="Stephen Rhodes",
author_email="[email protected]",
description="GUI program for onvif",
Expand Down

0 comments on commit dc16d9e

Please sign in to comment.