aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormorefigs <morefigs@gmail.com>2019-03-09 11:45:39 +1100
committermorefigs <morefigs@gmail.com>2019-03-09 11:45:39 +1100
commit6ee63831f3c0ed991fc9b617c1697ef91bc7100d (patch)
treef399abebd520e4766229afebf9b92ba303195f26
parentbf764e872a4e4abea8d28e4c49b88b64f0bcdaaf (diff)
downloadpymba-6ee63831f3c0ed991fc9b617c1697ef91bc7100d.tar.gz
pymba-6ee63831f3c0ed991fc9b617c1697ef91bc7100d.zip
Bug fix where USB cameras attempt to set packet size
-rw-r--r--pymba/camera.py9
-rw-r--r--pymba/interface.py4
-rw-r--r--pymba/system.py4
-rw-r--r--pymba/vimba.py8
-rw-r--r--pymba/vimba_object.py4
5 files changed, 15 insertions, 14 deletions
diff --git a/pymba/camera.py b/pymba/camera.py
index 5a8b75b..45d769e 100644
--- a/pymba/camera.py
+++ b/pymba/camera.py
@@ -88,10 +88,9 @@ class Camera(VimbaObject):
"""
A Vimba camera object.
"""
-
- def __init__(self, camera_id: str):
+ def __init__(self, vimba, camera_id: str):
self._camera_id = camera_id
- super().__init__()
+ super().__init__(vimba)
# remember state
self._is_armed = False
@@ -131,8 +130,8 @@ class Camera(VimbaObject):
if error:
raise VimbaException(error)
- # may experience issues with camera comms if not called
- if adjust_packet_size:
+ # may experience issues with ethernet commands if not called
+ if adjust_packet_size and self._vimba.system().GeVTLIsPresent:
self.GVSPAdjustPacketSize()
def close(self):
diff --git a/pymba/interface.py b/pymba/interface.py
index fdd4675..c66eb3d 100644
--- a/pymba/interface.py
+++ b/pymba/interface.py
@@ -57,11 +57,11 @@ class Interface(VimbaObject):
to Vimba functions required to control the interface.
"""
- def __init__(self, interface_id: str):
+ def __init__(self, vimba, interface_id: str):
if interface_id not in interface_ids():
raise VimbaException(VimbaException.ERR_INSTANCE_NOT_FOUND)
self._interface_id = interface_id
- super().__init__()
+ super().__init__(vimba)
@property
def interface_id(self):
diff --git a/pymba/system.py b/pymba/system.py
index 2cc6870..cc1d799 100644
--- a/pymba/system.py
+++ b/pymba/system.py
@@ -5,5 +5,5 @@ class System(VimbaObject):
"""
A Vimba system object. This class provides the minimal access to Vimba functions required to control the system.
"""
- def __init__(self):
- super().__init__(handle=1)
+ def __init__(self, vimba):
+ super().__init__(vimba, handle=1)
diff --git a/pymba/vimba.py b/pymba/vimba.py
index 1079b12..37584a5 100644
--- a/pymba/vimba.py
+++ b/pymba/vimba.py
@@ -29,7 +29,7 @@ class Vimba:
def __init__(self):
# create own system singleton object
- self._system = System()
+ self._system = System(self)
self._interfaces = {}
self._cameras = {}
@@ -40,7 +40,7 @@ class Vimba:
self.startup()
return self
- def __exit__(self, type, value, traceback):
+ def __exit__(self, type_, value, traceback):
"""
Shutdown Vimba when the with context is left. This allows cleanup
when an error occurs in the main program. The system will not hang
@@ -91,7 +91,7 @@ class Vimba:
return self._interfaces[interface_id]
# cache interface instances
- interface = Interface(interface_id)
+ interface = Interface(self, interface_id)
self._interfaces[interface_id] = interface
return interface
@@ -114,7 +114,7 @@ class Vimba:
return self._cameras[camera_id]
# cache camera instance
- camera = Camera(camera_id)
+ camera = Camera(self, camera_id)
self._cameras[camera_id] = camera
return camera
diff --git a/pymba/vimba_object.py b/pymba/vimba_object.py
index fbc6b05..58657f8 100644
--- a/pymba/vimba_object.py
+++ b/pymba/vimba_object.py
@@ -18,8 +18,10 @@ class VimbaObject:
VMB_ACCESS_MODE_CONFIG = 4
VMB_ACCESS_MODE_LITE = 8
- def __init__(self, handle: Optional[int] = None):
+ def __init__(self, vimba, handle: Optional[int] = None):
+ self._vimba = vimba
self._handle = c_void_p(handle)
+
self._features = {}
def __getattr__(self, item: str):