TiRayApi.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #ifndef TIRAY_API_H
  2. #define TIRAY_API_H
  3. /*!
  4. * \file TiRayApi.h
  5. *
  6. * \author Mckay
  7. *
  8. * \version 1.0.4
  9. *
  10. * \brief TiRay flat panel SDK
  11. *
  12. * This file contains functions and related structure definitions for the development of the TiRay flat panel.
  13. *
  14. */
  15. #include "TiRayDef.h"
  16. #ifndef TIRAY_API
  17. #ifdef _WIN32
  18. #ifdef TIRAYLIB_EXPORTS
  19. #define TIRAY_API __declspec(dllexport)
  20. #else
  21. #define TIRAY_API __declspec(dllimport)
  22. #endif
  23. #elif __GNUC__ >= 4
  24. #define TIRAY_API __attribute__((visibility("default")))
  25. #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550) /* Sun Studio >= 8 */
  26. #define TIRAY_API __global
  27. #else
  28. #pragma message("Unsupported compiler or platform, TIRAY_API will be empty")
  29. #define TIRAY_API /* nothing */
  30. #endif
  31. #endif
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif // __cplusplus
  35. /**
  36. * @brief get the TiRay flat panel sdk version
  37. * @return version number
  38. */
  39. TIRAY_API int GetSdkVersion();
  40. /**
  41. * @brief result callback
  42. * @param argv [in] the result arguments
  43. * @param argc [in] the result argument count
  44. */
  45. typedef void(*ResultCallback)(TiRayVariant argv[], int argc);
  46. /**
  47. * @brief scan detectors in local network, the result will be returned through the callback, this function is a synchronized call.
  48. * @param fn [in] the scan callback, specify null for stop the scan result notification.
  49. * @param interfaceIp [in] network interface ip for communication, specify null or "0.0.0.0" for all interface.
  50. * @param scanDuration [in] the scan duration in milliseconds, which will wait the execute finish.
  51. * @return Success or possible error: NetworkFailure or other error
  52. * @note callback parameters: (string)serial number, (string)model, (string)upper ip, (string)lower ip
  53. */
  54. TIRAY_API TiRayError Scan(ResultCallback fn, const char* interfaceIp, int scanDuration);
  55. /**
  56. * @brief set detector ip addresses synchronized return the result.
  57. * @param detectorSN [in] the detector serial number.
  58. * @param upperIp [in] the upper machine ip.
  59. * @param lowerIp [in] the detector local ip.
  60. * @param interfaceIp [in] network interface ip for communication, specify null or "0.0.0.0" for all interface.
  61. * @return Success or possible error: NetworkFailure or other error
  62. */
  63. TIRAY_API TiRayError SetIp(const char* detectorSN, const char* upperIp, const char* lowerIp, const char* interfaceIp);
  64. /**
  65. * @brief flat panel event callback
  66. * @param detectorId [in] the detector which fired the event
  67. * @param event [in] the event enum
  68. * @param argv [in] the event arguments
  69. * @param argc [in] the event argument count
  70. * @param reservedArg [in] reserved event argument data for future use
  71. * @param reservedArgLen [in] reserved event argument data size
  72. */
  73. typedef void(*EventCallback)(int detectorId, TiRayEvent event, TiRayVariant argv[], int argc, void* reservedArg, int reservedArgLen);
  74. /**
  75. * @brief startup the TiRay flat panel interface
  76. * @param model [in] TiRay flat panel model
  77. * @param fn [in] the event callback
  78. * @param option [in] [optional] startup option, specify null for use default option
  79. * @return Success or possible error: WrongModel, NetworkFailure(network setting is wrong)
  80. */
  81. TIRAY_API TiRayError Startup(TiRayModel model, EventCallback fn, const StartupOption* option);
  82. /**
  83. * @brief stop the TiRay flat panel interface
  84. */
  85. TIRAY_API void Stop();
  86. /**
  87. * @brief execute the detector command asynchronous
  88. * @param detectorId [in] specify detector id
  89. * @param commandId [in] specify command id
  90. * @param argv [in] specify command arguments array
  91. * @param argc [in] specify command arguments count
  92. * @return Success or Error
  93. */
  94. TIRAY_API TiRayError Execute(int detectorId, int commandId, TiRayVariant argv[], int argc);
  95. /**
  96. * @brief apply the detector preset data
  97. * @param detectorId [in] specify detector id
  98. * @param argv [in] specify command arguments array (work mode, binning mode, frame rate, offset template filename, gain template filename)
  99. * @param argc [in] specify command arguments count
  100. * @param fn [in] the result callback.
  101. * @return Success or Error
  102. * @note this function will process asynchronously, when processing, the other request would be denied. the processing would be waited at most 120s.
  103. * @note callback parameters: (TiRayError)error code
  104. */
  105. TIRAY_API TiRayError ApplyPreset(int detectorId, TiRayVariant argv[], int argc, ResultCallback fn);
  106. /**
  107. * @brief generate template
  108. * @param type [in] the template type
  109. * @param images [in] the images data for generate the template
  110. * @param count [in] the images count
  111. * @param templateBuffer [out] the offset template output buffer
  112. * @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.
  113. * @return Success or possible error: InvalidParam
  114. */
  115. TIRAY_API TiRayError GenerateTemplate(TemplateType type, TiRayVariant images[], int count, void* templateBuffer, int bufferSize);
  116. #ifdef __cplusplus
  117. }
  118. #endif
  119. #endif