-
Notifications
You must be signed in to change notification settings - Fork 5
/
decl.pxd
318 lines (282 loc) · 15.1 KB
/
decl.pxd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
import numpy as np
cimport numpy as np
# from libcpp cimport bool
# typedef signed char INT8;
# typedef unsigned char UINT8;
# typedef short INT16;
# typedef unsigned short UINT16;
# typedef float FLOAT;
# typedef int BOOL;
# typedef double DOUBLE;
# typedef long INT32;
# typedef unsigned long UINT32;
ctypedef char INT8
ctypedef unsigned char UINT8
ctypedef short INT16
ctypedef unsigned short UINT16
ctypedef bint BOOL
ctypedef long INT32
ctypedef unsigned long UINT32
ctypedef UINT8* PUINT8
ctypedef UINT32* PUINT32
ctypedef int GEV_STATUS
# typedef struct
# {
# UINT32 version;
# UINT32 logLevel;
# UINT32 numRetries;
# UINT32 command_timeout_ms;
# UINT32 discovery_timeout_ms;
# UINT32 enumeration_port;
# UINT32 gvcp_port_range_start;
# UINT32 gvcp_port_range_end;
# } GEVLIB_CONFIG_OPTIONS, *PGEVLIB_CONFIG_OPTIONS;
ctypedef struct GEVLIB_CONFIG_OPTIONS:
UINT32 version
UINT32 logLevel
UINT32 numRetries
UINT32 command_timeout_ms
UINT32 discovery_timeout_ms
UINT32 enumeration_port
UINT32 gvcp_port_range_start
UINT32 gvcp_port_range_end
# // Buffer object structure - returned
# typedef struct _tag_GEVBUF_ENTRY
# {
# UINT32 state; // Full/empty state for image buffer
# UINT32 status; // Frame Status (success, error types) (see below - GEV_FRAME_STATUS_*)
# UINT32 timestamp_hi;
# UINT32 timestamp_lo;
# UINT32 recv_size; // Received size for buffer (allows variable sized data).
# UINT32 id; // Block id for image (starts at 1, wraps to 1 at 65535).
# UINT32 h; // Received heigth (pixels) for this buffer
# UINT32 w; // Received width (pixels) for ROI in this buffer
# UINT32 x_offset; // Received x offset for origin of ROI in this buffer
# UINT32 y_offset; // Received y offset for origin of ROI in this buffer
# UINT32 x_padding; // Received x padding bytes (invalid data padding end of each line [horizontal invalid])
# UINT32 y_padding; // Received y padding bytes (invalid data padding end of image [vertical invalid])
# UINT32 d; // Received depth (bytes per pixel) for this buffer
# UINT32 format; // Received format for image.
# PUINT8 address;
# } GEVBUF_ENTRY, *PGEVBUF_ENTRY, GEVBUF_HEADER, *PGEVBUF_HEADER, GEV_BUFFER_OBJECT, *PGEV_BUFFER_OBJECT;
ctypedef struct GEV_BUFFER_OBJECT:
UINT32 state
UINT32 status
UINT32 timestamp_hi
UINT32 timestamp_lo
UINT32 recv_size
UINT32 id
UINT32 h
UINT32 w
UINT32 x_offset
UINT32 y_offset
UINT32 x_padding
UINT32 y_padding
UINT32 d
UINT32 format
PUINT8 address
ctypedef GEV_CAMERA_INFO* PGEV_CAMERA_INFO
ctypedef void* GEV_CAMERA_HANDLE
# typedef enum
# {
# GevMonitorMode = 0,
# GevControlMode = 2,
# GevExclusiveMode = 4
# } GevAccessMode;
ctypedef enum GevAccessMode:
GevMonitorMode = 0
GevControlMode = 2
GevExclusiveMode = 4
# // Buffer cycling control definition
# typedef enum
# {
# Asynchronous = 0,
# SynchronousNextEmpty = 1
# } GevBufferCyclingMode;
ctypedef enum GevBufferCyclingMode:
Asynchronous = 0
SynchronousNextEmpty = 1
# typedef struct
# {
# UINT32 numRetries;
# UINT32 command_timeout_ms;
# UINT32 heartbeat_timeout_ms;
# UINT32 streamPktSize; // GVSP max packet size ( less than or equal to MTU size).
# UINT32 streamPktDelay; // Delay between packets (microseconds) - to tune packet pacing out of NIC.
# UINT32 streamNumFramesBuffered; // # of frames to buffer (min 2)
# UINT32 streamMemoryLimitMax; // Maximum amount of memory to use (puts an upper limit on the # of frames to buffer).
# UINT32 streamMaxPacketResends; // Maximum number of packet resends to allow for a frame (defaults to 100).
# UINT32 streamFrame_timeout_ms; // Frame timeout (msec) after leader received.
# INT32 streamThreadAffinity; // CPU affinity for streaming thread (marshall/unpack/write to user buffer) - default handling is "-1"
# INT32 serverThreadAffinity; // CPU affinity for packet server thread (recv/dispatch) - default handling is "-1"
# UINT32 msgChannel_timeout_ms;
# } GEV_CAMERA_OPTIONS, *PGEV_CAMERA_OPTIONS;
ctypedef struct GEV_CAMERA_OPTIONS:
UINT32 numRetries
UINT32 command_timeout_ms
UINT32 heartbeat_timeout_ms
UINT32 streamPktSize #// GVSP max packet size ( less than or equal to MTU size).
UINT32 streamPktDelay #// Delay between packets (microseconds) - to tune packet pacing out of NIC.
UINT32 streamNumFramesBuffered #// # of frames to buffer (min 2)
UINT32 streamMemoryLimitMax #// Maximum amount of memory to use (puts an upper limit on the # of frames to buffer).
UINT32 streamMaxPacketResends #// Maximum number of packet resends to allow for a frame (defaults to 100).
UINT32 streamFrame_timeout_ms #// Frame timeout (msec) after leader received.
INT32 streamThreadAffinity #// CPU affinity for streaming thread (marshall/unpack/write to user buffer) - default handling is "-1"
INT32 serverThreadAffinity #// CPU affinity for packet server thread (recv/dispatch) - default handling is "-1"
UINT32 msgChannel_timeout_ms
cdef extern from "gevapi.h":
# typedef struct
# {
# BOOL fIPv6; // GEV is only IPv4 for now.
# UINT32 ipAddr;
# UINT32 ipAddrLow;
# UINT32 ipAddrHigh;
# UINT32 ifIndex; // Index of network interface (set by system - required for packet interface access).
# } GEV_NETWORK_INTERFACE, *PGEV_NETWORK_INTERFACE;
ctypedef struct GEV_NETWORK_INTERFACE:
BOOL fIPv6
UINT32 ipAddr
UINT32 ipAddrLow
UINT32 ipAddrHigh
UINT32 ifIndex
#pass
# typedef struct
# {
# BOOL fIPv6; // GEV is only IPv4 for now.
# UINT32 ipAddr;
# UINT32 ipAddrLow;
# UINT32 ipAddrHigh;
# UINT32 macLow;
# UINT32 macHigh;
# GEV_NETWORK_INTERFACE host;
# UINT32 mode;
# UINT32 capabilities;
# char manufacturer[MAX_GEVSTRING_LENGTH+1];
# char model[MAX_GEVSTRING_LENGTH+1];
# char serial[MAX_GEVSTRING_LENGTH+1];
# char version[MAX_GEVSTRING_LENGTH+1];
# char username[MAX_GEVSTRING_LENGTH+1];
# } GEV_DEVICE_INTERFACE, *PGEV_DEVICE_INTERFACE, GEV_CAMERA_INFO, *PGEV_CAMERA_INFO;
ctypedef struct GEV_CAMERA_INFO:
BOOL fIPv6
UINT32 ipAddr
UINT32 ipAddrLow
UINT32 ipAddrHigh
UINT32 macLow
UINT32 macHigh
GEV_NETWORK_INTERFACE host
UINT32 capabilities
char[65] manufacturer
char[65] model
char[65] serial
char[65] version
char[65] username
# //====================================================================
# // Public API
# //====================================================================
# // API Initialization
# GEV_STATUS GevApiInitialize(void);
# GEV_STATUS GevApiUninitialize(void);
GEV_STATUS GevApiInitialize()
GEV_STATUS GevApiUninitialize()
# //====================================================================
# // API Configuratoin options
# GEV_STATUS GevGetLibraryConfigOptions( GEVLIB_CONFIG_OPTIONS *options);
# GEV_STATUS GevSetLibraryConfigOptions( GEVLIB_CONFIG_OPTIONS *options);
GEV_STATUS GevGetLibraryConfigOptions(GEVLIB_CONFIG_OPTIONS* options)
GEV_STATUS GevSetLibraryConfigOptions(GEVLIB_CONFIG_OPTIONS* options)
# //=================================================================================================
# // Camera automatic discovery
# int GevDeviceCount(void); // Get the number of Gev devices seen by the system.
# GEV_STATUS GevGetCameraList( GEV_CAMERA_INFO *cameras, int maxCameras, int *numCameras); // Automatically detect and list cameras.
int GevDeviceCount()
GEV_STATUS GevGetCameraList(GEV_CAMERA_INFO* cameras, int maxCameras, int* numCameras)
# GEV_STATUS GevForceCameraIPAddress( UINT32 macHi, UINT32 macLo, UINT32 IPAddress, UINT32 subnetmask);
# GEV_STATUS GevEnumerateNetworkInterfaces(GEV_NETWORK_INTERFACE *pIPAddr, UINT32 maxInterfaces, PUINT32 pNumInterfaces );
# //=================================================================================================
# // Utility function (external) for discovering camera devices.
# GEV_STATUS GevEnumerateGevDevices(GEV_NETWORK_INTERFACE *pIPAddr, UINT32 discoveryTimeout, GEV_DEVICE_INTERFACE *pDevice, UINT32 maxDevices, PUINT32 pNumDevices );
# // Camera Manual discovery/setup
# GEV_STATUS GevSetCameraList( GEV_CAMERA_INFO *cameras, int numCameras); // Manually set camera list from data structure.
# //=================================================================================================
# // Gige Vision Camera Access
# GEV_STATUS GevOpenCamera( GEV_CAMERA_INFO *device, GevAccessMode mode, GEV_CAMERA_HANDLE *handle);
GEV_STATUS GevOpenCamera(GEV_CAMERA_INFO* device, GevAccessMode mode, GEV_CAMERA_HANDLE* handle)
# GEV_STATUS GevOpenCameraByAddress( unsigned long ip_address, GevAccessMode mode, GEV_CAMERA_HANDLE *handle);
# GEV_STATUS GevOpenCameraByName( char *name, GevAccessMode mode, GEV_CAMERA_HANDLE *handle);
# GEV_STATUS GevOpenCameraBySN( char *sn, GevAccessMode mode, GEV_CAMERA_HANDLE *handle);
# GEV_STATUS GevCloseCamera(GEV_CAMERA_HANDLE *handle);
GEV_STATUS GevCloseCamera(GEV_CAMERA_HANDLE* handle)
# GEV_CAMERA_INFO *GevGetCameraInfo( GEV_CAMERA_HANDLE handle);
# GEV_STATUS GevGetCameraInterfaceOptions( GEV_CAMERA_HANDLE handle, GEV_CAMERA_OPTIONS *options);
GEV_STATUS GevGetCameraInterfaceOptions(GEV_CAMERA_HANDLE handle, GEV_CAMERA_OPTIONS* options)
# GEV_STATUS GevSetCameraInterfaceOptions( GEV_CAMERA_HANDLE handle, GEV_CAMERA_OPTIONS *options);
GEV_STATUS GevSetCameraInterfaceOptions(GEV_CAMERA_HANDLE handle, GEV_CAMERA_OPTIONS* options)
# //=================================================================================================
# // Manual GigeVision access to GenICam XML File
# GEV_STATUS Gev_RetrieveXMLData( GEV_CAMERA_HANDLE handle, int size, char *xml_data, int *num_read, int *data_is_compressed );
# GEV_STATUS Gev_RetrieveXMLFile( GEV_CAMERA_HANDLE handle, char *file_name, int size, BOOL force_download );
# //=================================================================================================
# // GenICam XML Feature Node Map manual registration/access functions (for use in C++ code).
# GEV_STATUS GevConnectFeatures( GEV_CAMERA_HANDLE handle, void *featureNodeMap);
# void * GevGetFeatureNodeMap( GEV_CAMERA_HANDLE handle);
# //=================================================================================================
# // GenICam XML Feature access functions (C language compatible).
# GEV_STATUS GevGetGenICamXML_FileName( GEV_CAMERA_HANDLE handle, int size, char *xmlFileName);
# GEV_STATUS GevInitGenICamXMLFeatures( GEV_CAMERA_HANDLE handle, BOOL updateXMLFile);
# GEV_STATUS GevInitGenICamXMLFeatures_FromFile( GEV_CAMERA_HANDLE handle, char *xmlFileName);
# GEV_STATUS GevInitGenICamXMLFeatures_FromData( GEV_CAMERA_HANDLE handle, int size, void *pXmlData);
# GEV_STATUS GevGetFeatureValue( GEV_CAMERA_HANDLE handle, const char *feature_name, int *feature_type, int value_size, void *value);
# GEV_STATUS GevSetFeatureValue( GEV_CAMERA_HANDLE handle, const char *feature_name, int value_size, void *value);
# GEV_STATUS GevGetFeatureValueAsString( GEV_CAMERA_HANDLE handle, const char *feature_name, int *feature_type, int value_string_size, char *value_string);
# GEV_STATUS GevSetFeatureValueAsString( GEV_CAMERA_HANDLE handle, const char *feature_name, const char *value_string);
# //=================================================================================================
# // Camera image acquisition
# GEV_STATUS GevGetImageParameters(GEV_CAMERA_HANDLE handle,PUINT32 width, PUINT32 height, PUINT32 x_offset, PUINT32 y_offset, PUINT32 format);
GEV_STATUS GevGetImageParameters(GEV_CAMERA_HANDLE handle, PUINT32 width, PUINT32 height, PUINT32 x_offset, PUINT32 y_offset, PUINT32 format)
# GEV_STATUS GevSetImageParameters(GEV_CAMERA_HANDLE handle,UINT32 width, UINT32 height, UINT32 x_offset, UINT32 y_offset, UINT32 format);
GEV_STATUS GevSetImageParameters(GEV_CAMERA_HANDLE handle,UINT32 width, UINT32 height, UINT32 x_offset, UINT32 y_offset, UINT32 format)
# GEV_STATUS GevInitImageTransfer( GEV_CAMERA_HANDLE handle, GevBufferCyclingMode mode, UINT32 numBuffers, UINT8 **bufAddress);
GEV_STATUS GevInitImageTransfer( GEV_CAMERA_HANDLE handle, GevBufferCyclingMode mode, UINT32 numBuffers, UINT8 **bufAddress)
# GEV_STATUS GevInitializeImageTransfer( GEV_CAMERA_HANDLE handle, UINT32 numBuffers, UINT8 **bufAddress);
GEV_STATUS GevInitializeImageTransfer( GEV_CAMERA_HANDLE handle, UINT32 numBuffers, UINT8 **bufAddress)
# GEV_STATUS GevFreeImageTransfer( GEV_CAMERA_HANDLE handle);
GEV_STATUS GevFreeImageTransfer( GEV_CAMERA_HANDLE handle)
# GEV_STATUS GevStartImageTransfer( GEV_CAMERA_HANDLE handle, UINT32 numFrames);
GEV_STATUS GevStartImageTransfer(GEV_CAMERA_HANDLE handle, int numFrames)
# GEV_STATUS GevStopImageTransfer( GEV_CAMERA_HANDLE handle);
GEV_STATUS GevStopImageTransfer(GEV_CAMERA_HANDLE handle)
# GEV_STATUS GevAbortImageTransfer( GEV_CAMERA_HANDLE handle);
GEV_STATUS GevAbortImageTransfer( GEV_CAMERA_HANDLE handle)
# GEV_STATUS GevQueryImageTransferStatus( GEV_CAMERA_HANDLE handle, PUINT32 pTotalBuffers, PUINT32 pNumUsed, PUINT32 pNumFree, PUINT32 pNumTrashed, GevBufferCyclingMode *pMode);
# int GetPixelSizeInBytes (UINT32 pixelType);
int GetPixelSizeInBytes(UINT32 pixelType)
# // +Coming soon
# GEV_STATUS GevResetImageTransfer( GEV_CAMERA_HANDLE handle );
# // -Coming soon
# GEV_STATUS GevGetNextImage( GEV_CAMERA_HANDLE handle, GEV_BUFFER_OBJECT **image_object_ptr, struct timeval *pTimeout);
# GEV_STATUS GevGetImageBuffer( GEV_CAMERA_HANDLE handle, void **image_buffer);
GEV_STATUS GevGetImageBuffer( GEV_CAMERA_HANDLE handle, void** image_buffer)
# GEV_STATUS GevGetImage( GEV_CAMERA_HANDLE handle, GEV_BUFFER_OBJECT **image_object);
# GEV_STATUS GevWaitForNextImageBuffer( GEV_CAMERA_HANDLE handle, void **image_buffer, UINT32 timeout);
GEV_STATUS GevWaitForNextImageBuffer(GEV_CAMERA_HANDLE handle, void** image_buffer, UINT32 timeout)
# GEV_STATUS GevWaitForNextImage( GEV_CAMERA_HANDLE handle, GEV_BUFFER_OBJECT **image_object, UINT32 timeout);
GEV_STATUS GevWaitForNextImage( GEV_CAMERA_HANDLE handle, GEV_BUFFER_OBJECT** image_object, UINT32 timeout)
# GEV_STATUS GevReleaseImage( GEV_CAMERA_HANDLE handle, GEV_BUFFER_OBJECT *image_object_ptr);
# GEV_STATUS GevReleaseImageBuffer( GEV_CAMERA_HANDLE handle, void *image_buffer_ptr);
GEV_STATUS GevReleaseImageBuffer( GEV_CAMERA_HANDLE handle, void* image_buffer_ptr)
# //=================================================================================================
# // Camera event handling
# GEV_STATUS GevRegisterEventCallback(GEV_CAMERA_HANDLE handle, UINT32 EventID, GEVEVENT_CBFUNCTION func, void *context);
# GEV_STATUS GevRegisterApplicationEvent(GEV_CAMERA_HANDLE handle, UINT32 EventID, _EVENT appEvent);
# GEV_STATUS GevUnregisterEvent(GEV_CAMERA_HANDLE handle, UINT32 EventID);
# BOOL GevIsPixelTypeMono( UINT32 pixelType);
# BOOL GevIsPixelTypeRGB( UINT32 pixelType);
# BOOL GevIsPixelTypeCustom( UINT32 pixelType);
# BOOL GevIsPixelTypePacked( UINT32 pixelType);
# UINT32 GevGetPixelSizeInBytes( UINT32 pixelType);
# UINT32 GevGetPixelDepthInBits( UINT32 pixelType);
UINT32 GevGetPixelDepthInBits(UINT32 pixelType)
# UINT32 GevGetRGBPixelOrder( UINT32 pixelType);
# GEVLIB_STATUS GevTranslateRawPixelFormat( UINT32 rawFormat, PUINT32 translatedFormat, PUINT32 bitDepth, PUINT32 order);
# const char *GevGetFormatString( UINT32 format);