33 lines
823 B
Python
33 lines
823 B
Python
import ctypes
|
|
import os
|
|
|
|
# Load DLL
|
|
dll_path = os.path.join(os.path.dirname(__file__), "libs", "atcore.dll")
|
|
atcore = ctypes.cdll.LoadLibrary(dll_path)
|
|
|
|
# Constants
|
|
AT_SUCCESS = 0
|
|
AT_HANDLE_SYSTEM = 1
|
|
|
|
print("Initializing library...")
|
|
ret = atcore.AT_InitialiseLibrary()
|
|
if ret != AT_SUCCESS:
|
|
print(f"ERROR: Initialize failed, code: {ret}")
|
|
exit(1)
|
|
print("Initialize OK")
|
|
|
|
# Get device count
|
|
device_count = ctypes.c_longlong(0)
|
|
ret = atcore.AT_GetInt(AT_HANDLE_SYSTEM, ctypes.c_wchar_p("Device Count"), ctypes.byref(device_count))
|
|
if ret != AT_SUCCESS:
|
|
print(f"ERROR: Get device count failed, code: {ret}")
|
|
else:
|
|
print(f"Device count: {device_count.value}")
|
|
|
|
# Finalize
|
|
ret = atcore.AT_FinaliseLibrary()
|
|
if ret != AT_SUCCESS:
|
|
print(f"ERROR: Finalize failed, code: {ret}")
|
|
else:
|
|
print("Finalize OK")
|