123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- #ifndef TIRAY_API_H
- #define TIRAY_API_H
- /*!
- * \file TiRayApi.h
- *
- * \author Mckay
- *
- * \version 1.0.4
- *
- * \brief TiRay flat panel SDK
- *
- * This file contains functions and related structure definitions for the development of the TiRay flat panel.
- *
- */
- #include "TiRayDef.h"
- #ifndef TIRAY_API
- #ifdef _WIN32
- #ifdef TIRAYLIB_EXPORTS
- #define TIRAY_API __declspec(dllexport)
- #else
- #define TIRAY_API __declspec(dllimport)
- #endif
- #elif __GNUC__ >= 4
- #define TIRAY_API __attribute__((visibility("default")))
- #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) /* Sun Studio >= 8 */
- #define TIRAY_API __global
- #else
- #pragma message("Unsupported compiler or platform, TIRAY_API will be empty")
- #define TIRAY_API /* nothing */
- #endif
- #endif
- #ifdef __cplusplus
- extern "C" {
- #endif // __cplusplus
- /**
- * @brief get the TiRay flat panel sdk version
- * @return version number
- */
- TIRAY_API int GetSdkVersion();
- /**
- * @brief result callback
- * @param argv [in] the result arguments
- * @param argc [in] the result argument count
- */
- typedef void(*ResultCallback)(TiRayVariant argv[], int argc);
- /**
- * @brief scan detectors in local network, the result will be returned through the callback, this function is a synchronized call.
- * @param fn [in] the scan callback, specify null for stop the scan result notification.
- * @param interfaceIp [in] network interface ip for communication, specify null or "0.0.0.0" for all interface.
- * @param scanDuration [in] the scan duration in milliseconds, which will wait the execute finish.
- * @return Success or possible error: NetworkFailure or other error
- * @note callback parameters: (string)serial number, (string)model, (string)upper ip, (string)lower ip
- */
- TIRAY_API TiRayError Scan(ResultCallback fn, const char* interfaceIp, int scanDuration);
- /**
- * @brief set detector ip addresses synchronized return the result.
- * @param detectorSN [in] the detector serial number.
- * @param upperIp [in] the upper machine ip.
- * @param lowerIp [in] the detector local ip.
- * @param interfaceIp [in] network interface ip for communication, specify null or "0.0.0.0" for all interface.
- * @return Success or possible error: NetworkFailure or other error
- */
- TIRAY_API TiRayError SetIp(const char* detectorSN, const char* upperIp, const char* lowerIp, const char* interfaceIp);
- /**
- * @brief flat panel event callback
- * @param detectorId [in] the detector which fired the event
- * @param event [in] the event enum
- * @param argv [in] the event arguments
- * @param argc [in] the event argument count
- * @param reservedArg [in] reserved event argument data for future use
- * @param reservedArgLen [in] reserved event argument data size
- */
- typedef void(*EventCallback)(int detectorId, TiRayEvent event, TiRayVariant argv[], int argc, void* reservedArg, int reservedArgLen);
- /**
- * @brief startup the TiRay flat panel interface
- * @param model [in] TiRay flat panel model
- * @param fn [in] the event callback
- * @param option [in] [optional] startup option, specify null for use default option
- * @return Success or possible error: WrongModel, NetworkFailure(network setting is wrong)
- */
- TIRAY_API TiRayError Startup(TiRayModel model, EventCallback fn, const StartupOption* option);
- /**
- * @brief stop the TiRay flat panel interface
- */
- TIRAY_API void Stop();
- /**
- * @brief execute the detector command asynchronous
- * @param detectorId [in] specify detector id
- * @param commandId [in] specify command id
- * @param argv [in] specify command arguments array
- * @param argc [in] specify command arguments count
- * @return Success or Error
- */
- TIRAY_API TiRayError Execute(int detectorId, int commandId, TiRayVariant argv[], int argc);
- /**
- * @brief apply the detector preset data
- * @param detectorId [in] specify detector id
- * @param argv [in] specify command arguments array (work mode, binning mode, frame rate, offset template filename, gain template filename)
- * @param argc [in] specify command arguments count
- * @param fn [in] the result callback.
- * @return Success or Error
- * @note this function will process asynchronously, when processing, the other request would be denied. the processing would be waited at most 120s.
- * @note callback parameters: (TiRayError)error code
- */
- TIRAY_API TiRayError ApplyPreset(int detectorId, TiRayVariant argv[], int argc, ResultCallback fn);
- /**
- * @brief generate template
- * @param type [in] the template type
- * @param images [in] the images data for generate the template
- * @param count [in] the images count
- * @param templateBuffer [out] the offset template output buffer
- * @param bufferSize [in] the template buffer size, must be the same as the image size when the type is not GainV2, and it must be twice the image size when the type is GainV2.
- * @return Success or possible error: InvalidParam
- */
- TIRAY_API TiRayError GenerateTemplate(TemplateType type, TiRayVariant images[], int count, void* templateBuffer, int bufferSize);
- #ifdef __cplusplus
- }
- #endif
- #endif
|