diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9904da5 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +*.dll filter=lfs diff=lfs merge=lfs -text +*.lib filter=lfs diff=lfs merge=lfs -text diff --git a/andor-test/01_init_and_discover.py b/andor-test/01_init_and_discover.py new file mode 100644 index 0000000..dcad80e --- /dev/null +++ b/andor-test/01_init_and_discover.py @@ -0,0 +1,137 @@ +""" +Test 01: SDK Initialization and Device Discovery +测试SDK初始化和设备发现功能 + +This script tests: +1. Loading the Andor SDK3 DLL +2. Initializing the SDK library +3. Getting the number of connected cameras +4. Finalizing the SDK library +""" + +import ctypes +import os +import sys + +# Constants from atcore.h +AT_SUCCESS = 0 +AT_HANDLE_SYSTEM = 1 +AT_ERR_NOTINITIALISED = 1 +AT_ERR_DEVICENOTFOUND = 39 + +# DLL path - relative to script location +SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) +LIBS_PATH = os.path.join(SCRIPT_DIR, "libs") +DLL_NAME = "atcore.dll" + + +def test_init_and_discover(): + """Test SDK initialization and device discovery.""" + + print("=" * 60) + print("Test 01: SDK Initialization and Device Discovery") + print("=" * 60) + print() + + # Step 1: Load DLL + print("[1/4] Loading Andor SDK DLL...") + try: + # Add libs directory to DLL search path + if not os.path.exists(LIBS_PATH): + print(f"❌ Error: libs folder not found at {LIBS_PATH}") + return False + + # For Windows, add the directory to DLL search path + if sys.platform == 'win32': + if hasattr(os, 'add_dll_directory'): + # Python 3.8+ + os.add_dll_directory(LIBS_PATH) + else: + # Python 3.7 and earlier + os.environ['PATH'] = LIBS_PATH + os.pathsep + os.environ.get('PATH', '') + + dll_path = os.path.join(LIBS_PATH, DLL_NAME) + if not os.path.exists(dll_path): + print(f"❌ Error: DLL not found at {dll_path}") + return False + + atcore = ctypes.cdll.LoadLibrary(dll_path) + print(f"✓ DLL loaded successfully: {dll_path}") + except Exception as e: + print(f"❌ Error loading DLL: {e}") + return False + + print() + + # Step 2: Initialize SDK + print("[2/4] Initializing SDK library...") + try: + ret = atcore.AT_InitialiseLibrary() + if ret != AT_SUCCESS: + print(f"❌ Failed to initialize library, error code: {ret}") + return False + print("✓ SDK library initialized successfully") + except Exception as e: + print(f"❌ Error during initialization: {e}") + return False + + print() + + # Step 3: Get device count + print("[3/4] Detecting connected cameras...") + try: + device_count = ctypes.c_longlong(0) + ret = atcore.AT_GetInt( + AT_HANDLE_SYSTEM, + "Device Count".encode('utf-16le') + b'\x00\x00', + ctypes.byref(device_count) + ) + + if ret != AT_SUCCESS: + print(f"❌ Failed to get device count, error code: {ret}") + else: + print(f"✓ Device count retrieved successfully") + print(f" Number of cameras detected: {device_count.value}") + + if device_count.value == 0: + print(" ⚠ Warning: No cameras detected!") + elif device_count.value > 0: + print(f" ✓ Found {device_count.value} camera(s)") + except Exception as e: + print(f"❌ Error getting device count: {e}") + device_count = None + + print() + + # Step 4: Finalize SDK + print("[4/4] Finalizing SDK library...") + try: + ret = atcore.AT_FinaliseLibrary() + if ret != AT_SUCCESS: + print(f"❌ Failed to finalize library, error code: {ret}") + return False + print("✓ SDK library finalized successfully") + except Exception as e: + print(f"❌ Error during finalization: {e}") + return False + + print() + print("=" * 60) + + # Summary + if device_count is not None and device_count.value > 0: + print("✓ TEST PASSED: SDK initialization and device discovery successful") + print(f" {device_count.value} camera(s) detected") + return True + elif device_count is not None and device_count.value == 0: + print("⚠ TEST COMPLETED WITH WARNING: SDK works but no cameras detected") + print(" This is normal if no camera is connected") + return True + else: + print("❌ TEST FAILED: Could not complete device discovery") + return False + + +if __name__ == "__main__": + success = test_init_and_discover() + sys.exit(0 if success else 1) diff --git a/andor-test/libs/atblkbx.dll b/andor-test/libs/atblkbx.dll new file mode 100644 index 0000000..5e60868 --- /dev/null +++ b/andor-test/libs/atblkbx.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9becd7ec57b2ecc64f498ffcba5f66cd2e8b866bd13f79d20184d4577c8d852 +size 18944 diff --git a/andor-test/libs/atcl_bitflow.dll b/andor-test/libs/atcl_bitflow.dll new file mode 100644 index 0000000..2644032 --- /dev/null +++ b/andor-test/libs/atcl_bitflow.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:878e5c5ac2fbc19a8e23725f1f63c38d2123a1537aa37e25d4e107315540bf2c +size 89088 diff --git a/andor-test/libs/atcore.dll b/andor-test/libs/atcore.dll new file mode 100644 index 0000000..6615cbd --- /dev/null +++ b/andor-test/libs/atcore.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0157168f56b2b2b6de7a0e234c39ac2315683e0cf8684505a3fd00edf77d4934 +size 97792 diff --git a/andor-test/libs/atcorem.lib b/andor-test/libs/atcorem.lib new file mode 100644 index 0000000..4395f54 --- /dev/null +++ b/andor-test/libs/atcorem.lib @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:51a65e520cda8baca5c90374ad8aab24b1a25e6e6c1445cca6b9ba9395ab2057 +size 10294 diff --git a/andor-test/libs/atdevapogee.dll b/andor-test/libs/atdevapogee.dll new file mode 100644 index 0000000..62948ea --- /dev/null +++ b/andor-test/libs/atdevapogee.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e2e3697848a1fff76c0d20194f92d4132b90724cd8f9043295c14e2651240079 +size 1114112 diff --git a/andor-test/libs/atdevregcam.dll b/andor-test/libs/atdevregcam.dll new file mode 100644 index 0000000..b93c24f --- /dev/null +++ b/andor-test/libs/atdevregcam.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2bdc38037fd71987adfbd2cf8c71b9626e6646ec2a26d650d1848dc9068d1c74 +size 2162688 diff --git a/andor-test/libs/atdevsimcam.dll b/andor-test/libs/atdevsimcam.dll new file mode 100644 index 0000000..9428e42 --- /dev/null +++ b/andor-test/libs/atdevsimcam.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c22d74d00c51a8bd8392b0142a556b9da9a5091422595f3f4e3cfe2bbcc166d +size 163328 diff --git a/andor-test/libs/atmcd64d.dll b/andor-test/libs/atmcd64d.dll new file mode 100644 index 0000000..1972025 --- /dev/null +++ b/andor-test/libs/atmcd64d.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be08ab05e6f35fddf41ce09ea6e098b19a5c3585bcd2875ba54c6f265f1f40d3 +size 2097664 diff --git a/andor-test/libs/atmcd64m.lib b/andor-test/libs/atmcd64m.lib new file mode 100644 index 0000000..6462318 --- /dev/null +++ b/andor-test/libs/atmcd64m.lib @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07ad6e0f9fee60cf5bdd2a4093b16f6abb49aed424c2a29ae3ce0019de949b42 +size 464884 diff --git a/andor-test/libs/atspooler.dll b/andor-test/libs/atspooler.dll new file mode 100644 index 0000000..14dc683 --- /dev/null +++ b/andor-test/libs/atspooler.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:28e9b4a1fde3c8a5ad35a44a3a2ac5d6c169be1aab352b312a29da9ef1ed3a22 +size 54272 diff --git a/andor-test/libs/atusb_libusb.dll b/andor-test/libs/atusb_libusb.dll new file mode 100644 index 0000000..9874444 --- /dev/null +++ b/andor-test/libs/atusb_libusb.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f1bcd74b25e5545dc6cf0106b451c69dd563cba372f8399f398027a23e6de09 +size 23040 diff --git a/andor-test/libs/atusb_libusb10.dll b/andor-test/libs/atusb_libusb10.dll new file mode 100644 index 0000000..b77c533 --- /dev/null +++ b/andor-test/libs/atusb_libusb10.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df477eb0e4eb3703c5e242056203cb290cc5ce057da07a863e51d8557e26cb56 +size 81920 diff --git a/andor-test/libs/atutility.dll b/andor-test/libs/atutility.dll new file mode 100644 index 0000000..cf07517 --- /dev/null +++ b/andor-test/libs/atutility.dll @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cc09f2f71c448e1a7ed186d2baab3e7d4cca097c471fb2431021711deb6ff7e9 +size 29696 diff --git a/andor-test/libs/atutilitym.lib b/andor-test/libs/atutilitym.lib new file mode 100644 index 0000000..520943c --- /dev/null +++ b/andor-test/libs/atutilitym.lib @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:08adeb18b1bfefcf25fe00f7881ead85568148f7291e18095c42ec8b4b5a45e5 +size 4122 diff --git a/src/navigate/model/devices/APIs/dynamixel/dxl_x64_c.dll b/src/navigate/model/devices/APIs/dynamixel/dxl_x64_c.dll index 09ab084..0195c0d 100644 Binary files a/src/navigate/model/devices/APIs/dynamixel/dxl_x64_c.dll and b/src/navigate/model/devices/APIs/dynamixel/dxl_x64_c.dll differ diff --git a/src/navigate/model/devices/APIs/dynamixel/dxl_x64_c.lib b/src/navigate/model/devices/APIs/dynamixel/dxl_x64_c.lib index 3f350e2..0ed0c3f 100644 Binary files a/src/navigate/model/devices/APIs/dynamixel/dxl_x64_c.lib and b/src/navigate/model/devices/APIs/dynamixel/dxl_x64_c.lib differ diff --git a/src/navigate/model/devices/APIs/imagineoptics/c_interface_vc100_x64.dll b/src/navigate/model/devices/APIs/imagineoptics/c_interface_vc100_x64.dll index 4c27d12..ddd5d83 100644 Binary files a/src/navigate/model/devices/APIs/imagineoptics/c_interface_vc100_x64.dll and b/src/navigate/model/devices/APIs/imagineoptics/c_interface_vc100_x64.dll differ diff --git a/src/navigate/model/devices/APIs/imagineoptics/mirao52e.dll b/src/navigate/model/devices/APIs/imagineoptics/mirao52e.dll index 0bd3fb9..6f8e2e4 100644 Binary files a/src/navigate/model/devices/APIs/imagineoptics/mirao52e.dll and b/src/navigate/model/devices/APIs/imagineoptics/mirao52e.dll differ