This commit is contained in:
2025-12-04 16:41:38 +08:00
parent a26715bb77
commit 3376c7fa1d

View File

@@ -56,6 +56,20 @@ def test_init_and_discover():
return False
atcore = ctypes.cdll.LoadLibrary(dll_path)
# Define function signatures to match C++ API
# int AT_InitialiseLibrary()
atcore.AT_InitialiseLibrary.argtypes = []
atcore.AT_InitialiseLibrary.restype = ctypes.c_int
# int AT_FinaliseLibrary()
atcore.AT_FinaliseLibrary.argtypes = []
atcore.AT_FinaliseLibrary.restype = ctypes.c_int
# int AT_GetInt(AT_H Hndl, const AT_WC* Feature, AT_64* Value)
atcore.AT_GetInt.argtypes = [ctypes.c_int, ctypes.c_wchar_p, ctypes.POINTER(ctypes.c_longlong)]
atcore.AT_GetInt.restype = ctypes.c_int
print(f"✓ DLL loaded successfully: {dll_path}")
except Exception as e:
print(f"❌ Error loading DLL: {e}")
@@ -81,11 +95,10 @@ def test_init_and_discover():
print("[3/4] Detecting connected cameras...")
try:
device_count = ctypes.c_longlong(0)
# Use ctypes.create_unicode_buffer for proper wide string handling
feature_name = ctypes.create_unicode_buffer("Device Count")
# Use wide string like C++ L"Device Count"
ret = atcore.AT_GetInt(
AT_HANDLE_SYSTEM,
feature_name,
"Device Count",
ctypes.byref(device_count)
)