-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathprosilica_help.py
35 lines (27 loc) · 1.07 KB
/
prosilica_help.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""check the installed Prosilica GigE SDK version number"""
import ctypes, sys
global _libprosilica
_libprosilica = None
ULong = ctypes.c_long # XXX should be unsigned long
def _load_libprosilica():
"""load the prosilica shared library"""
global _libprosilica
if _libprosilica is None:
if sys.platform.startswith('linux'):
_libprosilica = ctypes.cdll.LoadLibrary('libPvAPI.so')
elif sys.platform.startswith('win'):
_libprosilica = ctypes.CDLL('PvAPI.dll')
else:
raise NotImplementedError('unsupported platform')
argtype = ctypes.POINTER(ULong)
_libprosilica.PvVersion.argtypes = [argtype,argtype]
return _libprosilica
def get_prosilica_version():
"""get the version number of the prosilica shared library"""
libprosilica = _load_libprosilica()
major = ULong()
minor = ULong()
libprosilica.PvVersion(ctypes.byref(major), ctypes.byref(minor))
return major.value, minor.value
if __name__=='__main__':
print 'you have Prosilica SDK %s.%s installed'%get_prosilica_version()