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