diff --git a/debian/libasi/changelog b/debian/libasi/changelog index 54d03084a..96746e7e1 100644 --- a/debian/libasi/changelog +++ b/debian/libasi/changelog @@ -1,3 +1,9 @@ +libasi (1.361) jammy; urgency=medium + + * ASI Rotator CAA SDK 1.0 release + + -- Jasem Mutlaq Thu, 9 Jan 2024 17:00:00 +0300 + libasi (1.360) jammy; urgency=medium * ASI Camera SDK 1.36 release diff --git a/libasi/99-asi.rules b/libasi/99-asi.rules index a4bd39cb5..481317d14 100644 --- a/libasi/99-asi.rules +++ b/libasi/99-asi.rules @@ -1,7 +1,7 @@ -ACTION=="add", ATTR{idVendor}=="03c3", RUN+="/bin/sh -c '/bin/echo 200 >/sys/module/usbcore/parameters/usbfs_memory_mb'" +ACTION=="add", ATTR{idVendor}=="03c3", RUN+="/bin/sh -c '/bin/echo 1024 >/sys/module/usbcore/parameters/usbfs_memory_mb'" # All ASI Cameras and filter wheels SUBSYSTEMS=="usb", ATTR{idVendor}=="03c3", MODE="0666" # Allow access to unbind/bind SUBSYSTEM=="usb", ATTR{idVendor}=="03c3", RUN+="/bin/chmod 666 /sys/bus/usb/drivers/usb/bind /sys/bus/usb/drivers/usb/unbind" # Allow power management -SUBSYSTEM=="usb", ATTR{idVendor}=="03c3", RUN+="/bin/chmod 666 $power{power/level}" +SUBSYSTEM=="usb", ATTR{idVendor}=="03c3", RUN+="/bin/chmod 666 /sys/bus/usb/devices/$kernel/power/level" diff --git a/libasi/CAA_API.h b/libasi/CAA_API.h new file mode 100644 index 000000000..5c8d33b4f --- /dev/null +++ b/libasi/CAA_API.h @@ -0,0 +1,514 @@ +/************************************************** +this is the ZWO caa CAA SDK +any question feel free contact us:yang.zhou@zwoptical.com + +***************************************************/ +#ifndef CAA_API_H +#define CAA_API_H + +#ifdef _WINDOWS +#define CAA_API __declspec(dllexport) +#else +#define CAA_API +#endif + +#define CAA_ID_MAX 128 + +typedef struct _CAA_INFO +{ + int ID; + char Name[64]; + int MaxStep;//fixed maximum degree +} CAA_INFO; + + +typedef enum _CAA_ERROR_CODE{ + CAA_SUCCESS = 0, + CAA_ERROR_INVALID_INDEX, + CAA_ERROR_INVALID_ID, + CAA_ERROR_INVALID_VALUE, + CAA_ERROR_REMOVED, //failed to find the caa, maybe the caa has been removed + CAA_ERROR_MOVING,//caa is moving + CAA_ERROR_ERROR_STATE,//caa is in error state + CAA_ERROR_GENERAL_ERROR,//other error + CAA_ERROR_NOT_SUPPORTED, + CAA_ERROR_CLOSED, + CAA_ERROR_OUT_RANGE, // 超过 0- 360范围 + CAA_ERROR_OVER_LIMIT, // 超过限位 + CAA_ERROR_STALL, // 堵转 + CAA_ERROR_TIMEOUT, // 超时 + CAA_ERROR_END = -1 +}CAA_ERROR_CODE; + +typedef struct _CAA_ID{ + unsigned char id[8]; +}CAA_ID; + +typedef CAA_ID CAA_SN; + +typedef struct _CAA_TYPE { + char type[16]; +}CAA_TYPE; + +#ifdef __cplusplus +extern "C" { +#endif +/*************************************************************************** +Descriptions: +This should be the first API to be called +get number of connected CAA caa, call this API to refresh device list if CAA is connected +or disconnected + +Return: number of connected CAA caa. 1 means 1 caa is connected. +***************************************************************************/ +CAA_API int CAAGetNum(); + +/*************************************************************************** +Descriptions: +Get the product ID of each caa, at first set pPIDs as 0 and get length and then malloc a buffer to load the PIDs + +Paras: +int* pPIDs: pointer to array of PIDs + +Return: length of the array. + +Note: This api will be deprecated. Please use CAACheck instead +***************************************************************************/ +CAA_API int CAAGetProductIDs(int* pPIDs); + +/*************************************************************************** +Descriptions: +Check if the device is CAA + +Paras: +int iVID: VID is 0x03C3 for CAA +int iPID: PID of the device + +Return: If the device is CAA, return 1, otherwise return 0 +***************************************************************************/ +CAA_API int CAACheck(int iVID, int iPID); + +/*************************************************************************** +Descriptions: +Get ID of caa + +Paras: +int index: the index of caa, from 0 to N - 1, N is returned by GetNum() + +int* ID: pointer to ID. the ID is a unique integer, between 0 to CAA_ID_MAX - 1, after opened, +all the operation is base on this ID, the ID will not change. + + +Return: +CAA_ERROR_INVALID_INDEX: index value is invalid +CAA_SUCCESS: operation succeeds + +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAAGetID(int index, int* ID); + +/*************************************************************************** +Descriptions: +Open caa + +Paras: +int ID: the ID of caa + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_ERROR_GENERAL_ERROR: number of opened caa reaches the maximum value. +CAA_ERROR_REMOVED: the caa is removed. +CAA_SUCCESS: operation succeeds +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAAOpen(int ID); + +/*************************************************************************** +Descriptions: +Get property of caa. + +Paras: +int ID: the ID of caa + +CAA_INFO *pInfo: pointer to structure containing the property of CAA + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_SUCCESS: operation succeeds + +***************************************************************************/ + +CAA_API CAA_ERROR_CODE CAAGetProperty(int ID, CAA_INFO *pInfo); + + + +/*************************************************************************** +Descriptions: +Move caa to an relatively degree.(移动相对角度) + +Paras: +int ID: the ID of caa + +int iStep: step value is between 0 to CAA_INFO::MaxStep + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_ERROR_CLOSED: not opened +CAA_SUCCESS: operation succeeds +CAA_ERROR_ERROR_STATE: caa is in error state +CAA_ERROR_REMOVED: caa is removed + +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAAMove(int ID, float iAngle); + +/*************************************************************************** +Descriptions: +Move caa to an absolute degree.(移动绝对角度) + +Paras: +int ID: the ID of caa + +int iStep: step value is between 0 to CAA_INFO::MaxStep + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_ERROR_CLOSED: not opened +CAA_SUCCESS: operation succeeds +CAA_ERROR_ERROR_STATE: caa is in error state +CAA_ERROR_REMOVED: caa is removed + +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAAMoveTo(int ID, float iAngle); + + + +/*************************************************************************** +Descriptions: +Stop moving. + +Paras: +int ID: the ID of caa + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_ERROR_CLOSED: not opened +CAA_SUCCESS: operation succeeds +CAA_ERROR_ERROR_STATE: caa is in error state +CAA_ERROR_REMOVED: caa is removed + +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAAStop(int ID); + + +/*************************************************************************** +Descriptions: +Check if the caa is moving. + +Paras: +int ID: the ID of caa +bool *pbVal: pointer to the value, imply if caa is moving +bool* pbHandControl: pointer to the value, imply caa is moved by handle control, can't be stopped by calling CAAStop() +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_ERROR_CLOSED: not opened +CAA_SUCCESS: operation succeeds +CAA_ERROR_ERROR_STATE: caa is in error state +CAA_ERROR_REMOVED: caa is removed + +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAAIsMoving(int ID, bool *pbVal, bool* pbHandControl); + + +/*************************************************************************** +Descriptions: +Get current degree. + +Paras: +int ID: the ID of caa +bool *piStep: pointer to the value + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_ERROR_CLOSED: not opened +CAA_SUCCESS: operation succeeds +CAA_ERROR_ERROR_STATE: caa is in error state +CAA_ERROR_REMOVED: caa is removed + +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAAGetDegree(int ID, float* piAngle); + +/*************************************************************************** +Descriptions: +Set as current degree + +Paras: +int ID: the ID of caa +int iStep: step value + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_ERROR_CLOSED: not opened +CAA_SUCCESS: operation succeeds +CAA_ERROR_ERROR_STATE: caa is in error state +CAA_ERROR_REMOVED: caa is removed + +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAACurDegree(int ID, float iAngle); + +/*************************************************************************** +Descriptions: +Get mini degree + +Paras: +int ID: the ID of caa +int iStep: step value + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_ERROR_CLOSED: not opened +CAA_SUCCESS: operation succeeds +CAA_ERROR_ERROR_STATE: caa is in error state +CAA_ERROR_REMOVED: caa is removed + +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAAMinDegree(int ID, float* piAngle); + +/*************************************************************************** +Descriptions: +Get max degree + +Paras: +int ID: the ID of caa +int iStep: step value + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_ERROR_CLOSED: not opened +CAA_SUCCESS: operation succeeds +CAA_ERROR_ERROR_STATE: caa is in error state +CAA_ERROR_REMOVED: caa is removed + +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAASetMaxDegree(int ID, float iAngle); + +/*************************************************************************** +Descriptions: +Get max degree + +Paras: +int ID: the ID of caa +int iStep: step value + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_ERROR_CLOSED: not opened +CAA_SUCCESS: operation succeeds +CAA_ERROR_ERROR_STATE: caa is in error state +CAA_ERROR_REMOVED: caa is removed + +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAAGetMaxDegree(int ID, float* piAngle); + + +/*************************************************************************** +Descriptions: +Get the value of the temperature detector, if it's moved by handle, the temperature value is unreasonable, the value is -273 and return error + +Paras: +int ID: the ID of caa +bool *pfTemp: pointer to the value + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_ERROR_CLOSED: not opened +CAA_SUCCESS: operation succeeds +CAA_ERROR_ERROR_STATE: caa is in error state +CAA_ERROR_REMOVED: caa is removed +CAA_ERROR_GENERAL_ERROR: temperature value is unusable +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAAGetTemp(int ID, float* pfTemp); + +/*************************************************************************** +Descriptions: +Turn on/off beep, if true the caa will beep at the moment when it begins to move + +Paras: +int ID: the ID of caa +bool bVal: turn on beep if true + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_ERROR_CLOSED: not opened +CAA_SUCCESS: operation succeeds +CAA_ERROR_ERROR_STATE: caa is in error state +CAA_ERROR_REMOVED: caa is removed + +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAASetBeep(int ID, bool bVal); + +/*************************************************************************** +Descriptions: +Get if beep is turned on + +Paras: +int ID: the ID of caa +bool *pbVal: pointer to the value + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_ERROR_CLOSED: not opened +CAA_SUCCESS: operation succeeds +CAA_ERROR_ERROR_STATE: caa is in error state +CAA_ERROR_REMOVED: caa is removed + +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAAGetBeep(int ID, bool* pbVal); + +/*************************************************************************** +Descriptions: +Set moving direction of caa + +Paras: +int ID: the ID of caa + +bool bVal: if set as true, the caa will move along reverse direction + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_ERROR_CLOSED: not opened +CAA_SUCCESS: operation succeeds +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAASetReverse(int ID, bool bVal); + +/*************************************************************************** +Descriptions: +Get moving direction of caa + +Paras: +int ID: the ID of caa + +bool *pbVal: pointer to direction value. + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_ERROR_CLOSED: not opened +CAA_SUCCESS: operation succeeds +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAAGetReverse(int ID, bool* pbVal); + + +/*************************************************************************** +Descriptions: +Close caa + +Paras: +int ID: the ID of caa + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_SUCCESS: operation succeeds +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAAClose(int ID); + +/*************************************************************************** +Descriptions: +get version string, like "1, 4, 0" +***************************************************************************/ +CAA_API char* CAAGetSDKVersion(); + +/*************************************************************************** +Descriptions: +Get firmware version of caa + +Paras: +int ID: the ID of caa + +int *major, int *minor, int *build: pointer to value. + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_ERROR_CLOSED: not opened +CAA_SUCCESS: operation succeeds +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAAGetFirmwareVersion(int ID, unsigned char *major, unsigned char *minor, unsigned char *build); + +/*************************************************************************** +Descriptions: +Get the serial number from a CAA + +Paras: +int ID: the ID of caa + +CAA_SN* pSN: pointer to SN + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_ERROR_CLOSED: not opened +EFW_ERROR_NOT_SUPPORTED: the firmware does not support serial number +CAA_SUCCESS: operation succeeds +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAAGetSerialNumber(int ID, CAA_SN* pSN); + +/*************************************************************************** +Descriptions: +Set the alias to a CAA + +Paras: +int ID: the ID of caa + +CAA_ID alias: the struct which contains the alias + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_ERROR_CLOSED: not opened +EFW_ERROR_NOT_SUPPORTED: the firmware does not support setting alias +CAA_SUCCESS: operation succeeds +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAASetID(int ID, CAA_ID alias); + +/*************************************************************************** +Descriptions: +Get the type of a CAA. +For example:CAA-M54 + +Paras: +int ID: the ID of caa + +CAA_TYPE *CAAType: caa type + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_ERROR_CLOSED: not opened +CAA_SUCCESS: operation succeeds +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAAGetType(int ID, CAA_TYPE* pCAAType); + +//#define ASIPRODUCE //API for Produce. It needs to be commented out when it is released to the public +#ifdef ASIPRODUCE + +CAA_API CAA_ERROR_CODE CAASendCMD(int ID, unsigned char* buf, int size, bool bRead = false, unsigned char* readBuf = 0); + +/*************************************************************************** +Descriptions: +Set the serial number to a CAA + +Paras: +int ID: the ID of caa + +CAA_SN* pSN: pointer to SN + +Return: +CAA_ERROR_INVALID_ID: invalid ID value +CAA_ERROR_CLOSED: not opened +EFW_ERROR_NOT_SUPPORTED: the firmware does not support setting serial number +CAA_SUCCESS: operation succeeds + +Note: Now setting serial number dose not through SDK, so this api is not used. +***************************************************************************/ +CAA_API CAA_ERROR_CODE CAASetSerialNumber(int ID, CAA_SN* pSN); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/libasi/CMakeLists.txt b/libasi/CMakeLists.txt index 52c8551b1..714ab67f7 100644 --- a/libasi/CMakeLists.txt +++ b/libasi/CMakeLists.txt @@ -1,10 +1,11 @@ cmake_minimum_required(VERSION 3.16) project (libasi) -# Using ASI Camera SDK Version 1.34 updated on 2024-03-29 +# Using ASI Camera SDK Version 1.36 updated on 2024-12-29 # Using ASI EFW SDK Version 1.7 updated on 2021-05-17 # Using ASI ST4 SDK Version 1.0 updated on 2018-07-23 # Using ASI EAF SDK Version 1.6 updated on 2023-03-16 +# Using ASI CAA SDK Version 1.0 updated on 2025-01-09 set (ASICAM_VERSION "1.36") set (ASICAM_SOVERSION "1") @@ -18,6 +19,9 @@ set (ASIST4_SOVERSION "1") set (ASIEAF_VERSION "1.6") set (ASIEAF_SOVERSION "1") +set (ASICAA_VERSION "1.0") +set (ASICAA_SOVERSION "1") + list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/") list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../cmake_modules/") include (GNUInstallDirs) @@ -27,11 +31,13 @@ add_library (ASICamera2 SHARED IMPORTED) add_library (EFWFilter SHARED IMPORTED) add_library (USB2ST4Conv SHARED IMPORTED) add_library (EAFFocuser SHARED IMPORTED) +add_library (CAARotator SHARED IMPORTED) set_target_properties (ASICamera2 PROPERTIES VERSION ${ASICAM_VERSION} SOVERSION ${ASICAM_SOVERSION}) set_target_properties (EFWFilter PROPERTIES VERSION ${ASIEFW_VERSION} SOVERSION ${ASIEFW_SOVERSION}) set_target_properties (USB2ST4Conv PROPERTIES VERSION ${ASIST4_VERSION} SOVERSION ${ASIST4_SOVERSION}) set_target_properties (EAFFocuser PROPERTIES VERSION ${ASIEAF_VERSION} SOVERSION ${ASIEAF_SOVERSION}) +set_target_properties (CAARotator PROPERTIES VERSION ${ASICAA_VERSION} SOVERSION ${ASICAA_SOVERSION}) if (APPLE) @@ -52,21 +58,25 @@ elseif (UNIX AND NOT WIN32) set_property (TARGET EFWFilter PROPERTY IMPORTED_LOCATION "armv6/libEFWFilter.bin") set_property (TARGET USB2ST4Conv PROPERTY IMPORTED_LOCATION "armv6/libUSB2ST4Conv.bin") set_property (TARGET EAFFocuser PROPERTY IMPORTED_LOCATION "armv6/libEAFFocuser.bin") + set_property (TARGET CAARotator PROPERTY IMPORTED_LOCATION "armv6/libCAARotator.bin") elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64") set_property (TARGET ASICamera2 PROPERTY IMPORTED_LOCATION "armv8/libASICamera2.bin") set_property (TARGET EFWFilter PROPERTY IMPORTED_LOCATION "armv8/libEFWFilter.bin") set_property (TARGET USB2ST4Conv PROPERTY IMPORTED_LOCATION "armv8/libUSB2ST4Conv.bin") set_property (TARGET EAFFocuser PROPERTY IMPORTED_LOCATION "armv8/libEAFFocuser.bin") + set_property (TARGET CAARotator PROPERTY IMPORTED_LOCATION "armv8/libCAARotator.bin") elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") set_property (TARGET ASICamera2 PROPERTY IMPORTED_LOCATION "x64/libASICamera2.bin") set_property (TARGET EFWFilter PROPERTY IMPORTED_LOCATION "x64/libEFWFilter.bin") set_property (TARGET USB2ST4Conv PROPERTY IMPORTED_LOCATION "x64/libUSB2ST4Conv.bin") set_property (TARGET EAFFocuser PROPERTY IMPORTED_LOCATION "x64/libEAFFocuser.bin") + set_property (TARGET CAARotator PROPERTY IMPORTED_LOCATION "x64/libCAARotator.bin") elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "i[3-6]86") set_property (TARGET ASICamera2 PROPERTY IMPORTED_LOCATION "x86/libASICamera2.bin") set_property (TARGET EFWFilter PROPERTY IMPORTED_LOCATION "x86/libEFWFilter.bin") set_property (TARGET USB2ST4Conv PROPERTY IMPORTED_LOCATION "x86/libUSB2ST4Conv.bin") set_property (TARGET EAFFocuser PROPERTY IMPORTED_LOCATION "x86/libEAFFocuser.bin") + set_property (TARGET CAARotator PROPERTY IMPORTED_LOCATION "x86/libCAARotator.bin") endif () # Install udev rules @@ -77,12 +87,12 @@ endif () # Install header files install ( - FILES ASICamera2.h EFW_filter.h USB2ST4_Conv.h EAF_focuser.h + FILES ASICamera2.h EFW_filter.h USB2ST4_Conv.h EAF_focuser.h CAA_API.h DESTINATION include/libasi ) # Install library install_imported ( - TARGETS ASICamera2 EFWFilter USB2ST4Conv EAFFocuser + TARGETS ASICamera2 EFWFilter USB2ST4Conv EAFFocuser CAARotator DESTINATION ${CMAKE_INSTALL_LIBDIR} ) diff --git a/libasi/armv6/libCAARotator.bin b/libasi/armv6/libCAARotator.bin new file mode 100755 index 000000000..dd8dbe6aa Binary files /dev/null and b/libasi/armv6/libCAARotator.bin differ diff --git a/libasi/armv7/libCAARotator.bin b/libasi/armv7/libCAARotator.bin new file mode 100755 index 000000000..dffcb45f8 Binary files /dev/null and b/libasi/armv7/libCAARotator.bin differ diff --git a/libasi/armv8/libCAARotator.bin b/libasi/armv8/libCAARotator.bin new file mode 100755 index 000000000..664821366 Binary files /dev/null and b/libasi/armv8/libCAARotator.bin differ diff --git a/libasi/libasi.spec b/libasi/libasi.spec index e201f0cac..dcd4dd8e2 100644 --- a/libasi/libasi.spec +++ b/libasi/libasi.spec @@ -18,11 +18,13 @@ Provides: libASICamera2.so Provides: libEAFFocuser.so Provides: libEFWFilter.so Provides: libUSB2ST4Conv.so +Provides: libCAARotator.so Provides: libASICamera2.so()(64bit) Provides: libEAFFocuser.so()(64bit) Provides: libEFWFilter.so()(64bit) Provides: libUSB2ST4Conv.so()(64bit) +Provides: libCAARotator.so()(64bit) BuildRequires: cmake diff --git a/libasi/x64/libCAARotator.bin b/libasi/x64/libCAARotator.bin new file mode 100755 index 000000000..1d024aa28 Binary files /dev/null and b/libasi/x64/libCAARotator.bin differ diff --git a/libasi/x86/libCAARotator.bin b/libasi/x86/libCAARotator.bin new file mode 100755 index 000000000..cc4a48641 Binary files /dev/null and b/libasi/x86/libCAARotator.bin differ