commit
cb57e489ad
2 changed files with 10 additions and 1 deletions
Binary file not shown.
|
|
@ -19,7 +19,7 @@
|
||||||
# SOFTWARE.
|
# SOFTWARE.
|
||||||
|
|
||||||
import platform
|
import platform
|
||||||
from ctypes import cdll, c_void_p, c_int, c_double, POINTER, c_char
|
from ctypes import cdll, c_void_p, c_int, c_double, POINTER, c_char, c_char_p, cast
|
||||||
|
|
||||||
|
|
||||||
class QngWrapperLinux:
|
class QngWrapperLinux:
|
||||||
|
|
@ -35,10 +35,19 @@ class QngWrapperLinux:
|
||||||
self._qwqng_wrapper.RandNormal.restype = c_double
|
self._qwqng_wrapper.RandNormal.restype = c_double
|
||||||
self._qwqng_wrapper.RandBytes.argtypes = [c_void_p, c_int]
|
self._qwqng_wrapper.RandBytes.argtypes = [c_void_p, c_int]
|
||||||
self._qwqng_wrapper.RandBytes.restype = POINTER(c_char)
|
self._qwqng_wrapper.RandBytes.restype = POINTER(c_char)
|
||||||
|
self._qwqng_wrapper.DeviceID.argtypes = [c_void_p]
|
||||||
|
self._qwqng_wrapper.DeviceID.restype = POINTER(c_char)
|
||||||
self._qwqng_wrapper.Clear.argtypes = [c_void_p]
|
self._qwqng_wrapper.Clear.argtypes = [c_void_p]
|
||||||
self._qwqng_wrapper.Reset.argtypes = [c_void_p]
|
self._qwqng_wrapper.Reset.argtypes = [c_void_p]
|
||||||
self._qng_pointer = self._qwqng_wrapper.GetQwqngInstance()
|
self._qng_pointer = self._qwqng_wrapper.GetQwqngInstance()
|
||||||
|
|
||||||
|
def deviceId(self):
|
||||||
|
try:
|
||||||
|
return cast(self._qwqng_wrapper.DeviceID(self._qng_pointer), c_char_p).value.decode("utf-8")
|
||||||
|
except:
|
||||||
|
self._qwqng_wrapper.Reset(self._qng_pointer)
|
||||||
|
return cast(self._qwqng_wrapper.DeviceID(self._qng_pointer), c_char_p).value.decode("utf-8")
|
||||||
|
|
||||||
def randint32(self):
|
def randint32(self):
|
||||||
try:
|
try:
|
||||||
return self._qwqng_wrapper.RandInt32(self._qng_pointer)
|
return self._qwqng_wrapper.RandInt32(self._qng_pointer)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue