
6 List available cameras
6 List available cameras
For a quick start see ListCameras example of the Vimba SDK.
VmbCamerasList will enumerate all cameras recognized by the underlying transport layers. With this
command, the programmer can fetch all static details of a camera such as its ID, its model and vendor
name or the ID of the interface (e.g. the network or 1394 adapter) it is connected to. For 1394 cameras
this attempt is straightforward, as opposed to GigE; due to its asynchronous nature, listing cameras over
the network is a two-step process. First a device discovery request has to be sent out before Vimba API
can be aware of all GigE devices that answered that request. Vimba API puts the developer in charge of
deciding how to send out discovery packets. However, this can be achieved through the command features
GeVDiscoveryAllOnce and GeVDiscoveryAllAuto, whereby the latter constantly emits discovery commands.
To stop discovery, use the command feature GeVDiscoveryAllNone. Note that these features can be applied
to all network interfaces as well as to one particular interface only. See Listing 1for an example.
Listing 1: Get Cameras
1bool bGigE ;
2VmbUint32_t nCount ;
3VmbCameraInfo_t *pCameras ;
4
5// We ask Vimba for the presence of a GigE transport layer
6VmbError_t err = VmbFeatureBoolGet( gVimbaHandle , " GeVTLIsPresent ", &bGigE );
7if ( VmbErrorSuccess == err )
8{
9if (true == bGigE )
10 {
11 // We query all network interfaces using the global Vimba handle
12 err = VmbFeatureCommandRun ( gVimbaHandle , " GeVDiscoveryAllOnce" );
13 // Wait for the discovery packets to return
14 Sleep( 200 );
15 }
16 }
17 if ( VmbErrorSuccess == err )
18 {// Get the amount of connected cameras
19 err = VmbCamerasList( NULL , 0, &nCount , sizeof * pCameras );
20
21 if ( VmbErrorSuccess == err )
22 {
23 // Allocate accordingly
24 pCameras = new VmbCameraInfo_t[ nCount ];
25 // Get the cameras
26 err = VmbCamerasList( pCameras , nCount , &nCount , sizeof *pCameras );
27 // Print out each camera 's name
28 for ( VmbUint32_t i=0; i<nCount ; ++i )
29 {
30 std :: cout << pCameras [i ]. ca meraNa me << std :: endl ;
31 }
32 }
33 }
The VmbCameraInfo_t struct provides the entries listed in Table 1for obtaining information about a
camera.
To get notified whenever a camera is detected, disconnected, or changes its open state, use
VmbFeatureInvalidationRegister to register a callback that gets executed on the according event.
Vimba C API - Programmer's Manual
8 / 19