aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormorefigs <morefigs@gmail.com>2019-01-22 16:13:37 +1100
committermorefigs <morefigs@gmail.com>2019-01-22 16:13:37 +1100
commit81c5d5eea267cd35517bae1ed50d4bdeb8b3a62c (patch)
treea5eb1b4aee6471db4cd0c34ac8e87841648391f9
parenta96013435f3239e2780ee01173666dc004103d12 (diff)
downloadpymba-81c5d5eea267cd35517bae1ed50d4bdeb8b3a62c.tar.gz
pymba-81c5d5eea267cd35517bae1ed50d4bdeb8b3a62c.zip
clean up interface class
-rw-r--r--pymba/vimba_interface.py44
1 files changed, 17 insertions, 27 deletions
diff --git a/pymba/vimba_interface.py b/pymba/vimba_interface.py
index df5acdc..b2b8890 100644
--- a/pymba/vimba_interface.py
+++ b/pymba/vimba_interface.py
@@ -1,47 +1,37 @@
-# -*- coding: utf-8 -*-
-from __future__ import absolute_import
-from . import vimba_structure as structs
+from ctypes import byref
+
from .vimba_object import VimbaObject
from .vimba_exception import VimbaException
-from .vimba_dll import VimbaDLL
-from ctypes import *
-
-# interface features are automatically readable as object attributes.
+from . import vimba_c
class VimbaInterface(VimbaObject):
-
"""
A Vimba interface object. This class provides the minimal access
to Vimba functions required to control the interface.
"""
- @property
- def interfaceIdString(self):
- return self._interfaceIdString
+ def __init__(self, id_string: str):
+ self._id_string = id_string
+ super().__init__()
- # own handle is inherited as self._handle
- def __init__(self, interfaceIdString):
-
- # call super constructor
- super(VimbaInterface, self).__init__()
-
- # set ID
- self._interfaceIdString = interfaceIdString
+ @property
+ def id_string(self):
+ return self._id_string
- def openInterface(self):
+ def open(self):
"""
Open the interface.
"""
- errorCode = VimbaDLL.interfaceOpen(self._interfaceIdString,
+ error = vimba_c.vmb_interface_open(self._id_string,
byref(self._handle))
- if errorCode != 0:
- raise VimbaException(errorCode)
+ if error:
+ raise VimbaException(error)
- def closeInterface(self):
+ def close(self):
"""
Close the interface.
"""
- errorCode = VimbaDLL.interfaceClose(self._handle)
- if errorCode != 0:
- raise VimbaException(errorCode)
+ error = vimba_c.vmb_interface_close(self._handle)
+ if error:
+ raise VimbaException(error)