FG Camera Library
1.5.1.0 (2024-05-13)
|
|
Functions for management of cameras and the library.
◆ FG_get_camera_type()
◆ FG_get_last_error()
UINT32 FG_get_last_error |
( |
char * |
error_sting, |
|
|
UINT32 |
max_string_size |
|
) |
| |
Returns an error description for the last failed library call.
- Note
- This function can be called multiple times without clearing the error description.
- The message should not be parsed by the application because the message text can change for new versions of the library.
- Beginning with library version 1.4.0.0, error messages are stored for each thread separately. Therefore, this function must be called by the same thread as the function which failed.
- Beginning with library version 1.4.0.0, the error message is updated for all types of errors, not only for FG_ERROR_CODE_ExtraErrorInformation.
- Parameters
-
error_sting | A pointer to a preallocated buffer, which contains a zero-terminated string after a successful call. |
max_string_size | The total size of the passed buffer. The string will be truncated if the error message is too long. |
- Returns
- FG_ERROR_CODE_NoError (0) for success, other values indicate an error (see eFG_ERROR_CODE)
- Example:
- The following helper function checks the result of a library function and throws an exception with the error description in case of an error.
void TestFGResultAndThrowException(UINT32 fgResult)
{
return;
{
char ErrText[500];
throw std::runtime_error(ErrText);
}
throw std::runtime_error("Invalid argument");
throw std::runtime_error("Invalid camera channel");
throw std::runtime_error("Acquisition timeout");
throw std::runtime_error("Image is broken");
throw std::runtime_error("Unknown error");
else
throw std::runtime_error(std::string("Unknown error code: ") + std::to_string(fgResult));
}
The helper function can then be used like follows: try {
} catch (std::exception &err) {
printf("FG Camera function failed:\n%s\n", err.what());
}
◆ FG_get_version()
Returns the library version.
A short summary which features the dependencies can be found in the Introduction. But this library is part of a complete SDK and inside this you will find a release document which describes the changes from version to version in detail.
- Parameters
-
lib_version | Pointer for storing the libary version |
printf("\nuse FGCamera: \n - v%d.%d.%d.%d\n\n",
- Returns
- FG_ERROR_CODE_NoError (0) for success, other values indicate an error (see eFG_ERROR_CODE)
◆ FG_install_camera()
Opens and initializes the camera.
This function must be used before other camera functions can be used. All sensor parameters are initialized with default values.
- Parameters
-
- Returns
- FG_ERROR_CODE_NoError (0) for success, other values indicate an error (see eFG_ERROR_CODE)
◆ FG_uninstall_camera()
UINT32 FG_uninstall_camera |
( |
void |
| ) |
|
Closes the camera.
Before calling this function, image acquisition should be stopped and all image buffers should be released, please refer to the example code.
- Returns
- FG_ERROR_CODE_NoError (0) for success, other values indicate an error (see eFG_ERROR_CODE)
UINT8 minor
Minor version number.
Definition: FG_CameraInterface.h:165
UINT8 patchlevel
Patch level.
Definition: FG_CameraInterface.h:166
UINT8 major
Major version number.
Definition: FG_CameraInterface.h:164
UINT32 DLL_FG_API FG_get_last_error(char *error_sting, UINT32 max_string_size)
Returns an error description for the last failed library call.
Definition: FG_CameraInterface.cpp:521
UINT32 DLL_FG_API FG_install_camera(enum eFG_CAMERA_TYPE camera_type)
Opens and initializes the camera.
Definition: FG_CameraInterface.cpp:282
@ FG_ERROR_CODE_GrabTimeOut
Only valid for FG_get_image(): acquisition timeout.
Definition: FG_CameraInterface.h:133
@ FG_CAMERA_TYPE_X_X_IMAGO_Vxx_AUTO
IMAGO VisionCam/Sensor (automatic)
Definition: FG_CameraInterface.h:54
UINT32 DLL_FG_API FG_get_version(FG_VERSION *lib_version)
Returns the library version.
Definition: FG_CameraInterface.cpp:544
@ FG_ERROR_CODE_BrokenImage
Only valid for FG_get_image(): the returned image contents are invalid.
Definition: FG_CameraInterface.h:134
@ FG_ERROR_CODE_InvalidArgument
The function arguments are invalid.
Definition: FG_CameraInterface.h:131
@ FG_ERROR_CODE_InvalidCameraChannel
The selected camera channel is invalid.
Definition: FG_CameraInterface.h:132
@ FG_ERROR_CODE_NoError
The function was successful.
Definition: FG_CameraInterface.h:129
struct for the library version "libFGCamera.so.major.minor.patchlevel.buildnumber"
Definition: FG_CameraInterface.h:163
@ FG_ERROR_CODE_ExtraErrorInformation
Other errors, use FG_get_last_error() to obtain the error message.
Definition: FG_CameraInterface.h:135
UINT8 buildnumber
Build number.
Definition: FG_CameraInterface.h:167
@ FG_ERROR_CODE_Unknown
Unknown error.
Definition: FG_CameraInterface.h:130