![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Software Development Kit (SDK) - GigE Extension |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
![]() |
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
. | ![]() |
Runtime 5 December 2016 New in runtime 5.4.3: Sending GigE Vision Action Commands via Firmware (see section 2.8) Supported Frame Grabbers:
GigE Vision:
Supported Operating Systems:
|
int Gbe_initBoard(int board, int init_flag, BoardHandle** board_handle_ptr) |
Parameters
Parameter |
Type |
Description |
board |
int |
Logical board number. |
init_flag |
int |
Should be 0. |
board_handle_ptr | BoardHandle** | Pointer reference to BoardHandle. |
Return Values
Return Value |
Description |
0 |
Frame grabber has been initialized successfully. |
<0 |
Gbe error code |
Syntax
void Gbe_freeBoard(BoardHandle* board_handle) |
Parameters
Parameter |
Type |
Description |
board_handle | BoardHandle* | BoardHandle. |
Functional Description
Gbe_scanNetwork() accomplishes a network scan. Though, GigE Vision compatible cameras is searched for. This model either scans each port (-1) or a special port (0 - 3) which can be selected.Syntax
int Gbe_scanNetwork(BoardHandle* board_handle, int port, int discovery_timeout) |
Parameters
Parameter |
Type |
Description |
board_handle | BoardHandle* | BoardHandle. |
port | int | Port which shall be scanned:
-1 if all ports shall be scanned, |
discovery_timeout | int | Timeout for camera detection. The value is in ms. |
Return Values
Return Value |
Description |
0 |
Network has been scanned successfully. |
<0 |
Gbe error code |
Functional Description
Gbe_getCameraCount() determines the number of detected GigE cameras per port.Gbe_getFirstCamera() fetches a handle to the first detected camera.
Gbe_getCameraByMac() fetches a handle to a camera with a defenite MAC address.
Gbe_getCameraByUserName() fetches a handle to a camera with a name given by the user.
Gbe_freeCamera() is freeing a camera handle.
Gbe_getCameraInfo() reads information about detected cameras.
Gbe_freeCameraInfo() is freeing the information structure.
Syntax
int Gbe_getCameraCount(BoardHandle* board_handle, int port) |
Parameters
Parameter |
Type |
Description |
board_handle | BoardHandle* | BoardHandle. |
port | int | Connected port (0 - 3). |
Return Values
Return Value |
Description |
> 0 | Number of camera(s) that have been detected. |
0 |
Frame grabber has been initialized successfully. |
<0 |
Gbe error code |
Syntax
int Gbe_getFirstCamera(BoardHandle* board_handle, int port, CameraHandle** camera_handle_ptr) |
Parameters
Parameter |
Type |
Description |
board_handle | BoardHandle* | BoardHandle. |
port | int | Connected port (0 - 3). |
camera_handle_ptr | CameraHandle** | Pointer to camera handle. |
Return Values
Return Value |
Description |
0 |
The first camera has been fetched successfully. |
<0 |
Gbe error code |
Syntax
int Gbe_getCameraByMac(BoardHandle* board_handle, int port, uint8_t mac[6], CameraHandle** camera_handle_ptr) |
Parameters
Parameter |
Type |
Description |
board_handle | BoardHandle* | BoardHandle. |
port | int | Port which shall be scanned. |
mac | uint8_t* | MAC address of the camera. |
camera_handle_ptr | CameraHandle** | Pointer to camera handle. |
Return Values
Return Value |
Description |
0 |
The camera has been fetched successfully. |
<0 |
Gbe error code |
Syntax
int Gbe_getCameraByMac(BoardHandle* board_handle, int port, char* user_name, CameraHandle** camera_handle_ptr) |
Parameters
Parameter |
Type |
Description |
board_handle | BoardHandle* | BoardHandle. |
port | int | Port which shall be scanned. |
user_name | char* | Name of the camera, settable by the user. |
camera_handle_ptr | CameraHandle** | Pointer to camera handle. |
Return Values
Return Value |
Description |
0 |
The camera has been fetched successfully. |
<0 |
Gbe error code |
Syntax
int Gbe_freeCamera(CameraHandle *camera_handle) |
Parameters
Parameter |
Type |
Description |
camera_handle | CameraHandle* | Camera handle. |
Return Values
Return Value |
Description |
0 |
Freeing the camera has been succeded. |
<0 |
Gbe error code |
Syntax
CameraInfo* Gbe_getCameraInfo(CameraHandle* camera_handle) |
Parameters
Parameter |
Type |
Description |
camera_handle | CameraHandle* | Camera handle. |
struct CameraInfo{ |
The camera information structure contains information that can be read out of a GigE Vision compatible camera:
Parameter |
Type |
Description |
manufactor_name | char* | The name of the camera manufacturer. |
model_name | char* | The name of the camera model. |
device_version | char* | Version number of the camera model. |
manufacturer_info | char* | Information of the manufacturer. |
serial_number | char* | Serial number of the camera. |
user_name | char* | Name of the camera, settable by the user. |
mac | uint8_t* | MAC address of the camera. |
Return Values
Return Value |
Description |
0 |
Error getting camera info. |
!=0 |
Pointer to camera info structure |
Syntax
void Gbe_freeCameraInfo(CameraInfo* camera_info) |
Parameters
Parameter |
Type |
Description |
camera_info | CameraInfo* | Release of camera information structure. |
Functional Description
Gbe_connectCamera() connects a camera that has been found within network with the port which it has been detected on. At the moment only one camera can be connected with a port. After establishing the connection, the data of the camera's XML file will be read and the user can access to the camera.Gbe_disconnectCamera() closes the connection between camera and port.
Gbe_switchCameraConnection() enables the correlation modification of a camera to a card or a port during an existing connection. Though, the camera can be assigned to a new card and / or to a new port.
Syntax
int Gbe_connectCamera(CameraHandle *camera_handle) |
Parameters
Parameter |
Type |
Description |
camera_handle | CameraHandle* | Camera handle. |
Return Values
Return Value |
Description |
0 |
The camera has been connected successfully. |
<0 |
Gbe error code |
Syntax
int Gbe_disconnectCamera(CameraHandle *camera_handle) |
Parameters
Parameter |
Type |
Description |
camera_handle | CameraHandle* | Camera handle. |
Return Values
Return Value |
Description |
0 |
The camera has been disconnected successfully. |
<0 |
Gbe error code |
Syntax
int Gbe_switchCameraConnection(CameraHandle *camera_handle, BoardHandle* board_handle, int port) |
Parameters
Parameter |
Type |
Description |
camera_handle | CameraHandle* | Camera handle. |
board_handle | BoardHandle* | BoardHandle. |
port | int | Connected port (0 - 3). |
Return Values
Return Value |
Description |
0 |
The camera connection has been switched successfully. |
<0 |
Gbe error code |
Functional Description
Gbe_setIntegerValue() writes an integer value to the camera.Gbe_getIntegerValue() reats an integer value from the camera.
Gbe_setBooleanValue() writes a boolean value to the camera.
Gbe_getBooleanValue() reats a boolean value from the camera.
Gbe_setFloatValue() writes a floating value (double) to the camera.
Gbe_getFloatValue() reats a floating value (double) from the camera.
Gbe_setStringValue() writes a String to the camera.
Gbe_getStringValue() reats a String from the camera.
Gbe_setEnumerationValue() writes an enumeration value to the camera.
Gbe_getEnumerationValue() reats an enumeration value from the camera.
Gbe_executeCommand() executes a command directly on the camera.
Gbe_isCommandDone() checks whether the command has been done.
Gbe_enableChecks() is an expert fuction! It switches the Genicam Check on / off, if the function is available.
Gbe_lockTLParams() is an expert fuction! Locks the transport layer parameters.
Gbe_unlockTLParams() is an expert fuction! Unlocks the transport layer parameters.
Gbe_invalidateCache() is an expert fuction!
Syntax
int Gbe_setIntegerValue(CameraHandle *camera_handle, const char* name, int64_t value) |
Parameters
Parameter |
Type |
Description |
camera_handle | CameraHandle* | Pointer to camera handle. |
name | const char* | Name of the register. |
value | int64_t | Integer value that shall be written. |
Return Values
Return Value |
Description |
0 |
The integer value has been set successfully. |
<0 |
Gbe error code |
Syntax
int Gbe_getIntegerValue(CameraHandle *camera_handle, const char* name, int64_t* value_ptr) |
Parameters
Parameter |
Type |
Description |
camera_handle | CameraHandle* | Pointer to camera handle. |
name | const char* | Name of the register. |
value_ptr | int64_t* | Integer value that shall be read. |
Return Values
Return Value |
Description |
0 |
The integer value has been gotten successfully. |
<0 |
Gbe error code |
Syntax
int Gbe_setBooleanValue(CameraHandle *camera_handle, const char* name, unsigned int value) |
Parameters
Parameter |
Type |
Description |
camera_handle | CameraHandle* | Pointer to camera handle. |
name | const char* | Name of the register. |
value | unsigned int | Boolean value that has to be written. |
Return Values
Return Value |
Description |
0 |
The boolean value has been set successfully. |
<0 |
Gbe error code |
Syntax
int Gbe_getBooleanValue(CameraHandle *camera_handle, const char* name, unsigned int* value_ptr) |
Parameters
Parameter |
Type |
Description |
camera_handle | CameraHandle* | Pointer to camera handle. |
name | const char* | Name of the register. |
value_ptr | unsigned int* | Boolean value that has to be read. |
Return Values
Return Value |
Description |
0 |
The boolean value has been gotten successfully. |
<0 |
Gbe error code |
Syntax
int Gbe_setFloatValue(CameraHandle *camera_handle, const har* name, double value) |
Parameters
Parameter |
Type |
Description |
camera_handle | CameraHandle* | Pointer to camera handle. |
name | const char* | Name of the register. |
value | double | Double value that has to be written. |
Return Values
Return Value |
Description |
0 |
The double value has been set successfully. |
<0 |
Gbe error code |
Syntax
int Gbe_getFloatValue(CameraHandle *camera_handle, char* name, double* value_ptr) |
Parameters
Parameter |
Type |
Description |
camera_handle | CameraHandle* | Pointer to camera handle. |
name | const char* | Name of the register. |
value_ptr | double* | Double value that has to be read. |
Return Values
Return Value |
Description |
0 |
The double value has been gotten successfully. |
<0 |
Gbe error code |
Syntax
int Gbe_setStringValue(CameraHandle *camera_handle, const char* name, const char* value) |
Parameters
Parameter |
Type |
Description |
camera_handle | CameraHandle* | Pointer to camera handle. |
name | const char* | Name of the register. |
value | const char* | String that has to be written. |
Return Values
Return Value |
Description |
0 |
The String has been set successfully. |
<0 |
Gbe error code |
Syntax
int Gbe_getStringValue(CameraHandle *camera_handle, char* name, const char** value_ptr) |
Parameters
Parameter |
Type |
Description |
camera_handle | CameraHandle* | Camera handle. |
name | const char* | Name of the register. |
value_ptr | const char** | Reference to the pointer of the String that has to be read. |
Return Values
Return Value |
Description |
0 |
The String has been gotten successfully. |
<0 |
Gbe error code |
Syntax
int Gbe_setEnumerationValue(CameraHandle *camera_handle, const char* name, const char* value) |
Parameters
Parameter |
Type |
Description |
camera_handle | CameraHandle* | Camera handle. |
name | const char* | Name of the register. |
value | const char* | Enumeration value that has to be written. |
Return Values
Return Value |
Description |
0 |
The enumeration value has been set successfully. |
<0 |
Gbe error code |
Syntax
int Gbe_getEnumerationValue(CameraHandle *camera_handle, const char* name, const char** value_ptr) |
Parameters
Parameter |
Type |
Description |
camera_handle | CameraHandle* | Camera handle. |
name | const char* | Name of the register. |
value_ptr | const char* | Pointer to the enumeration value that has to be read. |
Return Values
Return Value |
Description |
0 |
The enumeration value has been gotten successfully. |
<0 |
Gbe error code |
Syntax
int Gbe_executeCommand(CameraHandle *camera_handle, const char* name) |
Parameters
Parameter |
Type |
Description |
camera_handle | CameraHandle* | Camera handle. |
name | const char* | Name of the register. |
Return Values
Return Value |
Description |
0 |
The command has successfully been sent directly to the camera. |
<0 |
Gbe error code |
Syntax
int Gbe_isCommandDone(CameraHandle *camera_handle, const char* name) |
int Gbe_enableChecks(CameraHandle* camera_handle, unsigned int flag) |
Parameters
Parameter |
Type |
Description |
camera_handle | CameraHandle* | Camera handle. |
flag | unsigned int | 0: Disables all checks. 1: Enables all checks. |
int Gbe_lockTLParams(CameraHandle *camera_handle) |
int Gbe_unlockTLParams(CameraHandle *camera_handle) |
Parameters
Parameter |
Type |
Description |
camera_handle | CameraHandle* | Pointer to camera handle. |
Return Values
Return Value |
Description |
0 |
The transport layer parameters have been unlocked successfully. |
<0 |
Gbe error code |
Syntax
int Gbe_invalidateCache(CameraHandle *camera_handle) |
Parameters
Parameter |
Type |
Description |
camera_handle | CameraHandle* | Camera handle. |
Return Values
Return Value |
Description |
0 |
Cahe successfully invalidated. |
<0 |
Gbe error code |
Functional Description
Gbe_startAcquisition() starts the grabbing within the camera.Gbe_stopAcquisition() stops the grabbing of the camera.
Syntax
int Gbe_startAcquisition(CameraHandle *camera_handle) |
int Gbe_stopAcquisition(CameraHandle *camera_handle) |
Parameters
Parameter |
Type |
Description |
camera_handle | CameraHandle* | Camera handle. |
Return Values
Return Value |
Description |
0 |
The acquisition has been stopped successfully. |
<0 |
Gbe error code |
The SiliconSoftware frame grabber SDK extension for GigE Vision allows an application to react asynchronously on certain events created by the GigE Vision subsystem. These events are either
- created by GigE Vision cameras according to the GigE Vision protocol specification or
- created by the Basler Runtime components itself.
Therefore a mechanism of callback functions is implemented. This mechanism works in addition to the callback / event mechanism defined at the general SiliconSoftware frame grabber SDK (“fglib”, for details see the frame grabber SDK manual).
Event notification is available at 2 different levels:
- board events (camera events, related to the frame grabber),
- camera events (events related to an attached camera).
The following table shows the available event notifications:
Event Type | Level | Remarks |
GBE_EVENT_GEVEVENT | Camera | An event triggered by the camera and sent by using the GigE Vision protocol. |
GBE_EVENT_CAMERA_CONECTION_LOST | Camera | An already attached camera disappeared |
GBE_EVENT_DISCOVERY_CHANGE | Board | A camera has been detected by the discovery process, e.g. a camera is connected to a frame grabber port |
Depending of the type of the event, additional data is delivered, when the notification is done, e.g.
- the camera port, when a camera has been detected
- the camera handle, when a camera got lost
- payload data from camera, in case of GigE Vision events.
Therefore event subsystem of the GBE library consists of 2 functions
- Gbe_registerBoardEventCallback
- Gbe_registerCameraEventCallback,
including the corresponding declarations of callback functions types.
The callback handlers will be informed about the type of event and additional event data if available by declaring a data structure GbeEventInfo_Struct. The user’s context out of the registration of callback handlers might be passed by additional user data pointer, which can be passed when calling the according Gbe_registerXXXXEventCallback functions.
Example:
// callback handler for camera events
int CameraEventHandler)(struct BoardHandle *boardHandle,
const GbeEventInfo *const eventInfo,
const void *userData)
{
(myClass*) userData ->data; // Access some data….
}
// method to register the event handler
// passes a pointer to the object towards the SDK, which can
// be accessed at the callback function
Void myClass::DoRegisterCallback()
{
// Pass the context to the callback handler (this-pointer)
Gbe_registerCameraEventCallback(&CameraEventHandler, this);
}
Remarks:
Details of the usage can be seen at a specific SDK example for GbE.
This chapter describes the usage and retrieval of events, sent by a GigE Vision camera according to the GigE Vision standard specification. For additional details see also the GigE Vision standard.
Which events of this type are available within the SDK correlates directly with the functionality of a specific, connected GigE Vision camera. In general, the GigE Vision events can be read by using the camera’s GenICam files, for example by using the SiliconSoftware GenICam Explorer tool. Activation and deactivation of the events can be done by accessing the according GenICam parameters of the cameras. Therefore the parameter interface of the SiliconSoftware GigE SDK can be used:
- Gbe_setEnumerationValue()
- Gbe_setIntegerValue()
- …
When an event occurs, the callback handler gets informed about details of the GigE Vision event by the GbeEventInfo structure indicated by type == GBE_EVENT_GEVEVENT. Additional data retrieved from the GigE Vision protocol is stored in form of the GigE Vision event structure. For further details please refer to the camera manufacturer’s documentation.
These events are indicated by different event types, which are passed by the GebEventInfo structure.
GebEventInfo.type : GBE_EVENT_XXX, where XXX <> GEVEVENT
For further details, see the SDK function list documentation.
In addition to sending action commands per software, you can also send action commands via the firmware of your Basler frame grabber(s) to the connected GigE Vision cameras.
For each camera channel, one dedicated action command is available in the firmware. The content (function) of each action command is defined by software.
The sending of an action command to the camera is triggered by the applet: In specific situations defined by the applet design, the applet sends an action command trigger signal to the firmware. On detecting a rising edge of this trigger signal, the firmware sends the preconfigured action command to the GigE Vision camera.
The firmware sends the action command to the camera with a fix latency of 2000 ns +/- 16 ns. This means, the time gap between the detection of the rising edge of the action command trigger signal by the firmware and the actual sending of the action command by the firmware is always 2000 ns +/- 16 ns.
The index number of the action command is the same as the index number of the connected camera port. There is a 1:1 connection between the action command trigger in VisualApplets and the corresponding GigE Vision camera.
microEnable 4 GigE Vision frame Grabber using Action Commands
To be able to use this feature, the following firmware and software must be used:
To use action commands with acquisition applets delivered by Basler, you need to proceed the following steps:
The following sections describe how to proceed these steps in detail. An SDK Example for implementing Action Commands is available in our documentation.
You configure the firmware for sending action commands via SDK. See the SDK Example, lines 165 - 193.
For each camera, exactly 1 dedicated action command is implemented in the firmware.
To configure the firmware for using action commands:
Use Same Values as in Camera Configuration: Make sure you set the same values here as are set in the corresponding camera configuration. Otherwise, action commands will not be acknowledged by the camera.
Since we use a 1:1 connection between firmware and camera, the actual values are of no importance. Therefore, all cameras can use the same device key as they are not connected via a network.
You need to configure the cameras for receiving action commands via SDK. See the SDK Example, lines 195 - 218.
For each camera, exactly 1 dedicated action command is implemented in the firmware.
For configuring the cameras, the following new camera properties are available in the SDK:
To configure the cameras for receiving action commands:
Register a camera event callback that informs you in case the camera doesn't react within the time you defined as time out threshold (see section 1.3). See the SDK Example, lines 220 - 223.
A new camera event is available in the SDK for this purpose:
To register the camera event callback:
Finally, you should activate the trigger state. See the SDK Example, lines 250 - 253.
To activate the trigger state:
The counter for pending action commands counts the number of action commands that have been sent by the applet (image processing FPGA), but for which no acknowledge packet has been sent by the camera.
Each Action Command Trigger that is sent by the applet to the firmware increments register PendingActionCmdCount. Each action command acknowledge packet received from the camera decrements registerPendingActionCmdCount.
The PendingActionCmdCount counter is overflow and underflow protected.
See the SDK Example, lines 284 - 289.
To implement the pending action command counter:
1. Enter, for example, the following lines to your code:
For information how to configure the applet, refer to the documentation of the applet you are using.
Functional Description
Gbe_getErrorDescription() Get error description.Syntax
const char* Gbe_getErrorDescription(int errcode) |
Parameters
Parameter |
Type |
Description |
errcode | int | Gbe error code. |
Return Values
Return Value |
Description |
0 |
error getting error string. |
!=0 |
error description as string |
![]() |
Forward ![]() |