ISerial.h 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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_ISERIAL_H
  30. #define CLPROTOCOL_ISERIAL_H
  31. #include <ObjBase.h>
  32. #include <CLProtocol\CLSerialTypes.h>
  33. //==============================================================================
  34. // Macros
  35. //==============================================================================
  36. #ifdef CLPROTOCOL_EXPORTS
  37. #define CLPROTOCOLEXPORT USER_EXTERN_C __declspec(dllexport)
  38. #else
  39. #define CLPROTOCOLEXPORT USER_EXTERN_C __declspec(dllimport)
  40. #endif
  41. #ifndef CLPROTOCOL
  42. #define CLPROTOCOL __cdecl
  43. #endif
  44. //==============================================================================
  45. // Exported Functions
  46. //==============================================================================
  47. /*! \ingroup PublicInterfaces */
  48. /*@{*/
  49. //! Abstract interface used by the CLProtocol driver to use a serial port
  50. class ISerial
  51. {
  52. public:
  53. //! calls clSerialRead as defined by the camera link standard
  54. virtual CLINT32 CLPROTOCOL clSerialRead(
  55. CLINT8* buffer, //!< Points to a user-allocated buffer. Upon a successful call,
  56. //!< buffer contains the data read from the serial device.
  57. //!< Upon failure, this buffer is not affected.
  58. //!< Caller should ensure that buffer is at least numBytes in size.
  59. CLUINT32* bufferSize, //!< This is the number of bytes requested by the caller.
  60. CLUINT32 serialTimeOut //!< Indicates the timeout in milliseconds.
  61. ) = 0;
  62. //! calls clSerialWrite as defined by the camera link standard
  63. virtual CLINT32 CLPROTOCOL clSerialWrite(
  64. CLINT8* buffer, //!< Contains data to write to the serial device.
  65. CLUINT32* bufferSize,//!< Contains the buffer size indicating
  66. //!< the number of bytes to be written.
  67. //!< Upon a successful call, bufferSize contains the number of
  68. //!< bytes written to the serial device.
  69. CLUINT32 serialTimeOut //!< Indicates the timeout in milliseconds.
  70. ) = 0;
  71. //! returns the valid baud rates of the current interface.
  72. virtual CLINT32 CLPROTOCOL clGetSupportedBaudRates(
  73. CLUINT32 *baudRates //!< Bitfield that describes all supported baud rates of the serial port
  74. ) = 0; //!< as described by serialRefPtr. See Table B-2 of the Camera Link
  75. //!< docu for more information on constants.
  76. //! This function sets the baud rate for the serial port of the selected device.
  77. virtual CLINT32 CLPROTOCOL clSetBaudRate(
  78. CLUINT32 baudRate //!< The baud rate you want to use. This parameter expects the
  79. ) = 0; //!< values represented by the CL_BAUDRATE constants in table B-2.
  80. //!< By default, the baud rate for serial communication is 9600.
  81. };
  82. /*@}*/ // PublicInterfaces
  83. #endif // CLPROTOCOL_ISERIAL_H