ISerialAdapterCStyle.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. //-----------------------------------------------------------------------------
  2. // (c) 2009 by Basler
  3. // Section: Digital Imaging
  4. // Project: CLProtocol
  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. */
  28. #ifndef CLPROTOCOL_ISERIALADAPTERCSTYLE_H
  29. #define CLPROTOCOL_ISERIALADAPTERCSTYLE_H
  30. #include <CLProtocol\ISerialAdapter.h>
  31. #if( defined(__cplusplus) || defined(__cplusplus__) )
  32. extern "C"
  33. #else
  34. namespace CLProtocol
  35. #endif
  36. // The following declarations enable you to create an ISerialAdapter using pure C.
  37. // For an example see RequirementsAndTests::TestIStructCVersion in CLProtocolTest
  38. // The following link gives some technical background http://www.codeproject.com/KB/COM/com_in_c1.aspx
  39. {
  40. typedef CLINT32 (CLPROTOCOL *clSerialReadPtr)(
  41. void * This,
  42. CLINT8* buffer,
  43. CLUINT32* bufferSize,
  44. CLUINT32 serialTimeOut
  45. );
  46. typedef CLINT32 (CLPROTOCOL *clSerialWritePtr)(
  47. void * This,
  48. CLINT8* buffer,
  49. CLUINT32* bufferSize,
  50. CLUINT32 serialTimeOut
  51. );
  52. typedef CLINT32 (CLPROTOCOL *clGetSupportedBaudRatesPtr)(
  53. void * This,
  54. CLUINT32 *baudRates
  55. );
  56. typedef CLINT32 (CLPROTOCOL *clSetBaudRatePtr)(
  57. void * This,
  58. CLUINT32 baudRate
  59. );
  60. typedef CLINT32 (CLPROTOCOL *SerialInitPtr)(
  61. void * This
  62. );
  63. typedef void (CLPROTOCOL *SerialClosePtr)(
  64. void * This
  65. );
  66. typedef void (CLPROTOCOL *CheckErrorPtr)(
  67. void * This,
  68. CLUINT32 ErrorCode
  69. );
  70. typedef struct ISerialAdapterVtbl_t
  71. {
  72. clSerialReadPtr *clSerialRead;
  73. clSerialWritePtr *clSerialWrite;
  74. clGetSupportedBaudRatesPtr *clGetSupportedBaudRates;
  75. clSetBaudRatePtr *clSetBaudRate;
  76. SerialInitPtr *SerialInit;
  77. SerialClosePtr *SerialClose;
  78. CheckErrorPtr *CheckError;
  79. } ISerialAdapterVtbl_t;
  80. typedef struct ISerialAdapter_t
  81. {
  82. struct ISerialAdapterVtbl_t *lpVtbl;
  83. } ISerialAdapter_t;
  84. }
  85. #endif