FLI libflipro API
WorkingWithModes.cpp

Mode Retrieval Example Code.
Each camera comes with a built in set of modes. A mode is in turn a set of predefined register settings to produce a given type of image. See your user documentation for the modes defined by your camera.


To facilitate user interface programming, each mode has a human readable name that can be displayed on a GUI or console. Modes are set by index on the camera. This example shows the use of retreieving the set of modes and their names and how to set a specific mode by its index.

#if defined(_WIN32) || defined(_WINDOWS)
#include "stdafx.h"
#endif
#include "stdint.h"
#include "stdlib.h"
#include "libflipro.h"
#define FLI_TEST_MAX_SUPPORTED_CAMERAS (4)
// Static Function declarations
// Static Data declarations
static int32_t s_iDeviceHandle;
uint32_t uiNumDetectedDevices;
static FPRODEVICEINFO s_camDeviceInfo[FLI_TEST_MAX_SUPPORTED_CAMERAS];
int main()
{
int32_t iResult;
uint32_t uiModeCount;
uint32_t uiCurrentMode;
FPROSENSMODE modeInfo;
uint32_t i;
// first get the list of available devices
uiNumDetectedDevices = FLI_TEST_MAX_SUPPORTED_CAMERAS;
iResult = FPROCam_GetCameraList(s_camDeviceInfo, &uiNumDetectedDevices);
if ((iResult >= 0) && (uiNumDetectedDevices > 0))
{
// Open the first device in the list
s_iDeviceHandle = -1;
iResult = FPROCam_Open(&s_camDeviceInfo[0], &s_iDeviceHandle);
if ((iResult >= 0) && (s_iDeviceHandle >= 0))
{
// Get the numer of available modes and the current mode setting (index)
iResult= FPROSensor_GetModeCount(s_iDeviceHandle, &uiModeCount, &uiCurrentMode);
// get each of the modes- and process
for (i = 0; (i < uiModeCount) && (iResult >= 0); ++i)
{
iResult= FPROSensor_GetMode(s_iDeviceHandle, i, &modeInfo);
if (iResult >= 0)
{
// You now have the name of the mode for index 'i'
// For convenience, the index of the mode is also returned in the
// FPROSENSMODE structure. It is this index you will use in FPROSensor_SetMode()
}
}
// Set the current mode to the second mode in the list
if (uiModeCount >= 2)
iResult= FPROSensor_SetMode(s_iDeviceHandle, 1);
// Close up shop
iResult = FPROCam_Close(s_iDeviceHandle);
}
}
return 0;
}
Finger Lakes Instrumentation Camera API.
LIBFLIPRO_API FPROCam_Open(FPRODEVICEINFO *pDevInfo, int32_t *pHandle)
Connects to the camera specified by the pDevInfo parameter.
LIBFLIPRO_API FPROCam_Close(int32_t iHandle)
Disconnects from the camera an releases the handle.
LIBFLIPRO_API FPROSensor_GetMode(int32_t iHandle, uint32_t uiModeIndex, FPROSENSMODE *pMode)
Retrieves the current mode name for the specified index.
LIBFLIPRO_API FPROSensor_SetMode(int32_t iHandle, uint32_t uiModeIndex)
Sets the current mode specified by the given index.
LIBFLIPRO_API FPROCam_GetCameraList(FPRODEVICEINFO *pDeviceInfo, uint32_t *pNumDevices)
FPROCam_GetCameraList.
LIBFLIPRO_API FPROSensor_GetModeCount(int32_t iHandle, uint32_t *pCount, uint32_t *pCurrentMode)
Retrieves the current mode count and current mode index setting.
Definition: libflipro.h:365
Definition: libflipro.h:715