Skip to content

Commit dceb8a1

Browse files
author
Marko Kaikkonen
committed
Created class variable use_services_template to deny or allow use of service_template.
Multiple camera pullpoint services doesn't work if using templates eg with events service.
1 parent 7af1321 commit dceb8a1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

onvif/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ class ONVIFCamera(object):
205205
# Class-level variables
206206
services_template = {'devicemgmt': None, 'ptz': None, 'media': None,
207207
'imaging': None, 'events': None, 'analytics': None }
208+
use_services_template = {'devicemgmt': True, 'ptz': True, 'media': True,
209+
'imaging': True, 'events': True, 'analytics': True }
208210
def __init__(self, host, port ,user, passwd, wsdl_dir=os.path.join(os.path.dirname(os.path.dirname(__file__)), "wsdl"),
209211
cache_location=None, cache_duration=None,
210212
encrypt=True, daemon=False, no_cache=False):
@@ -327,7 +329,7 @@ def create_onvif_service(self, name, from_template=True, portType=None):
327329
with self.services_lock:
328330
svt = self.services_template.get(name)
329331
# Has a template, clone from it. Faster.
330-
if svt and from_template:
332+
if svt and from_template and self.use_services_template.get(name):
331333
service = ONVIFService.clone(svt, xaddr, self.user,
332334
self.passwd, wsdl_file,
333335
self.cache_location,

0 commit comments

Comments
 (0)