1
This commit is contained in:
@@ -5,10 +5,27 @@ import os
|
|||||||
dll_path = os.path.join(os.path.dirname(__file__), "libs", "atcore.dll")
|
dll_path = os.path.join(os.path.dirname(__file__), "libs", "atcore.dll")
|
||||||
atcore = ctypes.windll.LoadLibrary(dll_path)
|
atcore = ctypes.windll.LoadLibrary(dll_path)
|
||||||
|
|
||||||
|
# Type definitions
|
||||||
|
AT_H = ctypes.c_int
|
||||||
|
AT_64 = ctypes.c_longlong
|
||||||
|
AT_WC = ctypes.c_wchar
|
||||||
|
|
||||||
# Constants
|
# Constants
|
||||||
AT_SUCCESS = 0
|
AT_SUCCESS = 0
|
||||||
AT_HANDLE_SYSTEM = 1
|
AT_HANDLE_SYSTEM = 1
|
||||||
|
|
||||||
|
# Setup AT_InitialiseLibrary
|
||||||
|
atcore.AT_InitialiseLibrary.argtypes = []
|
||||||
|
atcore.AT_InitialiseLibrary.restype = ctypes.c_int
|
||||||
|
|
||||||
|
# Setup AT_GetInt
|
||||||
|
atcore.AT_GetInt.argtypes = [AT_H, ctypes.c_wchar_p, ctypes.POINTER(AT_64)]
|
||||||
|
atcore.AT_GetInt.restype = ctypes.c_int
|
||||||
|
|
||||||
|
# Setup AT_FinaliseLibrary
|
||||||
|
atcore.AT_FinaliseLibrary.argtypes = []
|
||||||
|
atcore.AT_FinaliseLibrary.restype = ctypes.c_int
|
||||||
|
|
||||||
print("Initializing library...")
|
print("Initializing library...")
|
||||||
ret = atcore.AT_InitialiseLibrary()
|
ret = atcore.AT_InitialiseLibrary()
|
||||||
if ret != AT_SUCCESS:
|
if ret != AT_SUCCESS:
|
||||||
@@ -17,8 +34,8 @@ if ret != AT_SUCCESS:
|
|||||||
print("Initialize OK")
|
print("Initialize OK")
|
||||||
|
|
||||||
# Get device count
|
# Get device count
|
||||||
device_count = ctypes.c_longlong(0)
|
device_count = AT_64(0)
|
||||||
ret = atcore.AT_GetInt(AT_HANDLE_SYSTEM, ctypes.c_wchar_p("Device Count"), ctypes.byref(device_count))
|
ret = atcore.AT_GetInt(AT_HANDLE_SYSTEM, "Device Count", ctypes.byref(device_count))
|
||||||
if ret != AT_SUCCESS:
|
if ret != AT_SUCCESS:
|
||||||
print(f"ERROR: Get device count failed, code: {ret}")
|
print(f"ERROR: Get device count failed, code: {ret}")
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user