All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ClAllSerial.h
Go to the documentation of this file.
1 //
3 // Title : clallserial.h
4 // Created : 12/03/2003 @ 14:27:00
5 //
6 // Copyright (c) 2004. National Instruments Corporation
7 // All rights reserved.
8 //
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted, provided that each of the following
11 // conditions are met. By using the software in any manner, you agree
12 // to each of the following:
13 // - All redistributions of the software must be accompanied with the
14 // above copyright notice (provided however that for redistributions
15 // in binary form, the copyright notice may be omitted), the above
16 // preamble, this list of conditions, and the disclaimer set forth below.
17 // - Except for the copyright notice required above, neither the name
18 // or trademarks of National Instruments Corporation (NI) nor the names
19 // of its contributors may be used in any manner (including, but not
20 // limited to, using the same to endorse or promote products derived from
21 // this software) without the specific prior written permission of NI.
22 //
23 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 // "AS IS" WITHOUT WARRANTY OF ANY KIND. NO WARRANTIES, EITHER EXPRESS
25 // OR IMPLIED, ARE MADE WITH RESPECT TO THE SOFTWARE, INCLUDING, BUT
26 // NOT LIMITED TO, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
27 // FOR A PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT, OR ANY OTHER
28 // WARRANTIES THAT MAY ARISE FROM USAGE OF TRADE OR COURSE OF DEALING.
29 // THE COPYRIGHT HOLDERS AND CONTRIBUTORS DO NOT WARRANT, GUARANTEE, OR
30 // MAKE ANY REPRESENTATIONS REGARDING THE USE OF OR THE RESULTS OF THE
31 // USE OF THE SOFTWARE IN TERMS OF CORRECTNESS, ACCURACY, RELIABILITY,
32 // OR OTHERWISE AND DO NOT WARRANT THAT THE OPERATION OF THE SOFTWARE
33 // WILL BE UNINTERRUPTED OR ERROR FREE. THE ENTIRE RISK AS TO THE
34 // PERFORMANCE OF THE SOFTWARE IS WITH YOU. IN NO EVENT SHALL THE
35 // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
36 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
37 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
38 // OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
39 // AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
40 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
41 // THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF ADVISED OF THE
42 // POSSIBILITY OF SUCH DAMAGE.
43 //
45 #ifndef CLPROTOCOL_CLALLSERIAL_H
46 #define CLPROTOCOL_CLALLSERIAL_H
47 
49 
50 //==============================================================================
51 // Macros
52 //==============================================================================
53 
54 #if (defined(__cplusplus) || defined(__cplusplus__))
55  #define USER_EXTERN_C extern "C"
56 #else
57  #define USER_EXTERN_C
58 #endif
59 
60 #ifdef CLALLSERIAL_EXPORTS
61  #if defined(_WIN32)
62  #define CLALLSERIALEXPORT USER_EXTERN_C __declspec(dllexport)
63  #else
64  #define CLALLSERIALEXPORT USER_EXTERN_C __attribute__((visibility("default")))
65  #endif
66 #else
67  #if defined(_WIN32)
68  #define CLALLSERIALEXPORT USER_EXTERN_C __declspec(dllimport)
69  #else
70  #define CLALLSERIALEXPORT USER_EXTERN_C __attribute__((visibility("default")))
71  #endif
72 #endif
73 
74 #ifndef CLALLSERIALCC
75  #if defined(_WIN32)
76  // Note that using __stdcall changes the name decoration as compared with __cdecl
77  // For details see http://www.willus.com/mingw/yongweiwu_stdcall.html
78  #define CLALLSERIALCC __stdcall
79  #else
80  #if !defined(__x86_64) && !defined(__arm__) && !defined(__aarch64__) && !defined(VXWORKS)
81  #define CLALLSERIALCC __attribute__((stdcall))
82  #else
83  #define CLALLSERIALCC /* use default calling convention */
84  #endif
85  #endif
86 #endif
87 
88 //==============================================================================
89 // Exported functions
90 //==============================================================================
92 //
93 // clFlushPort
94 //
95 // Description: Discards any bytes that are available in the input
96 // buffer.
97 //
98 // Parameters:
99 // serialRef input parameter - The value obtained by the clSerialInit function
100 // that describes the port to be flushed.
101 //
102 // Return Value: CL_ERR_NO_ERR
103 // CL_ERR_INVALID_REFERENCE
104 //
107 
108 
110 //
111 // clGetErrorText
112 //
113 // Description:
114 // Converts an error code to error text which you can
115 // display in a dialog box or in the standard I/O window.
116 // Note: This function first looks up the error code in clserial.dll to determine
117 // whether it is a standard Camera Link error. If it is a non-standard error, this function
118 // passes the error code to the manufacturer-specific DLL, which returns the
119 // manufacturer-specific error code.
120 //
121 // Parameters:
122 // manuName input parameter - The manufacturer name in a NULL-terminated
123 // buffer. Manufacturer name is returned from clGetPortInfo.
124 // errorCode input parameter - The error code used to look up the
125 // appropriate error text. This code can be returned
126 // from any function in this library.
127 // errorText output parameter - A caller-allocated buffer which will contain
128 // a NULL-terminated error description on return.
129 // errorTextSize input/output parameter - As an input, this value is the size,
130 // in bytes, of the errorText buffer that is passed in. On
131 // success, this value is the number of bytes
132 // that have been written into the buffer, including the NULL
133 // termination character. On CL_ERR_BUFFER_TOO_SMALL error,
134 // this value is the size of the buffer required to write
135 // the data text.
136 //
137 // Return Value: CL_ERR_NO_ERR
138 // CL_ERR_MANU_DOES_NOT_EXIST
139 // CL_ERR_BUFFER_TOO_SMALL
140 // CL_ERR_ERROR_NOT_FOUND
141 //
143 CLALLSERIALEXPORT CLINT32 CLALLSERIALCC clGetErrorText(const CLINT8* manuName, CLINT32 errorCode, CLINT8* errorText, CLUINT32* errorTextSize);
144 
145 
147 //
148 // clGetNumPorts
149 //
150 // Description: Returns the number of Camera Link serial ports in
151 // this machine that are supported by clallserial.dll.
152 //
153 // Parameters:
154 // numPorts output parameter - The number of Camera Link serial ports
155 // in this machine supported by this DLL.
156 //
157 // Return Value: CL_ERR_NO_ERR
158 //
161 
162 
164 //
165 // clGetNumBytesAvail
166 //
167 // Description: Outputs the number of bytes that are received, but not yet read out, at
168 // the port specified by serialRef.
169 //
170 // Parameters:
171 // serialRef input - The value obtained by the clSerialInit function.
172 // numBytes output - The number of bytes currently available to be
173 // read from the port.
174 //
175 // Return Value: CL_ERR_NO_ERR
176 // CL_ERR_INVALID_REFERENCE
177 //
180 
181 
183 //
184 // clGetPortInfo
185 //
186 // Description: This function provides information about the port specified by
187 // the index.
188 //
189 // Parameters:
190 // serialIndex input parameter - Zero-based index of the serial port you are
191 // finding the name for. Use clGetNumSerialPorts to determine
192 // the valid range of serialIndex. This range will be 0 to
193 // numSerialPorts-1.
194 // manufacturerName output parameter - Pointer to a user-allocated buffer into
195 // which the function copies the manufacturer name. The returned
196 // name is NULL-terminated. In the case that the DLL conforms to the
197 // version 1.0 Camera Link Specification, this
198 // parameter will contain the file name of the DLL rather than the
199 // manufacturer name.
200 // nameBytes input/output parameter - As an input parameter,
201 // this value is the size of the name buffer, including
202 // the NULL termination. As an output parameter, this value
203 // is the number of bytes written into the name buffer.
204 // If the provided name buffer is not large enough, this value
205 // is the number of required bytes.
206 // portID output parameter - The identifier for the port. For now, this
207 // value is the interface name. In the future, there may be an
208 // extension for multiple serial ports on one board.
209 // IDBytes input/output parameter. As an input parameter, this value is
210 // the size of the portID buffer, including
211 // the NULL termination. As an output parameter, this value is
212 // the number of bytes written into the portID buffer.
213 // If the provided portID buffer is not large enough, this value is
214 // the number of required bytes.
215 // Version The version of the Camera Link specifications with which this frame
216 // grabber software complies.
217 //
218 // Return Value: CL_ERR_NO_ERR
219 // CL_ERR_BUFFER_TOO_SMALL
220 // CL_ERR_INVALID_INDEX//
222 CLALLSERIALEXPORT CLINT32 CLALLSERIALCC clGetPortInfo(CLUINT32 serialIndex, CLINT8* manufacturerName, CLUINT32* nameBytes, CLINT8* portID, CLUINT32* IDBytes, CLUINT32* version);
223 
224 
226 //
227 // clGetSupportedBaudRates
228 //
229 // Description: Returns the valid baud rates of the interface.
230 //
231 // Parameters:
232 // serialRefPtr input parameter - The value obtained from
233 // clSerialInit function.
234 // baudRates output parameter - Indicates which baud
235 // rates are supported by this serial interface. This
236 // is represented as a bit-field. Refer to the CL_BAUDRATE_
237 // constants above for the supported baud rates.
238 //
239 // Return Value: CL_ERR_NO_ERR
240 // CL_ERR_INVALID_REFERENCE
241 // CL_ERR_FUNCTION_NOT_FOUND
242 //
245 
246 
248 //
249 // clSerialClose
250 //
251 // Description: Closes the serial device and cleans up resources associated
252 // with serialRef. Upon return, serialRef is no longer usable.
253 //
254 // Parameters:
255 // serialRef input parameter - The value obtained from clSerialInit
256 // function to clean up.
257 //
260 
261 
263 //
264 // clSerialInit
265 //
266 // Description:
267 // Initializes the device referred to by serialIndex, and
268 // returns a pointer to an internal serial reference structure.
269 //
270 // Parameters:
271 // serialIndex input parameter - Zero-based index value. If there are n
272 // serial devices in the system that is supported by this
273 // library, the range of serialIndex is 0 to (n-1).
274 // The order of the serial devices is vendor-specific. The
275 // number of serial ports supported by this DLL is
276 // output by the clGetNumSerialPorts function.
277 // serialRefPtr output parameter - Upon a successful call, a pointer to the
278 // vendor-specific reference to the current serial session
279 // will be put into the value pointed to by serialRefPtr.
280 //
281 // Return Value: CL_ERR_NO_ERR
282 // CL_ERR_PORT_IN_USE
283 // CL_ERR_INVALID_INDEX
284 // CL_ERR_UNABLE_TO_OPEN_PORT
285 //
288 
289 
291 //
292 // clSerialRead
293 //
294 // Description: Reads from the serial device referenced by serialRef.
295 //
296 // Note: this function has been deprecated and will not be available
297 // in Camera Link v3.0. Use the new function clSerialReadEx instead
298 //
299 // Parameters:
300 // serialRef input parameter - The value obtained from clSerialInit function
301 // buffer output parameter - Points to a user-allocated buffer.
302 // Upon a successful call, contains the data
303 // read from the serial device.
304 // bufferSize input-output parameter - As an input parameter, bufferSize contains the
305 // buffer size to indicate the maximum number of bytes that
306 // the buffer can accommodate.
307 // Upon a successful call, bufferSize is the
308 // number of bytes that were read successfully from the
309 // serial device.
310 // serialTimeout input parameter - Indicates the timeout, in milliseconds
311 //
312 // Return value CL_ERR_NO_ERR
313 // CL_ERR_TIMEOUT
314 // CL_ERR_INVALID_REFERENCE
315 //
317 CLALLSERIALEXPORT CLINT32 CLALLSERIALCC clSerialRead(hSerRef serialRef, CLINT8* buffer, CLUINT32* bufferSize, CLUINT32 serialTimeout);
318 
319 
321 //
322 // clSerialReadEx
323 //
324 // Description: Reads from the serial device referenced by serialRef.
325 //
326 // Parameters:
327 // serialRef input parameter - The value obtained from clSerialInit function
328 // buffer output parameter - Points to a user-allocated buffer.
329 // Upon a successful call, contains the data
330 // read from the serial device.
331 // numBytes input-output parameter - As an input parameter, numBytes contains the
332 // buffer size, to indicate the maximum number of bytes that
333 // the buffer can accommodate.
334 // Upon a successful call (CL_ERR_NO_ERR or CL_ERR_TIMEOUT), numBytes
335 // is the number of bytes that were read successfully from the
336 // serial device.
337 // serialTimeout input parameter - Indicates the timeout in milliseconds. This
338 // parameter may be set to 0.
339 //
340 // Return value CL_ERR_NO_ERR
341 // CL_ERR_TIMEOUT
342 // CL_ERR_INVALID_REFERENCE
343 //
345 CLALLSERIALEXPORT CLINT32 CLALLSERIALCC clSerialReadEx(hSerRef serialRef, CLINT8* buffer, CLUINT32* numBytes, CLUINT32 serialTimeout);
346 
347 
349 //
350 // clSerialWrite
351 //
352 // Description: This function writes data in buffer to the serial device
353 // referenced by serialRef.
354 //
355 // Parameters:
356 // serialRef input parameter - The value obtained from clSerialInit function
357 // buffer input parameter - Contains data to write to the serial port
358 // bufferSize input/output parameter - As an input parameter, bufferSize contains the
359 // number of bytes of data in the buffer to write to the
360 // serial device. Upon a successful call, bufferSize contains the
361 // number of bytes that was written successfully to the
362 // serial device.
363 // serialTimeout input parameter - Indicates the timeout, in milliseconds
364 //
365 // Return value: CL_ERR_NO_ERR
366 // CL_ERR_INVALID_REFERENCE
367 // CL_ERR_TIMEOUT
369 CLALLSERIALEXPORT CLINT32 CLALLSERIALCC clSerialWrite(hSerRef serialRef, CLINT8* buffer, CLUINT32* bufferSize, CLUINT32 serialTimeout);
370 
371 
373 //
374 // clSetBaudRate
375 //
376 // Description: Sets the Baud Rate for the serial port of the
377 // selected port. Use clGetSupportedBaudRates to determine
378 // supported baud rates.
379 //
380 // Parameters:
381 // serialRef input parameter - The value obtained from
382 // clSerialInit function.
383 // baudRate input parameter - The baud rate you want to use. This
384 // input expects the values represented by the CL_BAUDRATE
385 // constants.
386 //
387 // Return Value: CL_ERR_NO_ERR
388 // CL_ERR_INVALID_REFERENCE
389 // CL_ERR_BAUD_RATE_NOT_SUPPORTED
390 //
393 
394 #endif // CLPROTOCOL_CLALLSERIAL_H
clGetPortInfo
CLALLSERIALEXPORT CLINT32 CLALLSERIALCC clGetPortInfo(CLUINT32 serialIndex, CLINT8 *manufacturerName, CLUINT32 *nameBytes, CLINT8 *portID, CLUINT32 *IDBytes, CLUINT32 *version)
clSerialClose
CLALLSERIALEXPORT void CLALLSERIALCC clSerialClose(hSerRef serialRef)
CLINT8
char CLINT8
Definition: ClSerialTypes.h:126
CLUINT32
unsigned int CLUINT32
Definition: ClSerialTypes.h:105
clGetNumBytesAvail
CLALLSERIALEXPORT CLINT32 CLALLSERIALCC clGetNumBytesAvail(hSerRef serialRef, CLUINT32 *numBytes)
clSerialWrite
CLALLSERIALEXPORT CLINT32 CLALLSERIALCC clSerialWrite(hSerRef serialRef, CLINT8 *buffer, CLUINT32 *bufferSize, CLUINT32 serialTimeout)
clSerialInit
CLALLSERIALEXPORT CLINT32 CLALLSERIALCC clSerialInit(CLUINT32 serialIndex, hSerRef *serialRefPtr)
clFlushPort
CLALLSERIALEXPORT CLINT32 CLALLSERIALCC clFlushPort(hSerRef serialRef)
clGetNumPorts
CLALLSERIALEXPORT CLINT32 CLALLSERIALCC clGetNumPorts(CLUINT32 *Ports)
clGetErrorText
CLALLSERIALEXPORT CLINT32 CLALLSERIALCC clGetErrorText(const CLINT8 *manuName, CLINT32 errorCode, CLINT8 *errorText, CLUINT32 *errorTextSize)
clSetBaudRate
CLALLSERIALEXPORT CLINT32 CLALLSERIALCC clSetBaudRate(hSerRef serialRef, CLUINT32 baudRate)
CLALLSERIALCC
#define CLALLSERIALCC
Definition: ClAllSerial.h:81
clGetSupportedBaudRates
CLALLSERIALEXPORT CLINT32 CLALLSERIALCC clGetSupportedBaudRates(hSerRef serialRef, CLUINT32 *baudRates)
clSerialRead
CLALLSERIALEXPORT CLINT32 CLALLSERIALCC clSerialRead(hSerRef serialRef, CLINT8 *buffer, CLUINT32 *bufferSize, CLUINT32 serialTimeout)
clSerialReadEx
CLALLSERIALEXPORT CLINT32 CLALLSERIALCC clSerialReadEx(hSerRef serialRef, CLINT8 *buffer, CLUINT32 *numBytes, CLUINT32 serialTimeout)
hSerRef
void * hSerRef
Definition: ClSerialTypes.h:95
CLINT32
int CLINT32
Definition: ClSerialTypes.h:100
CLALLSERIALEXPORT
#define CLALLSERIALEXPORT
Definition: ClAllSerial.h:70
ClSerialTypes.h
types and constants as used by the Camera Link's API definition


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Wed Dec 4 2024 03:10:11