CLProtocol.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. //-----------------------------------------------------------------------------
  2. // (c) 2008 by Basler Vision Technologies
  3. // Section: Vision Components
  4. // Project: GenApi
  5. // Author: Fritz Dierks
  6. // $Header$
  7. //
  8. // License: This file is published under the license of the EMVA GenICam Standard Group.
  9. // A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
  10. // If for some reason you are missing this file please contact the EMVA or visit the website
  11. // (http://www.genicam.org) for a full copy.
  12. //
  13. // THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
  14. // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  15. // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  16. // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
  17. // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  18. // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  19. // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  20. // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  21. // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  22. // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  23. // POSSIBILITY OF SUCH DAMAGE.
  24. //-----------------------------------------------------------------------------
  25. /*!
  26. \file
  27. \brief Exported C functions for camera link protocol drivers
  28. */
  29. #ifndef CLPROTOCOL_CLPROTOCOL_H
  30. #define CLPROTOCOL_CLPROTOCOL_H
  31. #include <CLProtocol\CLSerialTypes.h>
  32. //==============================================================================
  33. // Macros
  34. //==============================================================================
  35. #if (defined(__cplusplus) || defined(__cplusplus__))
  36. #define USER_EXTERN_C extern "C"
  37. #define USER_EXTERN_C_START extern "C" {
  38. #define USER_EXTERN_C_END }
  39. #else
  40. #define USER_EXTERN_C
  41. #define USER_EXTERN_C_START
  42. #define USER_EXTERN_C_END
  43. #endif
  44. #ifdef CLPROTOCOL_EXPORTS
  45. # define CLPROTOCOLEXPORT USER_EXTERN_C __declspec(dllexport)
  46. # define CLPROTOCOL_DECL __declspec(dllexport)
  47. #else
  48. # define CLPROTOCOLEXPORT USER_EXTERN_C __declspec(dllimport)
  49. # define CLPROTOCOL_DECL __declspec(dllimport)
  50. #endif
  51. #ifndef CLPROTOCOL
  52. #define CLPROTOCOL __cdecl
  53. #endif
  54. //==============================================================================
  55. // Types and Enums
  56. //==============================================================================
  57. typedef void (CLPROTOCOL *clp_logger_t)( CLINT32 level, const char* stringFormat, va_list argptr);
  58. USER_EXTERN_C_START
  59. typedef struct clpLogCallback_t
  60. {
  61. CLUINT32 id; //! Must be set to 0xeb6e1ca9
  62. clp_logger_t logger; //! The address of the logging function
  63. }clpLogCallback_t;
  64. USER_EXTERN_C_END
  65. //! Types of parameters to be accessed by clpGetParam/clpSetParam
  66. enum CLP_PARAMS
  67. {
  68. // Global parameters that do not use the Cookie when called.
  69. CLP_LOG_LEVEL = 1, //! A 32-bit value that contains the current log level.
  70. //! This parameter expects a value represented by the
  71. //! CLP_LOG_LEVEL_VALUE constants.
  72. CLP_LOG_CALLBACK = 2, //! A 32-bit value that contains a clpLogCallback_t pointer to the logger function.
  73. // Device related parameters that require a valid cookie to execute properly.
  74. CLP_DEVICE_BAUDERATE = -1, //! A 32-bit value that contains the baudrate used to communicate with the device.
  75. //! This parameter expects a value represented by the
  76. //! CL_BAUDRATE_XXX constants.
  77. CLP_DEVICE_SUPPORTED_BAUDERATES = -2, //! A 32-bit value that contains the baudrates
  78. //! supported by the device and the host.
  79. //! This read only parameter return one or more value(s) represented by the
  80. //! CL_BAUDRATE_XXX constants.
  81. };
  82. enum CLP_LOG_LEVEL_VALUE
  83. {
  84. CLP_LOG_FATAL = 0,
  85. CLP_LOG_ALERT = 100,
  86. CLP_LOG_CRIT = 200,
  87. CLP_LOG_ERROR = 300,
  88. CLP_LOG_WARN = 400,
  89. CLP_LOG_NOTICE = 500,
  90. CLP_LOG_INFO = 600,
  91. CLP_LOG_DEBUG = 700,
  92. CLP_LOG_NOTSET = 800
  93. };
  94. //==============================================================================
  95. // Exported Functions
  96. //==============================================================================
  97. class ISerial;
  98. /*! \ingroup PublicInterfaces */
  99. /*@{*/
  100. /*! \defgroup CLProtocolInterface CLProtocol C-Function Interface */
  101. /*@{*/
  102. /*!
  103. \brief This function is call to initialize the library after it is loaded.
  104. \param[in] logger A function pointer that contains a logging function.
  105. \param[in] logLevel The log level default value. This argument expects a value represented
  106. by the CLP_LOG_LEVEL_VALUE constants.
  107. \return On completion, this function returns one of the following status codes:
  108. \retval CL_ERR_NO_ERR No error occurred
  109. \return CL_ERR_INVALID_PTR The initialisation parameters are invalid.
  110. \return CL_ERR_IN_USE The library is already open
  111. */
  112. CLPROTOCOLEXPORT CLINT32 CLPROTOCOL
  113. clpInitLib( clp_logger_t logger,
  114. CLP_LOG_LEVEL_VALUE logLevel);
  115. /*!
  116. \brief This function is call to close the library before unloading.
  117. \return On completion, this function returns one of the following status codes:
  118. \retval CL_ERR_NO_ERR No error occurred
  119. */
  120. CLPROTOCOLEXPORT CLINT32 CLPROTOCOL
  121. clpCloseLib( void );
  122. /*!
  123. \brief This function returns a list of short device templates coded into a single string
  124. Short device templates can have the following form:
  125. - <CODE>"CameraManufacturer"</CODE>
  126. - <CODE>"CameraManufacturer#CameraFamily"</CODE>
  127. - <CODE>"CameraManufacturer#CameraFamily#CameraModel"</CODE>
  128. As compared to the long version the protocol driver dll's directory and file name is missing at the beginning.
  129. The device templates are separated by tabulators.
  130. The whole list is contained in a NULL terminated string.
  131. \param[out] pShortDeviceTemplates A pointer to a user-allocated buffer into which the function
  132. copies the list of device template names.
  133. \param[in,out] pBufferSize As an input, the value contains the size of the buffer that
  134. is passed through the pShortDeviceTemplates parameter.
  135. On successful return, this parameter contains the number of bytes written into the buffer,
  136. including the NULL termination character.
  137. On CL_ERR_BUFFER_TOO_SMALL, this parameter contains the size of the buffer needed to write
  138. the data text.
  139. \return At completion, this function returns one of the following status codes:
  140. \retval CL_ERR_NO_ERR No error occurred
  141. \retval CL_ERR_BUFFER_TOO_SMALL The pShortDeviceTemplates is too small
  142. */
  143. CLPROTOCOLEXPORT CLINT32 CLPROTOCOL clpGetShortDeviceIDTemplates ( CLINT8* pShortDeviceTemplates, CLUINT32* pBufferSize );
  144. /*!
  145. \brief Connects and identifies the device and returns a DeviceID
  146. This function connects to a device attached to the serial port and attempts to identify it using the DeviceID template as hint.
  147. If the function is successful it returns a DeviceID as well as a Cookie. The DeviceID has the form:
  148. <CODE>"CameraManufacturer#CameraFamily#CameraModel#Version.2.3.4#SerialNumber"</CODE>
  149. The connection is made with 9600 baud which is the power up baud rate as defined by the CameraLink standard.
  150. This function attempts to re-connect the device if a DeviceID is passed instead of a template as pDeviceIDTemplate.
  151. \param[in] pSerial Pointer to the interface giving access to the serial port
  152. \param[in] pDeviceIDTemplate A pointer to NULL-terminated string containing a device ID template
  153. (in the probe use case) or a device ID (in the connect use case)
  154. \param[in, out] pDeviceID A pointer to a user-allocated buffer. If DeviceIDTemplate is valid
  155. and a device is found and identified the DLL copies a device ID to the buffer.
  156. \param[in,out] pBufferSize As an input, the value contains the size of the buffer that
  157. is passed through the pDeviceID parameter.
  158. On successful return, this parameter contains the number of bytes written into the buffer,
  159. including the NULL termination character.
  160. On CL_ERR_BUFFER_TOO_SMALL, this parameter contains the size of the buffer needed to write
  161. the data text.
  162. \param[out] pCookie A token supplied by the driver dll which must be handed in by all functions
  163. called later to access the device. The dll's implementation can use this token to
  164. cache information about the connected device thus avoiding to have to parse the deviceID again.
  165. Note that the cookie value must not be 0.
  166. \param[in] TimeOut A timeout value in [ms] used during accessing the device.
  167. Note that the execution of the function itself can take longer than TimeOut because more than one
  168. access might be necessary.
  169. \return At completion, this function returns one of the following status codes:
  170. \retval CL_ERR_NO_ERR No error occurred
  171. \retval CL_BUFFER_TOO_SMALL The pDeviceID buffer is too small
  172. \retval CL_ERR_INVALID_DEVICEID The DeviceID is not recognized as valid by this dll
  173. \retval CL_ERR_NO_DEVICE_FOUND There was no device found matching the DeviceID
  174. */
  175. CLPROTOCOLEXPORT CLINT32 CLPROTOCOL clpProbeDevice( ISerial *pSerial, const CLINT8* pDeviceIDTemplate, CLINT8* pDeviceID, CLUINT32 *pBufferSize, CLUINT32 *pCookie, const CLUINT32 TimeOut );
  176. /*!
  177. \brief This function returns a list of XML IDs coded into a single string
  178. XML IDs have the following form:
  179. <CODE>"SchemaVersion.1.1@CameraManufacturer#CameraFamily#CameraModel@XMLVersion.2.3.4"</CODE>
  180. The first part of the XML ID denotes the major and minor version number of the XML schema.
  181. The last part of the XML ID denotes the major, minor, and subminor version number of the camera.
  182. Both version numbers mut be the same as given in the attributes of the RegisterDescription node
  183. of the corrensponding XML file.
  184. The middle part of the XML ID must be a complete DeviceID.
  185. The device templates are separated by tabulators.
  186. The whole list is contained in a NULL terminated string.
  187. \param[in] pSerial Pointer to the interface giving access to the serial port
  188. \param[in] Cookie Token supplied by the driver dll via the clpProbeDevice function.
  189. \param[out] pXMLIDs A pointer to a user-allocated buffer into which the function
  190. copies the list of XML IDs. The list may be empty in which case is contains of a '0' only.
  191. \param[in,out] pBufferSize As an input, the value contains the size of the buffer that
  192. is passed through the pXMLIDs parameter.
  193. On successful return, this parameter contains the number of bytes written into the buffer,
  194. including the NULL termination character.
  195. On CL_ERR_BUFFER_TOO_SMALL, this parameter contains the size of the buffer needed to write
  196. the data text.
  197. \param[in] TimeOut A timeout value in [ms] used during accessing the device.
  198. Note that the execution of the function itself can take longer than TimeOut because more than one
  199. access might be necessary.
  200. \return At completion, this function returns one of the following status codes:
  201. \retval CL_ERR_NO_ERR No error occurred
  202. \retval CL_ERR_BUFFER_TOO_SMALL The pXMLIDs buffer is too small
  203. \retval CL_ERR_TIMEOUT A timeout occurred
  204. \retval CL_ERR_INVALID_COOKIE The cookie supplied is invalid
  205. */
  206. CLPROTOCOLEXPORT CLINT32 CLPROTOCOL clpGetXMLIDs ( ISerial *pSerial, const CLUINT32 Cookie, CLINT8* pXMLIDs, CLUINT32* pBufferSize, const CLUINT32 TimeOut );
  207. /*!
  208. \brief This function retrieves an XML file from the camera if possible
  209. The DLL may ask the camera for the XML code, or may have the code as a resource compiled in
  210. itself or even may have it's own private registry mechanism installed.
  211. In order to support the latter use case the long DeviceID is supplied which contains
  212. the driver dll's directory.
  213. \param[in] pSerial Pointer to the interface giving access to the serial port
  214. \param[in] Cookie Token supplied by the driver dll via the clpProbeDevice function.
  215. \param[in] pXMLID A pointer to a NULL terminated string containing the connected device's XML ID
  216. \param[out] pXMLBuffer A pointer to a user-allocated buffer. Can be NULL if only the size of the
  217. buffer is requested (see pBufferSize)
  218. \param[in,out] pBufferSize pBufferSize As an input, the value contains the size of the buffer that
  219. is passed through the pDeviceID parameter.
  220. On successful return, this parameter contains the number of bytes written into the buffer,
  221. including the NULL termination character.
  222. On CL_ERR_BUFFER_TOO_SMALL, this parameter contains the size of the buffer needed to write
  223. the data text.
  224. \param[in] TimeOut A timeout value in [ms] used during accessing the device.
  225. Note that the execution of the function itself can take longer than TimeOut because more than one
  226. access might be necessary.
  227. \return At completion, this function returns one of the following status codes:
  228. \retval CL_ERR_NO_ERR No error occurred
  229. \retval CL_ERR_BUFFER_TOO_SMALL The pDeviceID buffer is too small
  230. \retval CL_ERR_NO_XMLDESCRIPTION_FOUND No XML description could be retrieved for the given XML ID
  231. \retval CL_ERR_TIMEOUT A timeout occurred
  232. \retval CL_ERR_INVALID_COOKIE The cookie supplied is invalid
  233. */
  234. CLPROTOCOLEXPORT CLINT32 CLPROTOCOL
  235. clpGetXMLDescription( ISerial *pSerial, const CLUINT32 Cookie, const CLINT8* pXMLID, CLINT8* pXMLBuffer, CLUINT32* pBufferSize, const CLUINT32 TimeOut );
  236. /*!
  237. \brief This function reads numBytes from the serial device referred to by serialRef.
  238. clSerialRead will return when numBytes are available at the serial port or
  239. when the serialTimeout period has passed.
  240. Upon success, numBytes are copied into buffer.
  241. In the case of any error, including CL_ERR_TIMEOUT, no data is copied into buffer.
  242. \param[in] pSerial The interface giving access to the serial port
  243. \param[in] Cookie Token supplied by the driver dll via the clpProbeDevice function.
  244. \param[in] Address Address the data is to be read from
  245. \param[out] pBuffer Points to a user-allocated buffer. Upon a successful call,
  246. buffer contains the data read from the serial device.
  247. Caller should ensure that buffer is at least numBytes in size.
  248. \param[in] BufferSize This is the number of bytes requested by the caller.
  249. \param[in] TimeOut A timeout value in [ms] used during accessing the device.
  250. Note that there may be specific commands which may take longer than TimeOut to be
  251. accessed. Since clpReadRegister is missing a CL_ERR_PENDING_WRITE mechanism the
  252. CLProcotol DLL may be forced for these commands to delay the return for more than TimeOut.
  253. \return On completion, this function returns one of the following status codes:
  254. \retval CL_ERR_NO_ERR No error occurred
  255. \retval CL_ERR_TIMEOUT A timeout occurred
  256. \retval CL_ERR_INVALID_COOKIE The cookie supplied is invalid
  257. */
  258. CLPROTOCOLEXPORT CLINT32 CLPROTOCOL
  259. clpReadRegister(ISerial *pSerial, const CLUINT32 Cookie, const CLINT64 Address, CLINT8* pBuffer, const CLINT64 BufferSize, const CLUINT32 TimeOut );
  260. /*!
  261. \brief This function writes numBytes to the serial device referred to by serialRef.
  262. clSerialRead will return when numBytes are available at the serial port or
  263. when the serialTimeout period has passed.
  264. Upon success, numBytes are copied into buffer.
  265. In the case of any error, including CL_ERR_TIMEOUT, no data is copied into buffer.
  266. \param[in] pSerial The interface giving access to the serial port
  267. \param[in] Cookie ManToken supplied by the driver dll via the clpProbeDevice function.
  268. \param[in] Address Address the data is to be read from
  269. \param[in] pBuffer Points to a containing the data to be written
  270. Caller should ensure that buffer is at least BufferSize in size.
  271. \param[in] BufferSize This is the number of bytes to be written.
  272. \param[in] TimeOut A timeout value in [ms] used during accessing the device.
  273. If the CLProtocol DLL knowns for specific registers that accessing them will take longer
  274. than TiemOut for a good reason, e.g., because some re-calibration is triggered, it can
  275. use the \ref CL_ERR_PENDING_WRITE mechanism to inform the client abou this and prolong
  276. the waiting time.
  277. \return On completion, this function returns one of the following status codes:
  278. \retval CL_ERR_NO_ERR No error occurred
  279. \retval CL_ERR_TIMEOUT A timeout occurred
  280. \retval CL_ERR_INVALID_COOKIE The cookie supplied is invalid
  281. \retval CL_ERR_PENDING_WRITE The timeout has expired but the write is still pending for a good reason.
  282. The next call must be \ref clpContinueWriteRegister
  283. */
  284. CLPROTOCOLEXPORT CLINT32 CLPROTOCOL
  285. clpWriteRegister(ISerial *pSerial, const CLUINT32 Cookie, const CLINT64 Address, const CLINT8* pBuffer, const CLINT64 BufferSize, const CLUINT32 TimeOut );
  286. /*!
  287. \brief Calling This function is called after a write function returned CL_ERR_PENDING_WRITE. It either issues another wait for write cycle or cancels the write action
  288. This function must be called if clpWriteRegister or clpContinueWriteRegister returns CL_ERR_PENDING_WRITE.
  289. Note, that the CLProtocol.dll is responsible for preventing an endless number of calls to this
  290. function by tracking the total time elapsed since the original call and returning CL_ERR_TIMEOUT
  291. if this time is larger than the write operation should normally take place.
  292. \param[in] pSerial The interface giving access to the serial port
  293. \param[in] Cookie ManToken supplied by the driver dll via the clpProbeDevice function.
  294. \param[in] ContinueWaiting If true the function will block waiting for the previous call to clpWriteRegister to finish. If false the call will be cancelled.
  295. \param[in] TimeOut A timeout value in [ms] used during accessing the device.
  296. \return On completion, this function returns one of the following status codes:
  297. \retval CL_ERR_NO_ERR No error occurred
  298. \retval CL_ERR_TIMEOUT A timeout occurred
  299. \retval CL_ERR_INVALID_COOKIE The cookie supplied is invalid
  300. \retval CL_ERR_PENDING_WRITE The timeout has expired but the write is still pending for a good reason. The next call must be \ref clpContinueWriteRegister
  301. */
  302. CLPROTOCOLEXPORT CLINT32 CLPROTOCOL
  303. clpContinueWriteRegister(ISerial *pSerial, const CLUINT32 Cookie, const BOOL8 ContinueWaiting, const CLUINT32 TimeOut );
  304. /*!
  305. \brief This function converts an error code to error text for display in a
  306. dialog box or in a standard I/O window.
  307. Note: clGetErrorText first looks for the error code in CCTserial.dll.
  308. If the error code is not found in CCTserial.dll, it is not a standard Camera Link error.
  309. clGetErrorText then passes the error code to the manufacturer-specific .dll,
  310. which returns the manufacturer-specific error text.
  311. \param[in] errorCode The error code used to find the appropriate error text.
  312. An error code is returned by every function in this library.
  313. \param[out] errorText A caller-allocated buffer which contains the
  314. NULL-terminated error text on function return.
  315. \param[in,out] errorTextSize On success, contains the number of bytes written
  316. into the buffer, including the NULL-termination character.
  317. This value should be the size in bytes of the error text
  318. buffer passed in. On CL_ERR__BUFFER_TOO_SMALL,
  319. contains the size of the buffer needed to write the error text.
  320. \param[in] Cookie Used only for CL_ERR_GET_LAST_ERROR. Returns the last error
  321. fired on the connection identified by the Cookie
  322. \return On completion, this function returns one of the following status codes:
  323. \retval CL_ERR_NO_ERR No error occurred
  324. \retval CL_ERR_BUFFER_TOO_SMALL The pDeviceID buffer is too small
  325. \retval CL_ERR_ERROR_NOT_FOUND No error string could be retrieved for the given error number
  326. */
  327. CLPROTOCOLEXPORT CLINT32 CLPROTOCOL
  328. clpGetErrorText( CLINT32 errorCode, CLINT8* errorText, CLUINT32* errorTextSize, const CLUINT32 Cookie = NULL);
  329. /*!
  330. \brief This function disconnects the DLL from the device
  331. When this function is called all resources allocated in the driver DLL and associated
  332. with the Cookie are deleted and the Cookie becomes invalid.
  333. \param[in] Cookie ManToken supplied by the driver dll via the clpProbeDevice function.
  334. \return On completion, this function returns one of the following status codes:
  335. \retval CL_ERR_NO_ERR No error occurred
  336. \retval CL_ERR_INVALID_COOKIE The cookie supplied is invalid
  337. */
  338. CLPROTOCOLEXPORT CLINT32 CLPROTOCOL
  339. clpDisconnect( const CLUINT32 Cookie );
  340. /*!
  341. \brief This function returns the version of the CLProtocol interface version
  342. The function is required to ensure this interface can be extended.
  343. \param[out] pVersionMajor If this parameter changes backward compatibility is broken.
  344. \param[out] pVersionMinor If this parameter changes backward compatibility is maintained.
  345. \return On completion, this function returns one of the following status codes:
  346. \retval CL_ERR_NO_ERR No error occurred
  347. */
  348. CLPROTOCOLEXPORT CLINT32 CLPROTOCOL
  349. clpGetCLProtocolVersion( CLUINT32 *pVersionMajor, CLUINT32 *pVersionMinor );
  350. /*!
  351. \brief This function is call to read a CLProtocol parameter value.
  352. \param[in] param The parameter to read.
  353. \param[in] Cookie Token supplied by the driver dll via the clpProbeDevice function.
  354. Some parameters ignore the Cookie.
  355. \param[in] pBuffer Points to a user-allocated buffer. Upon a successful call,
  356. buffer contains the value of the parameter.
  357. \param[in] BufferSize This is the number of bytes to be written.
  358. Caller must ensure that buffer size match the parameters size.
  359. \param[in] TimeOut A timeout value in [ms] used during accessing the device.
  360. \return On completion, this function returns one of the following status codes:
  361. \retval CL_ERR_NO_ERR No error occurred
  362. \retval CL_ERR_TIMEOUT A timeout occurred
  363. \retval CL_ERR_PARAM_NOT_SUPPORTED The parameters is not supported
  364. */
  365. CLPROTOCOLEXPORT CLINT32 CLPROTOCOL
  366. clpGetParam( ISerial *pSerial, CLP_PARAMS param, const CLUINT32 Cookie, CLINT8* pBuffer, const CLINT64 BufferSize, const CLUINT32 TimeOut);
  367. /*!
  368. \brief This function is call to change a CLProtocol parameter value.
  369. \param[in] param The parameter to be changed.
  370. \param[in] Cookie Token supplied by the driver dll via the clpProbeDevice function.
  371. Some parameters ignore the Cookie.
  372. \param[in] pBuffer Points to a buffer containing the data to be written
  373. \param[in] BufferSize This is the number of bytes in the buffer.
  374. Caller must ensure that buffer size match the parameters size.
  375. \param[in] TimeOut A timeout value in [ms] used during accessing the device.
  376. \return On completion, this function returns one of the following status codes:
  377. \retval CL_ERR_NO_ERR No error occurred
  378. \retval CL_ERR_TIMEOUT A timeout occurred
  379. \retval CL_ERR_PARAM_NOT_SUPPORTED The parameters is not supported
  380. */
  381. CLPROTOCOLEXPORT CLINT32 CLPROTOCOL
  382. clpSetParam( ISerial *pSerial, CLP_PARAMS param, const CLUINT32 Cookie, const CLINT8* pBuffer, const CLINT64 BufferSize, const CLUINT32 TimeOut);
  383. /*!
  384. \brief This function is call know if a parameter is supported by a CLProtocol.
  385. \param[in] param The parameter to probe.
  386. \return On completion, this function returns one of the following status codes:
  387. \retval CL_ERR_NO_ERR The parameters is supported
  388. \retval CL_ERR_PARAM_NOT_SUPPORTED The parameters is not supported
  389. */
  390. CLPROTOCOLEXPORT CLINT32 CLPROTOCOL
  391. clpIsParamSupported( CLP_PARAMS param);
  392. /*!
  393. \brief This function is call to get a possible event by a CLProtocol.
  394. \param[in] pSerial Pointer to the interface giving access to the serial port
  395. \param[in] Cookie Token supplied by the driver dll via the clpProbeDevice function.
  396. \param[out] pBuffer A pointer to a user-allocated buffer into which the function
  397. copies the event data.
  398. \param[in,out] pBufferSize As an input, the value contains the size of the buffer that
  399. is passed through the pBuffer parameter.
  400. On successful return, this parameter contains the number of bytes written into the buffer,
  401. including the NULL termination character.
  402. On CL_ERR_BUFFER_TOO_SMALL, this parameter contains the size of the buffer needed to write
  403. the data text.
  404. \return On completion, this function returns one of the following status codes:
  405. \retval CL_ERR_NO_ERR The next event is copied to pBuffer
  406. \retval CL_ERR_TIMEOUT There was no new event received
  407. \retval CL_ERR_BUFFER_TOO_SMALL The pBuffer is too small
  408. \retval CL_ERR_INVALID_COOKIE The cookie supplied is invalid
  409. */
  410. CLPROTOCOLEXPORT CLINT32 CLPROTOCOL
  411. clpGetEventData(const CLUINT32 Cookie, CLINT8* pBuffer, CLUINT32* pBufferSize);
  412. /*@}*/ // CLProtocolInterface
  413. /*@}*/ // PublicInterfaces
  414. #endif // CLPROTOCOL_CLPROTOCOL_H