Contents
CONFIDENTIAL

cvsCamCtrl Library

API, data types, feature queries, and extended register functions for the CREVIS cvsCamCtrl library.

Version: 1.2.0Date: 2026-03-12

1. Overview#

cvsCamCtrl is a virtual frame grabber library provided by CREVIS. This document is a programmer's guide organized based on the attached cvsCamCtrl.h header, covering the API, constants, structures, enumerations, feature metadata query functions, and module-based extended register access functions.

1.1 Document Basis#

  • Header-first principle: Function signatures, types, default values, and enum/struct definitions are based primarily on the declarations in the attached cvsCamCtrl.h.

A typical basic usage sequence is as follows.

ST_InitSystem();
ST_UpdateDevice();            // or ST_UpdateDeviceWithTimeout()
ST_OpenDevice(...);
ST_InitBuffer(...);

/* Continuous acquisition */
ST_AcqStart(hDevice);
ST_GrabImage(...);           // or ST_GrabImageAsync(...)
ST_AcqStop(hDevice);

/* Single-shot acquisition */
ST_SingleGrabImage(...);

ST_FreeBuffer(...);
ST_CloseDevice(hDevice);
ST_FreeSystem();

1.2 Header Revision History#

Version Date Major Changes
1.0.0 2024-08-22 Initial release
1.0.4 2024-08-22 Includes 1.0.1~1.0.3
added ST_IsConnectable()
added log functionality
automatic buffer resizing
changed Grab callback behavior
added vendor filtering
adjusted resend packet count
1.0.5 2025-01-23 Added timeout-setting functionality to ST_UpdateDevice()
1.0.7 2025-06-12 Added synchronous/asynchronous Grab-related functions (including ST_GrabImageAsync)
added BU-A040M-30 support
1.0.8 2025-09-02 Corrected return values of SingleGrabImage and GrabImageSync
added model branching for SingleGrabImage
added CvsAccessType and ST_OpenDeviceMulticast
fixed automatic packet negotiation
improved GEV operation regardless of firewall settings
1.0.9 2025-09-17 Fixed a specific branch error for BU-A040M-30
1.1.0 2025-09-29 Updated the base library
1.1.1 2025-10-31 Added image stream parameter control
reviewed duplicate CVS_IMAGE definitions
changed default buffer count from 16 to 4
fixed ST_GrabImageAsync() parameters/misbehavior
removed ST_GrabStartAsync
1.1.2 2025-12-02 Revised calling convention specification
separated ST_UpdateDevice and ST_UpdateDeviceWithTimeout
1.1.3 2026-01-27 Modified parameters related to GEV stream packet resend
1.1.4 2026-03-04 Fixed a bug in a specific BU-A040M-30 model
1.2.0 2026-03-11 Added CXP interface support
added ST_GetEnumInterface
added module-based extended register/parameter functions (ST_*RegEx, ST_*ParamEx)
added feature list/metadata query functions

2. Definitions and Constants#

This section describes event IDs, error codes, device information constants, XML versions, visibility levels, module identification macros, and bit fields used to compose color conversion codes.

2.1 Event Definitions#

Events are divided into Grab events and device events. Grab events occur during the image acquisition flow, while device events occur when the device state or interface state changes.

2.1.1 Grab Events#

Name Value Description
EVENT_NEW_IMAGE 0x0 A new image was received successfully
EVENT_GRAB_ERROR 0x1 An error occurred during the Grab process
EVENT_GRAB_TIMEOUT 0x2 Grab did not complete within the specified time

2.1.2 Device Events#

Some events are supported only on specific interfaces. Based on the header comments, interface scope is distinguished by GEV, U3V, or CXP-related attributes.

Name Value Description Notes
EVENT_DEVICE_DISCONNECT 0x0010 Device disconnection detected GEV, U3V
EVENT_EXPOSURE_END 0x0014 Exposure end GEV, U3V
EVENT_ACQUISITION_TRANSFER_START 0x0018 Start of image data transfer GEV
EVENT_ACQUISITION_TRANSFER_END 0x001C End of image data transfer GEV
EVENT_OVER_TRIGGER 0x0020 Excessive trigger detected GEV
EVENT_OVER_TRIGGER_START_MISSED 0x0024 Trigger start event missed U3V
EVENT_OVER_TRIGGER_END_MISSED 0x0028 Trigger end event missed U3V
EVENT_TRIGGER_START 0x002C Trigger start detected U3V
EVENT_WARNING_TEMPERATURE_STATE 0x0030 Temperature warning state U3V
EVENT_CRITICAL_TEMPERATURE_STATE 0x0034 Critical temperature state U3V

2.2 Error Code Definitions#

In general, 0 indicates success and negative values indicate errors.

Name Value Description
MCAM_ERR_OK 0 Success
MCAM_ERR_ERROR -1001 General error
MCAM_ERR_NOT_INITIALIZED -1002 Not initialized
MCAM_ERR_NOT_IMPLEMENTED -1003 Not implemented
MCAM_ERR_BUSY -1004 Device busy
MCAM_ERR_STATE_ERROR -1005 State error
MCAM_ERR_NOT_CONNECTED -1006 Not connected
MCAM_ERR_NOT_FOUND -1007 Not found
MCAM_ERR_NO_MORE_ITEM -1008 No more items
MCAM_ERR_INVALID_PARAMETER -1009 Invalid parameter
MCAM_ERR_FILE_ERROR -1010 File error
MCAM_ERR_TIMEOUT -1011 Timeout
MCAM_ERR_ABORTED -1012 Operation aborted
MCAM_ERR_BUFFER_TOO_SMALL -1013 Buffer too small
MCAM_ERR_CANNOT_OPEN_FILE -1014 Failed to open file
MCAM_ERR_THREAD_ERROR -1015 Thread error
MCAM_ERR_INVALID_DATA_FORMAT -1016 Invalid data format
MCAM_ERR_NOT_ENOUGH_MEMORY -1017 Insufficient memory
MCAM_ERR_CANCEL -1018 Canceled
MCAM_ERR_PENDING -1019 Pending
MCAM_ERR_NO_LICENSE -1020 No license
MCAM_ERR_CANT_READ_MANIFEST -1021 Failed to read manifest
MCAM_ERR_NOT_SUPPORTED -1022 Not supported
MCAM_ERR_ERR_OVERFLOW -1023 Overflow error
MCAM_ERR_IMAGE_ERROR -1024 Image error
MCAM_ERR_MISSING_PACKETS -1025 Missing packets
MCAM_ERR_TOO_MANY_RESENDS -1026 Too many resends
MCAM_ERR_RESENDS_FAILURE -1027 Resends failure
MCAM_ERR_TOO_MANY_CONSECUTIVE_RESENDS -1028 Too many consecutive resends
MCAM_ERR_AUTO_ABORTED -1029 Auto-aborted
MCAM_ERR_BAD_VERSION -1030 Bad version
MCAM_ERR_NO_MORE_ENTRY -1031 No more entries
MCAM_ERR_NO_AVAILABLE_DATA -1032 No available data
MCAM_ERR_NETWORK_ERROR -1033 Network error
MCAM_ERR_RESYNC -1034 Resync required
MCAM_ERR_CORRUPTED_DATA -1035 Corrupted data
MCAM_ERR_GENICAM_XML_ERROR -1036 GenICam XML error
MCAM_ERR_NO_DEVICE -1037 No device
MCAM_ERR_NO_SYSTEM -1038 No system
MCAM_ERR_NOT_OPEN_SYSTEM -1039 System not open

2.3 Device Information Definitions#

Device information constants are used to specify the type of information to query in ST_GetEnumDeviceInfo().

Name Value Description Notes
MCAM_DEVICEINFO_USER_ID 10000 User ID -
MCAM_DEVICEINFO_MODEL_NAME 10001 Model name -
MCAM_DEVICEINFO_SERIAL_NUMBER 10002 Serial number -
MCAM_DEVICEINFO_DEVICE_VERSION 10003 Device version -
MCAM_DEVICEINFO_MAC_ADDRESS 10004 MAC address GEV
MCAM_DEVICEINFO_IP_ADDRESS 10005 IP address GEV
MCAM_DEVICEINFO_CURRENT_SPEED 10006 Current link speed U3V
MCAM_DEVICEINFO_ACCESS_STATUS 10007 Access status CXP
MCAM_DEVICEINFO_LINKED_CHANNEL 10008 Number of linked channels CXP

2.4 XML Versions#

Name Value Description
XML_VERSION_1_0 0 GenICam XML 1.0 format
XML_VERSION_1_1 1 GenICam XML 1.1 format

2.5 Parameter Visibility#

Name Value Description
VISIBILITY_BEGINNER 0 Beginner level - show only basic settings
VISIBILITY_EXPERT 1 Expert level - show advanced settings
VISIBILITY_GURU 2 Guru level - show all settings
VISIBILITY_INVISIBLE 3 Invisible

2.6 Module Identification Macros#

The header also defines macros for module identification. In module-based extended APIs, the separate CvsModuleType enumeration is typically used.

Name Value Description Notes
DeviceModule 0 Device module identifier identify a device module
DataStreamModule 1 Data stream module identifier identify a data stream module
RemoteDeviceModule 2 Remote device module identifier identify a remote device module

2.7 Color Conversion Bit-Field Definitions#

ConvertColor values are composed by combining the bit-field constants below.

Category Name Value Description
Source pixel family SRCPIXELMONO 0x00010000 Mono input
Source pixel family SRCPIXELBAYERBG 0x00020000 BayerBG input
Source pixel family SRCPIXELBAYERGB 0x00040000 BayerGB input
Source pixel family SRCPIXELBAYERRG 0x00080000 BayerRG input
Source pixel family SRCPIXELBAYERGR 0x000A0000 BayerGR input
Source pixel family SRCPIXELYUV 0x000C0000 YUV input
Source pixel family SRCPIXELRGB 0x000E0000 RGB input
Bit depth SRCPIXEL8BIT 0x00001000 8-bit input
Bit depth SRCPIXEL10BIT 0x00002000 10-bit input
Bit depth SRCPIXEL12BIT 0x00004000 12-bit input
Bit depth SRCPIXEL16BIT 0x00008000 16-bit input
Bit depth SRCPIXEL24BIT 0x0000A000 24-bit input
Packing SRCPIXELNONE 0x00000100 No packing
Packing SRCPIXELPACKED 0x00000200 Packed format
Output color space DSTPIXELGRAY 0x00000010 GRAY output
Output color space DSTPIXELBGR 0x00000020 BGR output
Output color space DSTPIXELRGB 0x00000030 RGB output
Filter DSTFILTERNONE 0x00000000 No filter
Filter DSTFILTER3X3 0x00000001 3x3 filter applied

3. Structure Definitions#

3.1 CVS_IMAGE Structure#

This structure stores the basic properties of image data.

Definition

typedef struct _cvsImage
{
	int32_t width;    /**< The image width in pixels. */
	int32_t height;    /**< The image height in pixels. */
	int32_t step;    /**< The number of bytes per image row. */
	int32_t channels;    /**< The number of channels per pixel. */
	void* pImage;    /**< Pointer to the image memory. */
} CVS_IMAGE;

Fields

Name Type Description
width int32_t Image width (px)
height int32_t Image height (px)
step int32_t Number of bytes per image row (stride)
channels int32_t Number of channels per pixel
pImage void* Pointer to the image data memory

3.2 CVS_BUFFER Structure#

This structure stores the grab result buffer and metadata.

Definition

typedef struct _cvsBuffer
{
	bool isAllocated;    /**< Indicates whether the buffer memory is allocated. */
	uint64_t blockID;    /**< The block ID of the buffer. */
	uint64_t timestamp;    /**< The timestamp of the buffer. */
	uint32_t size;    /**< The size of the buffer in bytes. */
	CVS_IMAGE image;    /**< The image data contained in the buffer. */
} CVS_BUFFER;

Fields

Name Type Description
isAllocated bool Whether buffer memory is allocated
blockID uint64_t Buffer block ID
timestamp uint64_t Buffer timestamp
size uint32_t Buffer size (bytes)
image CVS_IMAGE Image data contained in the buffer

3.3 CVS_EVENT Structure#

This structure stores the ID, timestamp, and data pointer of a device event.

Definition

typedef struct _cvsEvent
{
	int id;    /**< The event ID. */
	uint64_t timestamp;    /**< The event timestamp. */
	const void* data;    /**< Pointer to the event data. */
	uint32_t dataLength;    /**< The length of the event data in bytes. */
} CVS_EVENT;

Fields

Name Type Description
id int Event ID
timestamp uint64_t Event timestamp
data const void* Pointer to event data
dataLength uint32_t Event data length (bytes)

3.4 CVS_FEATURE Structure#

This is a summary structure used when enumerating the feature list.

Definition

typedef struct _cvsFeature
{
	char name[256];    /**< The feature name. */
	char category[256];    /**< The parent category name. */
	CvsFeatureType type;    /**< The feature type. */
} CVS_FEATURE;

Fields

Name Type Description
name[256] char Feature name
category[256] char Parent category name
type CvsFeatureType Feature type

3.5 CVS_FEATURE_INFO Structure#

This metadata structure is commonly used across all feature types.

Definition

typedef struct _cvsFeatureInfo
{
	char name[256];    /**< The feature name. */
	char displayName[256];    /**< The display name of the feature. */
	char toolTip[512];    /**< The tooltip text of the feature. */
	char description[512];    /**< The description of the feature. */
	CvsAccessMode accessMode;    /**< The access mode of the feature. */
	bool isReadable;    /**< Indicates whether the feature is readable. */
	bool isWritable;    /**< Indicates whether the feature is writable. */
	CvsVisibility visibility;    /**< The visibility level of the feature. */
} CVS_FEATURE_INFO;

Fields

Name Type Description
name[256] char Feature name
displayName[256] char Feature display name
toolTip[512] char Feature tooltip text
description[512] char Feature description
accessMode CvsAccessMode Feature access mode
isReadable bool Readable
isWritable bool Writable
visibility CvsVisibility Feature visibility level

3.6 CVS_FEATURE_INTEGER_INFO Structure#

This structure contains the current value and range information of an integer feature.

Definition

typedef struct _cvsFeatureIntegerInfo
{
	CVS_FEATURE_INFO common;    /**< Common feature information. */
	int64_t value;    /**< The current value of the integer feature. */
	int64_t min;    /**< The minimum value of the integer feature. */
	int64_t max;    /**< The maximum value of the integer feature. */
	int64_t inc;    /**< The increment value of the integer feature. */
	CvsRepresentation representation;    /**< The representation of the integer feature. */
	char unit[64];    /**< The unit of the integer feature. */
} CVS_FEATURE_INTEGER_INFO;

Fields

Name Type Description
common CVS_FEATURE_INFO Common feature information
value int64_t Current integer value
min int64_t Minimum integer value
max int64_t Maximum integer value
inc int64_t Integer increment step
representation CvsRepresentation Integer representation
unit[64] char Integer unit

3.7 CVS_FEATURE_FLOAT_INFO Structure#

This structure contains the current value and range information of a floating-point feature.

Definition

typedef struct _cvsFeatureFloatInfo
{
	CVS_FEATURE_INFO common;    /**< Common feature information. */
	double value;    /**< The current value of the float feature. */
	double min;    /**< The minimum value of the float feature. */
	double max;    /**< The maximum value of the float feature. */
	CvsRepresentation representation;    /**< The representation of the float feature. */
	char unit[64];    /**< The unit of the float feature. */
} CVS_FEATURE_FLOAT_INFO;

Fields

Name Type Description
common CVS_FEATURE_INFO Common feature information
value double Current floating-point value
min double Minimum floating-point value
max double Maximum floating-point value
representation CvsRepresentation Floating-point representation
unit[64] char Floating-point unit

3.8 CVS_FEATURE_BOOLEAN_INFO Structure#

This structure contains the current value of a Boolean feature.

Definition

typedef struct _cvsFeatureBooleanInfo
{
	CVS_FEATURE_INFO common;    /**< Common feature information. */
	bool value;    /**< The current value of the boolean feature. */
} CVS_FEATURE_BOOLEAN_INFO;

Fields

Name Type Description
common CVS_FEATURE_INFO Common feature information
value bool Current Boolean value

3.9 CVS_FEATURE_STRING_INFO Structure#

This structure contains the current value of a string feature.

Definition

typedef struct _cvsFeatureStringInfo
{
	CVS_FEATURE_INFO common;    /**< Common feature information. */
	char value[512];    /**< The current value of the string feature. */
} CVS_FEATURE_STRING_INFO;

Fields

Name Type Description
common CVS_FEATURE_INFO Common feature information
value[512] char Current string value

3.10 CVS_FEATURE_ENUMERATION_INFO Structure#

This structure contains the current string/integer value and the number of entries of an enumeration feature.

Definition

typedef struct _cvsFeatureEnumerationInfo
{
	CVS_FEATURE_INFO common;    /**< Common feature information. */
	char currentValue[256];    /**< The current string value of the enumeration feature. */
	int64_t currentIntValue;    /**< The current integer value of the enumeration feature. */
	int32_t entryCount;    /**< The number of available enumeration entries. */
} CVS_FEATURE_ENUMERATION_INFO;

Fields

Name Type Description
common CVS_FEATURE_INFO Common feature information
currentValue[256] char Current enumeration string value
currentIntValue int64_t Current enumeration integer value
entryCount int32_t Number of available enumeration entries

3.11 CVS_FEATURE_ENUM_ENTRY_INFO Structure#

This structure contains detailed metadata for an individual enumeration entry.

Definition

typedef struct _cvsFeatureEnumEntryInfo
{
	int32_t intValue;    /**< The integer value of the enumeration entry. */
	char stringValue[256];    /**< The string value of the enumeration entry. */
	char displayName[256];    /**< The display name of the enumeration entry. */
	char description[512];    /**< The description of the enumeration entry. */
	CvsAccessMode accessMode;    /**< The access mode of the enumeration entry. */
	CvsVisibility visibility;    /**< The visibility level of the enumeration entry. */
} CVS_FEATURE_ENUM_ENTRY_INFO;

Fields

Name Type Description
intValue int32_t Integer value of the enumeration entry
stringValue[256] char String value of the enumeration entry
displayName[256] char Enumeration entry display name
description[512] char Enumeration entry description
accessMode CvsAccessMode Enumeration entry access mode
visibility CvsVisibility Enumeration entry visibility level

3.12 CVS_FEATURE_COMMAND_INFO Structure#

This structure contains common metadata for a command feature.

Definition

typedef struct _cvsFeatureCommandInfo
{
	CVS_FEATURE_INFO common;    /**< Common feature information. */
} CVS_FEATURE_COMMAND_INFO;

Fields

Name Type Description
common CVS_FEATURE_INFO Common feature information

4. Enumeration Definitions#

4.1 Color Conversion (enum ConvertColor)#

ST_CvtColor() uses these color conversion codes. The values are bit fields composed of source pixel format, bit depth, packing mode, output color space, and filter information.

The color conversion codes can be grouped as follows.

4.1.1 Basic RGB/BGR Conversion

Name Value Description
CVP_RGB2BGR 0x000EA120 Converts the RGB format to the BGR color space
CVP_BGR2RGB 0x000EA120 Converts the BGR format to the RGB color space

4.1.2 Bayer 8-bit

Name Value Description
CVP_BayerBG2BGR 0x00021120 Converts the BayerBG format to the BGR color space
CVP_BayerGB2BGR 0x00041120 Converts the BayerGB format to the BGR color space
CVP_BayerRG2BGR 0x00081120 Converts the BayerRG format to the BGR color space
CVP_BayerGR2BGR 0x000A1120 Converts the BayerGR format to the BGR color space
CVP_BayerBG2RGB 0x00081120 Converts the BayerBG format to the RGB color space
CVP_BayerGB2RGB 0x000A1120 Converts the BayerGB format to the RGB color space
CVP_BayerRG2RGB 0x00021120 Converts the BayerRG format to the RGB color space
CVP_BayerGR2RGB 0x00041120 Converts the BayerGR format to the RGB color space
CVP_BayerBG2GRAY 0x00021110 Converts the BayerBG format to the GRAY color space
CVP_BayerGB2GRAY 0x00041110 Converts the BayerGB format to the GRAY color space
CVP_BayerRG2GRAY 0x00081110 Converts the BayerRG format to the GRAY color space
CVP_BayerGR2GRAY 0x000A1110 Converts the BayerGR format to the GRAY color space

4.1.3 Bayer 8-bit + 3x3

Name Value Description
CVP_BayerBG2BGR_3x3 0x00021121 Converts the BayerBG format to the BGR color space using a 3x3 filter
CVP_BayerGB2BGR_3x3 0x00041121 Converts the BayerGB format to the BGR color space using a 3x3 filter
CVP_BayerRG2BGR_3x3 0x00081121 Converts the BayerRG format to the BGR color space using a 3x3 filter
CVP_BayerGR2BGR_3x3 0x000A1121 Converts the BayerGR format to the BGR color space using a 3x3 filter
CVP_BayerBG2RGB_3x3 0x00081121 Converts the BayerBG format to the RGB color space using a 3x3 filter
CVP_BayerGB2RGB_3x3 0x000A1121 Converts the BayerGB format to the RGB color space using a 3x3 filter
CVP_BayerRG2RGB_3x3 0x00021121 Converts the BayerRG format to the RGB color space using a 3x3 filter
CVP_BayerGR2RGB_3x3 0x00041121 Converts the BayerGR format to the RGB color space using a 3x3 filter
CVP_BayerBG2GRAY_3x3 0x00021111 Converts the BayerBG format to the GRAY color space using a 3x3 filter
CVP_BayerGB2GRAY_3x3 0x00041111 Converts the BayerGB format to the GRAY color space using a 3x3 filter
CVP_BayerRG2GRAY_3x3 0x00081111 Converts the BayerRG format to the GRAY color space using a 3x3 filter
CVP_BayerGR2GRAY_3x3 0x000A1111 Converts the BayerGR format to the GRAY color space using a 3x3 filter

4.1.4 Bayer 10-bit

Name Value Description
CVP_BayerBG10ToBGR 0x00022120 Converts the BayerBG10 format to the BGR color space
CVP_BayerGB10ToBGR 0x00042120 Converts the BayerGB10 format to the BGR color space
CVP_BayerRG10ToBGR 0x00082120 Converts the BayerRG10 format to the BGR color space
CVP_BayerGR10ToBGR 0x000A2120 Converts the BayerGR10 format to the BGR color space
CVP_BayerBG10ToRGB 0x00082120 Converts the BayerBG10 format to the RGB color space
CVP_BayerGB10ToRGB 0x000A2120 Converts the BayerGB10 format to the RGB color space
CVP_BayerRG10ToRGB 0x00022120 Converts the BayerRG10 format to the RGB color space
CVP_BayerGR10ToRGB 0x00042120 Converts the BayerGR10 format to the RGB color space
CVP_BayerBG10ToGRAY 0x00022110 Converts the BayerBG10 format to the GRAY color space
CVP_BayerGB10ToGRAY 0x00042110 Converts the BayerGB10 format to the GRAY color space
CVP_BayerRG10ToGRAY 0x00082110 Converts the BayerRG10 format to the GRAY color space
CVP_BayerGR10ToGRAY 0x000A2110 Converts the BayerGR10 format to the GRAY color space

4.1.5 Bayer 10-bit + 3x3

Name Value Description
CVP_BayerBG10ToBGR_3x3 0x00022121 Converts the BayerBG10 format to the BGR color space using a 3x3 filter
CVP_BayerGB10ToBGR_3x3 0x00042121 Converts the BayerGB10 format to the BGR color space using a 3x3 filter
CVP_BayerRG10ToBGR_3x3 0x00082121 Converts the BayerRG10 format to the BGR color space using a 3x3 filter
CVP_BayerGR10ToBGR_3x3 0x000A2121 Converts the BayerGR10 format to the BGR color space using a 3x3 filter
CVP_BayerBG10ToRGB_3x3 0x00082121 Converts the BayerBG10 format to the RGB color space using a 3x3 filter
CVP_BayerGB10ToRGB_3x3 0x000A2121 Converts the BayerGB10 format to the RGB color space using a 3x3 filter
CVP_BayerRG10ToRGB_3x3 0x00022121 Converts the BayerRG10 format to the RGB color space using a 3x3 filter
CVP_BayerGR10ToRGB_3x3 0x00042121 Converts the BayerGR10 format to the RGB color space using a 3x3 filter
CVP_BayerBG10ToGRAY_3x3 0x00022111 Converts the BayerBG10 format to the GRAY color space using a 3x3 filter
CVP_BayerGB10ToGRAY_3x3 0x00042111 Converts the BayerGB10 format to the GRAY color space using a 3x3 filter
CVP_BayerRG10ToGRAY_3x3 0x00082111 Converts the BayerRG10 format to the GRAY color space using a 3x3 filter
CVP_BayerGR10ToGRAY_3x3 0x000A2111 Converts the BayerGR10 format to the GRAY color space using a 3x3 filter

4.1.6 Bayer 10-bit Packed

Name Value Description
CVP_BayerBG10pToBGR 0x00022220 Converts the BayerBG10Packed format to the BGR color space
CVP_BayerGB10pToBGR 0x00042220 Converts the BayerGB10Packed format to the BGR color space
CVP_BayerRG10pToBGR 0x00082220 Converts the BayerRG10Packed format to the BGR color space
CVP_BayerGR10pToBGR 0x000A2220 Converts the BayerGR10Packed format to the BGR color space
CVP_BayerBG10pToRGB 0x00082220 Converts the BayerBG10Packed format to the RGB color space
CVP_BayerGB10pToRGB 0x000A2220 Converts the BayerGB10Packed format to the RGB color space
CVP_BayerRG10pToRGB 0x00022220 Converts the BayerRG10Packed format to the RGB color space
CVP_BayerGR10pToRGB 0x00042220 Converts the BayerGR10Packed format to the RGB color space
CVP_BayerBG10pToGRAY 0x00022210 Converts the BayerBG10Packed format to the GRAY color space
CVP_BayerGB10pToGRAY 0x00042210 Converts the BayerGB10Packed format to the GRAY color space
CVP_BayerRG10pToGRAY 0x00082210 Converts the BayerRG10Packed format to the GRAY color space
CVP_BayerGR10pToGRAY 0x000A2210 Converts the BayerGR10Packed format to the GRAY color space

4.1.7 Bayer 10-bit Packed + 3x3

Name Value Description
CVP_BayerBG10pToBGR_3x3 0x00022221 Converts the BayerBG10Packed format to the BGR color space using a 3x3 filter
CVP_BayerGB10pToBGR_3x3 0x00042221 Converts the BayerGB10Packed format to the BGR color space using a 3x3 filter
CVP_BayerRG10pToBGR_3x3 0x00082221 Converts the BayerRG10Packed format to the BGR color space using a 3x3 filter
CVP_BayerGR10pToBGR_3x3 0x000A2221 Converts the BayerGR10Packed format to the BGR color space using a 3x3 filter
CVP_BayerBG10pToRGB_3x3 0x00082221 Converts the BayerBG10Packed format to the RGB color space using a 3x3 filter
CVP_BayerGB10pToRGB_3x3 0x000A2221 Converts the BayerGB10Packed format to the RGB color space using a 3x3 filter
CVP_BayerRG10pToRGB_3x3 0x00022221 Converts the BayerRG10Packed format to the RGB color space using a 3x3 filter
CVP_BayerGR10pToRGB_3x3 0x00042221 Converts the BayerGR10Packed format to the RGB color space using a 3x3 filter
CVP_BayerBG10pToGRAY_3x3 0x00022211 Converts the BayerBG10Packed format to the GRAY color space using a 3x3 filter
CVP_BayerGB10pToGRAY_3x3 0x00042211 Converts the BayerGB10Packed format to the GRAY color space using a 3x3 filter
CVP_BayerRG10pToGRAY_3x3 0x00082211 Converts the BayerRG10Packed format to the GRAY color space using a 3x3 filter
CVP_BayerGR10pToGRAY_3x3 0x000A2211 Converts the BayerGR10Packed format to the GRAY color space using a 3x3 filter

4.1.8 Bayer 12-bit

Name Value Description
CVP_BayerBG12ToRGB 0x00024120 Converts the BayerBG12 format to the RGB color space
CVP_BayerGB12ToRGB 0x00044120 Converts the BayerGB12 format to the RGB color space
CVP_BayerRG12ToRGB 0x00084120 Converts the BayerRG12 format to the RGB color space
CVP_BayerGR12ToRGB 0x000A4120 Converts the BayerGR12 format to the RGB color space
CVP_BayerBG12ToBGR 0x00084120 Converts the BayerBG12 format to the BGR color space
CVP_BayerGB12ToBGR 0x000A4120 Converts the BayerGB12 format to the BGR color space
CVP_BayerRG12ToBGR 0x00024120 Converts the BayerRG12 format to the BGR color space
CVP_BayerGR12ToBGR 0x00044120 Converts the BayerGR12 format to the BGR color space
CVP_BayerBG12ToGRAY 0x00024110 Converts the BayerBG12 format to the GRAY color space
CVP_BayerGB12ToGRAY 0x00044110 Converts the BayerGB12 format to the GRAY color space
CVP_BayerRG12ToGRAY 0x00084110 Converts the BayerRG12 format to the GRAY color space
CVP_BayerGR12ToGRAY 0x000A4110 Converts the BayerGR12 format to the GRAY color space

4.1.9 Bayer 12-bit + 3x3

Name Value Description
CVP_BayerBG12ToBGR_3x3 0x00024121 Converts the BayerBG12 format to the BGR color space using a 3x3 filter
CVP_BayerGB12ToBGR_3x3 0x00044121 Converts the BayerGB12 format to the BGR color space using a 3x3 filter
CVP_BayerRG12ToBGR_3x3 0x00084121 Converts the BayerRG12 format to the BGR color space using a 3x3 filter
CVP_BayerGR12ToBGR_3x3 0x000A4121 Converts the BayerGR12 format to the BGR color space using a 3x3 filter
CVP_BayerBG12ToRGB_3x3 0x00084121 Converts the BayerBG12 format to the RGB color space using a 3x3 filter
CVP_BayerGB12ToRGB_3x3 0x000A4121 Converts the BayerGB12 format to the RGB color space using a 3x3 filter
CVP_BayerRG12ToRGB_3x3 0x00024121 Converts the BayerRG12 format to the RGB color space using a 3x3 filter
CVP_BayerGR12ToRGB_3x3 0x00044121 Converts the BayerGR12 format to the RGB color space using a 3x3 filter
CVP_BayerBG12ToGRAY_3x3 0x00024111 Converts the BayerBG12 format to the GRAY color space using a 3x3 filter
CVP_BayerGB12ToGRAY_3x3 0x00044111 Converts the BayerGB12 format to the GRAY color space using a 3x3 filter
CVP_BayerRG12ToGRAY_3x3 0x00084111 Converts the BayerRG12 format to the GRAY color space using a 3x3 filter
CVP_BayerGR12ToGRAY_3x3 0x000A4111 Converts the BayerGR12 format to the GRAY color space using a 3x3 filter

4.1.10 Bayer 12-bit Packed

Name Value Description
CVP_BayerBG12pToBGR 0x00024220 Converts the BayerBG12Packed format to the BGR color space
CVP_BayerGB12pToBGR 0x00044220 Converts the BayerGB12Packed format to the BGR color space
CVP_BayerRG12pToBGR 0x00084220 Converts the BayerRG12Packed format to the BGR color space
CVP_BayerGR12pToBGR 0x000A4220 Converts the BayerGR12Packed format to the BGR color space
CVP_BayerBG12pToRGB 0x00084220 Converts the BayerBG12Packed format to the RGB color space
CVP_BayerGB12pToRGB 0x000A4220 Converts the BayerGB12Packed format to the RGB color space
CVP_BayerRG12pToRGB 0x00024220 Converts the BayerRG12Packed format to the RGB color space
CVP_BayerGR12pToRGB 0x00044220 Converts the BayerGR12Packed format to the RGB color space
CVP_BayerBG12pToGRAY 0x00024210 Converts the BayerBG12Packed format to the GRAY color space
CVP_BayerGB12pToGRAY 0x00044210 Converts the BayerGB12Packed format to the GRAY color space
CVP_BayerRG12pToGRAY 0x00084210 Converts the BayerRG12Packed format to the GRAY color space
CVP_BayerGR12pToGRAY 0x000A4210 Converts the BayerGR12Packed format to the GRAY color space

4.1.11 Bayer 12-bit Packed + 3x3

Name Value Description
CVP_BayerBG12pToBGR_3x3 0x00024221 Converts the BayerBG12Packed format to the BGR color space using a 3x3 filter
CVP_BayerGB12pToBGR_3x3 0x00044221 Converts the BayerGB12Packed format to the BGR color space using a 3x3 filter
CVP_BayerRG12pToBGR_3x3 0x00084221 Converts the BayerRG12Packed format to the BGR color space using a 3x3 filter
CVP_BayerGR12pToBGR_3x3 0x000A4221 Converts the BayerGR12Packed format to the BGR color space using a 3x3 filter
CVP_BayerBG12pToRGB_3x3 0x00084221 Converts the BayerBG12Packed format to the RGB color space using a 3x3 filter
CVP_BayerGB12pToRGB_3x3 0x000A4221 Converts the BayerGB12Packed format to the RGB color space using a 3x3 filter
CVP_BayerRG12pToRGB_3x3 0x00024221 Converts the BayerRG12Packed format to the RGB color space using a 3x3 filter
CVP_BayerGR12pToRGB_3x3 0x00044221 Converts the BayerGR12Packed format to the RGB color space using a 3x3 filter
CVP_BayerBG12pToGRAY_3x3 0x00024211 Converts the BayerBG12Packed format to the GRAY color space using a 3x3 filter
CVP_BayerGB12pToGRAY_3x3 0x00044211 Converts the BayerGB12Packed format to the GRAY color space using a 3x3 filter
CVP_BayerRG12pToGRAY_3x3 0x00084211 Converts the BayerRG12Packed format to the GRAY color space using a 3x3 filter
CVP_BayerGR12pToGRAY_3x3 0x000A4211 Converts the BayerGR12Packed format to the GRAY color space using a 3x3 filter

4.1.12 YUV Conversion

Name Value Description
CVP_YUV422pToRGB 0x000C8230 Converts the YUV422Packed format to the RGB color space

4.1.13 Mono Bit Reduction

Name Value Description
CVP_Mono10ToMono8 0x00012110 Converts the Mono10 format to the Mono8 format
CVP_Mono12ToMono8 0x00014110 Converts the Mono12 format to the Mono8 format
CVP_Mono10pToMono8 0x00012210 Converts the Mono10Packed format to the Mono8 format
CVP_Mono12pToMono8 0x00014210 Converts the Mono12Packed format to the Mono8 format

4.2 Module Types (enum CvsModuleType)#

This enumeration is used to specify the target module in the extended register/feature API.

Name Value Description
ModuleInterface 0 Interface module
ModuleDevice 1 Device module
ModuleRemoteDevice 2 Remote device module
ModuleDataStream 3 Data stream module
ModuleUnknown 999 Unknown module type

4.3 Feature Types (enum CvsFeatureType)#

This enumeration indicates the data type of a feature node.

Name Value Description
TypeInteger 0 Integer feature
TypeEnum 1 Enumeration feature
TypeBoolean 2 Boolean feature
TypeString 3 String feature
TypeCommand 4 Command feature
TypeFloat 5 Floating-point feature
TypeRegister 6 Register feature
TypeUndefined 999 Undefined feature type

4.4 Access Permissions (enum CvsAccessType)#

This enumeration defines the access permissions used when opening a device.

Name Value Description
AccessUnknown 0 Unknown access type
AccessOpen 1 Default open mode
AccessControl 2 Control permission mode
AccessExclusive 3 Exclusive access mode
AccessReadOnly 4 Read-only access mode

4.5 Access Modes (enum CvsAccessMode)#

This enumeration indicates the readable/writable state of a feature.

Name Value Description
NI 0 Not implemented
NA 1 Not available
WO 2 Write-only
RO 3 Read-only
RW 4 Readable/Writable
_UndefinedAccesMode 5 Object is not yet initialized
_CycleDetectAccesMode 6 For internal access-mode cycle detection

4.6 Visibility (enum CvsVisibility)#

This enumeration indicates the UI visibility level of a feature.

Name Value Description
Beginner 0 Always visible
Expert 1 Visible at Expert/Guru level
Guru 2 Visible at Guru level
Invisible 3 Not visible
_UndefinedVisibility 99 Object is not yet initialized

4.7 Representation (enum CvsRepresentation)#

This enumeration indicates how numeric/logical values are displayed in the UI.

Name Value Description
Linear 0 Linear slider
Logarithmic 1 Logarithmic slider
Boolean 2 Check box
PureNumber 3 Decimal input
HexNumber 4 Hexadecimal input
IPV4Address 5 IPv4 address
MACAddress 6 MAC address
_UndefinedRepresentation 999 Undefined representation

5. Functions#

This section describes the entire API, including callbacks, system management, device connection, grab operations, register control, feature queries, file I/O, and buffer management.

The examples below are minimal usage examples in C++. hDevice refers to a valid handle obtained after ST_OpenDevice() succeeds, and the example node names (Width, ExposureTime, PixelFormat, DeviceUserID, etc.) may vary depending on the actual device XML/GenICam feature configuration. For string query functions, check the actual buffer size first using a two-pass approach when necessary.

5.1 Callback Function Definitions#

These are the callback function types provided by the library.

5.1.1 GrabCallback#

This callback function type is invoked when a Grab event occurs.

Type

typedef void (WINAPI* GrabCallback)(int32_t eventID, const CVS_BUFFER* pBuffer, void* pUserDefine);

Parameters

Name I/O Type Description
eventID IN int32_t The ID of the Grab event that occurred.
pBuffer IN const CVS_BUFFER* A pointer to the grabbed image buffer.
pUserDefine IN void* A pointer to user-defined data.

Return Value

  • None (void)

Example

void WINAPI OnGrab(int32_t eventID, const CVS_BUFFER* pBuffer, void* pUserDefine)
{
    if (eventID == EVENT_NEW_IMAGE && pBuffer != nullptr)
    {
        printf("frame: %d x %d, blockID=%llu\n",
               pBuffer->image.width,
               pBuffer->image.height,
               (unsigned long long)pBuffer->blockID);
    }
}

5.1.2 EventCallback#

This callback function type is invoked when a device event occurs.

Type

typedef void (WINAPI* EventCallback)(const CVS_EVENT* pEvent, void* pUserDefine);

Parameters

Name I/O Type Description
pEvent IN const CVS_EVENT* A pointer to the device event information structure.
pUserDefine IN void* A pointer to user-defined data.

Return Value

  • None (void)

Example

void WINAPI OnDeviceEvent(const CVS_EVENT* pEvent, void* pUserDefine)
{
    if (pEvent == nullptr)
        return;

    printf("eventID=%d, timestamp=%llu, payload=%u bytes\n",
           pEvent->id,
           (unsigned long long)pEvent->timestamp,
           pEvent->dataLength);
}

5.2 System Management#

These functions are related to system initialization, release, and initialization state checking.

5.2.1 ST_InitSystem#

Initializes the system.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_InitSystem();

Parameters

None

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

CVS_ERROR err = ST_InitSystem();
if (err != MCAM_ERR_OK)
{
    printf("ST_InitSystem failed: %d\n", err);
}

5.2.2 ST_FreeSystem#

Releases system resources.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_FreeSystem();

Parameters

None

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

CVS_ERROR err = ST_FreeSystem();
if (err != MCAM_ERR_OK)
{
    printf("ST_FreeSystem failed: %d\n", err);
}

5.2.3 ST_IsInitSystem#

Checks whether the system has been initialized.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_IsInitSystem(bool* pFlag);

Parameters

Name I/O Type Description
pFlag OUT bool* A pointer to a Boolean variable that receives the initialization state.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

bool initialized = false;
CVS_ERROR err = ST_IsInitSystem(&initialized);
if (err == MCAM_ERR_OK)
{
    printf("initialized = %s\n", initialized ? "true" : "false");
}

5.3 Device Discovery and Information Query#

These functions are related to device discovery, enumeration, interface queries, and basic information queries.

5.3.1 ST_GetAvailableCameraNum#

Queries the number of available cameras.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetAvailableCameraNum(uint32_t* pNum);

Parameters

Name I/O Type Description
pNum OUT uint32_t* A pointer to a variable that receives the number of available cameras.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

// Prerequisite: Call ST_UpdateDevice() or ST_UpdateDeviceWithTimeout() first.
uint32_t cameraCount = 0;
CVS_ERROR err = ST_GetAvailableCameraNum(&cameraCount);
if (err == MCAM_ERR_OK)
{
    printf("cameraCount = %u\n", cameraCount);
}

5.3.2 ST_UpdateDevice#

Refreshes the device list.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_UpdateDevice();

Parameters

None

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Notes

  • Starting from revision 1.1.2, ST_UpdateDevice() and ST_UpdateDeviceWithTimeout() were separated.

Example

CVS_ERROR err = ST_UpdateDevice();
if (err != MCAM_ERR_OK)
{
    printf("ST_UpdateDevice failed: %d\n", err);
}

5.3.3 ST_UpdateDeviceWithTimeout#

Refreshes the device list with a specified timeout.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_UpdateDeviceWithTimeout(uint32_t uTimeout);

Parameters

Name I/O Type Description
uTimeout IN uint32_t The timeout value (ms).

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

uint32_t timeoutMs = 3000;
CVS_ERROR err = ST_UpdateDeviceWithTimeout(timeoutMs);
if (err != MCAM_ERR_OK)
{
    printf("ST_UpdateDeviceWithTimeout failed: %d\n", err);
}

5.3.4 ST_GetEnumDeviceID#

Queries the device ID of the specified enumeration index.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetEnumDeviceID(uint32_t EnumNum, char* pDeviceID, uint32_t* pSize);

Parameters

Name I/O Type Description
EnumNum IN uint32_t The device enumeration index.
pDeviceID OUT char* A string buffer that receives the device ID.
pSize IN/OUT uint32_t* A pointer to a variable used to specify the buffer size and receive the actual size after the call.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

uint32_t enumIndex = 0;
char deviceID[256] = {};
uint32_t size = sizeof(deviceID);

CVS_ERROR err = ST_GetEnumDeviceID(enumIndex, deviceID, &size);
if (err == MCAM_ERR_OK)
{
    printf("deviceID = %s\n", deviceID);
}

5.3.5 ST_GetEnumDeviceInfo#

Queries the device information of the specified enumeration index.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetEnumDeviceInfo(uint32_t EnumNum, int32_t DeviceInfoCmd, char* pDeviceInfo, uint32_t* pSize);

Parameters

Name I/O Type Description
EnumNum IN uint32_t The device enumeration index.
DeviceInfoCmd IN int32_t The device information command value to query.
pDeviceInfo OUT char* A string buffer that receives the device information.
pSize IN/OUT uint32_t* A pointer to a variable used to specify the buffer size and receive the actual size after the call.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

uint32_t enumIndex = 0;
char modelName[256] = {};
uint32_t size = sizeof(modelName);

CVS_ERROR err = ST_GetEnumDeviceInfo(
    enumIndex,
    MCAM_DEVICEINFO_MODEL_NAME,
    modelName,
    &size
);

if (err == MCAM_ERR_OK)
{
    printf("modelName = %s\n", modelName);
}

5.3.6 ST_GetEnumInterface#

Queries the interface of the specified enumeration index.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetEnumInterface(uint32_t EnumNum, char* pInterface, uint32_t* pSize);

Parameters

Name I/O Type Description
EnumNum IN uint32_t The device enumeration index.
pInterface OUT char* A string buffer that receives the interface information.
pSize IN/OUT uint32_t* A pointer to a variable used to specify the buffer size and receive the actual size after the call.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

uint32_t enumIndex = 0;
char interfaceName[64] = {};
uint32_t size = sizeof(interfaceName);

CVS_ERROR err = ST_GetEnumInterface(enumIndex, interfaceName, &size);
if (err == MCAM_ERR_OK)
{
    printf("interface = %s\n", interfaceName);
}

5.4 Device Connection and Control#

These functions are related to device connection, open-state checking, and interface queries.

5.4.1 ST_IsConnectable#

Checks whether the device is connectable.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_IsConnectable(uint32_t EnumNum, bool* pFlag);

Parameters

Name I/O Type Description
EnumNum IN uint32_t The device enumeration index.
pFlag OUT bool* A pointer to a Boolean variable that receives whether the device is connectable.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

uint32_t enumIndex = 0;
bool connectable = false;

CVS_ERROR err = ST_IsConnectable(enumIndex, &connectable);
if (err == MCAM_ERR_OK)
{
    printf("connectable = %s\n", connectable ? "true" : "false");
}

5.4.2 ST_OpenDevice#

Opens the device.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_OpenDevice(uint32_t EnumNum, int32_t* hDevice, bool isDetailedLog = false);

Parameters

Name I/O Type Description
EnumNum IN uint32_t The device enumeration index.
hDevice OUT int32_t* A pointer to an integer variable that receives the device handle.
isDetailedLog IN bool Whether detailed logging is enabled. The default value is false.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

uint32_t enumIndex = 0;
int32_t hDevice = 0;

CVS_ERROR err = ST_OpenDevice(enumIndex, &hDevice, false);
if (err == MCAM_ERR_OK)
{
    printf("hDevice = %d\n", hDevice);
}

5.4.3 ST_OpenDeviceMulticast#

Opens the device in multicast mode.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_OpenDeviceMulticast(uint32_t EnumNum, int32_t* hDevice, CvsAccessType AccessType, const char* IPAddress, uint32_t DataPort, bool isDetailedLog = false);

Parameters

Name I/O Type Description
EnumNum IN uint32_t The device enumeration index.
hDevice OUT int32_t* A pointer to an integer variable that receives the device handle.
AccessType IN CvsAccessType The multicast or shared access permission.
IPAddress IN const char* The multicast group address or destination IP address. If NULL or an empty string is specified, the library default policy is used.
DataPort IN uint32_t The data stream receive port number. If 0, the library may choose an appropriate value.
isDetailedLog IN bool Whether detailed logging is enabled. The default value is false.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Notes

  • IPAddress is used as the multicast group address or the destination IP address.
  • If DataPort is 0, the library may select an appropriate port.
  • Based on the header comments, AccessControl permission can be held by only one control node.
  • In a multicast environment, network equipment may require IGMP Snooping to be configured.

Example

uint32_t enumIndex = 0;
int32_t hDevice = 0;

CVS_ERROR err = ST_OpenDeviceMulticast(
    enumIndex,
    &hDevice,
    AccessReadOnly,
    "239.192.1.1",
    1042,
    false
);

if (err == MCAM_ERR_OK)
{
    printf("multicast open success, hDevice = %d\n", hDevice);
}

5.4.4 ST_IsOpenDevice#

Checks whether the device is open.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_IsOpenDevice(int32_t hDevice, bool* pFlag);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
pFlag OUT bool* A pointer to a Boolean variable that receives whether the device is open.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
bool isOpen = false;

CVS_ERROR err = ST_IsOpenDevice(hDevice, &isOpen);
if (err == MCAM_ERR_OK)
{
    printf("isOpen = %s\n", isOpen ? "true" : "false");
}

5.4.5 ST_CloseDevice#

Closes the device.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_CloseDevice(int32_t hDevice);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle to close.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CVS_ERROR err = ST_CloseDevice(hDevice);
if (err != MCAM_ERR_OK)
{
    printf("ST_CloseDevice failed: %d\n", err);
}

5.4.6 ST_GetInterface#

Queries the device interface.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetInterface(int32_t hDevice, char* pInterface, uint32_t* pSize);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
pInterface OUT char* A string buffer that receives the interface information.
pSize IN/OUT uint32_t* A pointer to a variable used to specify the buffer size and receive the actual size after the call.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
char interfaceName[64] = {};
uint32_t size = sizeof(interfaceName);

CVS_ERROR err = ST_GetInterface(hDevice, interfaceName, &size);
if (err == MCAM_ERR_OK)
{
    printf("interface = %s\n", interfaceName);
}

5.5 Image Acquisition and Configuration#

These functions are related to starting/stopping image acquisition and configuring Grab behavior.

5.5.1 ST_AcqStart#

Starts acquisition on the device.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_AcqStart(int32_t hDevice);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
// Prerequisite: If necessary, initialize the buffer with ST_InitBuffer() and register callbacks first.
CVS_ERROR err = ST_AcqStart(hDevice);
if (err != MCAM_ERR_OK)
{
    printf("ST_AcqStart failed: %d\n", err);
}

5.5.2 ST_AcqStop#

Stops acquisition on the device.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_AcqStop(int32_t hDevice);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
// Prerequisite: Acquisition has been started with ST_AcqStart().
CVS_ERROR err = ST_AcqStop(hDevice);
if (err != MCAM_ERR_OK)
{
    printf("ST_AcqStop failed: %d\n", err);
}

5.5.3 ST_DoAbortGrab#

Aborts an ongoing Grab on the device.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_DoAbortGrab(int32_t hDevice);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
// Prerequisite: A Grab is pending or acquisition is in progress.
CVS_ERROR err = ST_DoAbortGrab(hDevice);
if (err != MCAM_ERR_OK)
{
    printf("ST_DoAbortGrab failed: %d\n", err);
}

5.5.4 ST_SetGrabTimeout#

Sets the device Grab timeout.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_SetGrabTimeout(int32_t hDevice, uint32_t Timeout);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
Timeout IN uint32_t Grab The timeout value (ms).

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
uint32_t timeoutMs = 2000;

CVS_ERROR err = ST_SetGrabTimeout(hDevice, timeoutMs);
if (err != MCAM_ERR_OK)
{
    printf("ST_SetGrabTimeout failed: %d\n", err);
}

5.5.5 ST_GetGrabTimeout#

Queries the device Grab timeout.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetGrabTimeout(int32_t hDevice, uint32_t* pTimeout);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
pTimeout OUT uint32_t* A pointer to a variable that receives the current Grab timeout value (ms).

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
uint32_t timeoutMs = 0;

CVS_ERROR err = ST_GetGrabTimeout(hDevice, &timeoutMs);
if (err == MCAM_ERR_OK)
{
    printf("grab timeout = %u ms\n", timeoutMs);
}

5.5.6 ST_SetBufferCount#

Sets the number of internal device buffers.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_SetBufferCount(int32_t hDevice, uint32_t BufferCount);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
BufferCount IN uint32_t The number of internal buffers to set.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
uint32_t bufferCount = 8;

CVS_ERROR err = ST_SetBufferCount(hDevice, bufferCount);
if (err != MCAM_ERR_OK)
{
    printf("ST_SetBufferCount failed: %d\n", err);
}

5.5.7 ST_GetBufferCount#

Queries the number of internal device buffers.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetBufferCount(int32_t hDevice, uint32_t* pBufferCount);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
pBufferCount OUT uint32_t* A pointer to a variable that receives the current internal buffer count.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
uint32_t bufferCount = 0;

CVS_ERROR err = ST_GetBufferCount(hDevice, &bufferCount);
if (err == MCAM_ERR_OK)
{
    printf("bufferCount = %u\n", bufferCount);
}

5.6 Image Processing and Status Check#

These functions are related to checking image acquisition results and querying statistics.

5.6.1 ST_GrabImage#

Grabs an image from the device.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GrabImage(int32_t hDevice, CVS_BUFFER* pBuffer);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
pBuffer OUT CVS_BUFFER* A pointer to a CVS_BUFFER structure that receives the acquired image data.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Notes

  • Use this while ST_AcqStart() is active.
  • It is safer to initialize the buffer first with ST_InitBuffer() before calling this.

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CVS_BUFFER buffer = {};

if (ST_InitBuffer(hDevice, &buffer, 0) == MCAM_ERR_OK &&
    ST_AcqStart(hDevice) == MCAM_ERR_OK)
{
    CVS_ERROR err = ST_GrabImage(hDevice, &buffer);
    if (err == MCAM_ERR_OK)
    {
        printf("grabbed: %d x %d\n", buffer.image.width, buffer.image.height);
    }

    ST_AcqStop(hDevice);
    ST_FreeBuffer(&buffer);
}

5.6.2 ST_GrabImageAsync#

Grabs an image asynchronously from the device.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GrabImageAsync(int32_t hDevice, CVS_BUFFER* pBuffer);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
pBuffer OUT CVS_BUFFER* A pointer to a CVS_BUFFER structure that receives the acquired image data.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Notes

  • Asynchronous Grab support was added after version 1.0.7.
  • In version 1.1.1, the parameters and behavior of ST_GrabImageAsync() were adjusted.

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CVS_BUFFER buffer = {};

if (ST_InitBuffer(hDevice, &buffer, 0) == MCAM_ERR_OK &&
    ST_AcqStart(hDevice) == MCAM_ERR_OK)
{
    CVS_ERROR err = ST_GrabImageAsync(hDevice, &buffer);
    if (err == MCAM_ERR_OK)
    {
        printf("async image ready: %d x %d\n", buffer.image.width, buffer.image.height);
    }

    ST_AcqStop(hDevice);
    ST_FreeBuffer(&buffer);
}

5.6.3 ST_SingleGrabImage#

Grabs a single image from the device.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_SingleGrabImage(int32_t hDevice, CVS_BUFFER* pBuffer);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
pBuffer OUT CVS_BUFFER* A pointer to a CVS_BUFFER structure that receives the acquired image data.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Notes

  • Use this to acquire a single image without starting continuous acquisition.

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CVS_BUFFER buffer = {};

if (ST_InitBuffer(hDevice, &buffer, 0) == MCAM_ERR_OK)
{
    CVS_ERROR err = ST_SingleGrabImage(hDevice, &buffer);
    if (err == MCAM_ERR_OK)
    {
        printf("single shot: %d x %d\n", buffer.image.width, buffer.image.height);
    }

    ST_FreeBuffer(&buffer);
}

5.6.4 ST_GetImageAvailable#

Checks whether an image is available from the device.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetImageAvailable(int32_t hDevice, uint32_t* pFlag);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
pFlag OUT uint32_t* A pointer to a variable that receives the image availability state.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Notes

  • The output type is uint32_t*, and in general, a non-zero value indicates that an image is available.

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
// Prerequisite: This is a polling situation after ST_AcqStart().
uint32_t available = 0;

CVS_ERROR err = ST_GetImageAvailable(hDevice, &available);
if (err == MCAM_ERR_OK)
{
    printf("image available = %u\n", available);
}

5.6.5 ST_GetGrabCount#

Queries the Grab count and error count of the device.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetGrabCount(int32_t hDevice, uint64_t* Count, uint64_t* ErrorCount);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
Count OUT uint64_t* A pointer to a variable that receives the number of acquired images.
ErrorCount OUT uint64_t* A pointer to a variable that receives the number of Grab errors.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
uint64_t count = 0;
uint64_t errorCount = 0;

CVS_ERROR err = ST_GetGrabCount(hDevice, &count, &errorCount);
if (err == MCAM_ERR_OK)
{
    printf("grabCount=%llu, errorCount=%llu\n",
           (unsigned long long)count,
           (unsigned long long)errorCount);
}

5.6.6 ST_GetFrameRate#

Queries the device frame rate.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetFrameRate(int32_t hDevice, double* FrameRate);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
FrameRate OUT double* A pointer to a variable that receives the frame rate.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
double frameRate = 0.0;

CVS_ERROR err = ST_GetFrameRate(hDevice, &frameRate);
if (err == MCAM_ERR_OK)
{
    printf("frameRate = %.3f fps\n", frameRate);
}

5.6.7 ST_GetBandwidth#

Queries the device bandwidth.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetBandwidth(int32_t hDevice, double* Bandwidth);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
Bandwidth OUT double* A pointer to a variable that receives the bandwidth value.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
double bandwidth = 0.0;

CVS_ERROR err = ST_GetBandwidth(hDevice, &bandwidth);
if (err == MCAM_ERR_OK)
{
    printf("bandwidth = %.3f\n", bandwidth);
}

5.6.8 ST_GetLastError#

Queries the device's last error code.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetLastError(int32_t hDevice);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.

Return Value

  • The device's last error code (MCAM_ERR_*)

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
// Example: Deliberately use an invalid node name to trigger an error, then check the last error.
(void)ST_SetIntReg(hDevice, "InvalidNodeName", 1);

CVS_ERROR lastError = ST_GetLastError(hDevice);
printf("lastError = %d\n", lastError);

5.6.9 ST_GetLastErrorDescription#

Queries the description string for the device's last error.

Signature

CVS_IMPORT_EXPORT const char* WINAPI ST_GetLastErrorDescription(int32_t hDevice);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.

Return Value

  • Description string for the last error

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
// Example: Query the last error string directly.
(void)ST_SetIntReg(hDevice, "InvalidNodeName", 1);

const char* description = ST_GetLastErrorDescription(hDevice);
printf("lastErrorDescription = %s\n", description != nullptr ? description : "(null)");

5.7 Log and Configuration Management#

These functions control whether detailed logging is enabled.

5.7.1 ST_SetDetailedLog#

Sets whether detailed logging is enabled for the device.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_SetDetailedLog(int32_t hDevice, bool Flag);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
Flag IN bool Specify true to enable detailed logging, or false to disable it.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CVS_ERROR err = ST_SetDetailedLog(hDevice, true);
if (err != MCAM_ERR_OK)
{
    printf("ST_SetDetailedLog failed: %d\n", err);
}

5.7.2 ST_GetDetailedLog#

Queries whether detailed logging is enabled for the device.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetDetailedLog(int32_t hDevice, bool* pFlag);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
pFlag OUT bool* A pointer to a Boolean variable that receives whether detailed logging is enabled.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
bool enabled = false;

CVS_ERROR err = ST_GetDetailedLog(hDevice, &enabled);
if (err == MCAM_ERR_OK)
{
    printf("detailedLog = %s\n", enabled ? "true" : "false");
}

5.8 Register Control#

These functions read and write basic register values.

5.8.1 ST_SetIntReg#

Sets an integer register value.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_SetIntReg(int32_t hDevice, const char* NodeName, int64_t val);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
NodeName IN const char* The integer register node name.
val IN int64_t The value to set.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
// Change the node name to match the actual device XML.
CVS_ERROR err = ST_SetIntReg(hDevice, "Width", 1920);
if (err != MCAM_ERR_OK)
{
    printf("ST_SetIntReg failed: %d\n", err);
}

5.8.2 ST_GetIntReg#

Queries an integer register value.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetIntReg(int32_t hDevice, const char* NodeName, int64_t* pVal);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
NodeName IN const char* The integer register node name.
pVal OUT int64_t* A pointer to a variable that receives the query result.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
int64_t value = 0;

CVS_ERROR err = ST_GetIntReg(hDevice, "Width", &value);
if (err == MCAM_ERR_OK)
{
    printf("Width = %lld\n", (long long)value);
}

5.8.3 ST_SetFloatReg#

Sets a floating-point register value.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_SetFloatReg(int32_t hDevice, const char* NodeName, double fVal);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
NodeName IN const char* The floating-point register node name.
fVal IN double The value to set.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CVS_ERROR err = ST_SetFloatReg(hDevice, "ExposureTime", 5000.0);
if (err != MCAM_ERR_OK)
{
    printf("ST_SetFloatReg failed: %d\n", err);
}

5.8.4 ST_GetFloatReg#

Queries a floating-point register value.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetFloatReg(int32_t hDevice, const char* NodeName, double* pFval);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
NodeName IN const char* The floating-point register node name.
pFval OUT double* A pointer to a variable that receives the query result.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
double value = 0.0;

CVS_ERROR err = ST_GetFloatReg(hDevice, "ExposureTime", &value);
if (err == MCAM_ERR_OK)
{
    printf("ExposureTime = %.3f\n", value);
}

5.8.5 ST_SetBoolReg#

Sets a Boolean register value.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_SetBoolReg(int32_t hDevice, const char* NodeName, bool bVal);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
NodeName IN const char* The Boolean register node name.
bVal IN bool The value to set.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CVS_ERROR err = ST_SetBoolReg(hDevice, "GammaEnable", true);
if (err != MCAM_ERR_OK)
{
    printf("ST_SetBoolReg failed: %d\n", err);
}

5.8.6 ST_GetBoolReg#

Queries a Boolean register value.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetBoolReg(int32_t hDevice, const char* NodeName, bool* pBval);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
NodeName IN const char* The Boolean register node name.
pBval OUT bool* A pointer to a variable that receives the query result.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
bool value = false;

CVS_ERROR err = ST_GetBoolReg(hDevice, "GammaEnable", &value);
if (err == MCAM_ERR_OK)
{
    printf("GammaEnable = %s\n", value ? "true" : "false");
}

5.8.7 ST_SetEnumReg#

Sets an enumeration register value.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_SetEnumReg(int32_t hDevice, const char* NodeName, const char* val);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
NodeName IN const char* The enumeration register node name.
val IN const char* The string value to set.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CVS_ERROR err = ST_SetEnumReg(hDevice, "PixelFormat", "Mono8");
if (err != MCAM_ERR_OK)
{
    printf("ST_SetEnumReg failed: %d\n", err);
}

5.8.8 ST_GetEnumReg#

Queries an enumeration register value.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetEnumReg(int32_t hDevice, const char* NodeName, char* pInfo, uint32_t* pSize);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
NodeName IN const char* The enumeration register node name.
pInfo OUT char* A string buffer that receives the query result.
pSize IN/OUT uint32_t* A pointer to a variable used to specify the buffer size and receive the actual size after the call.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
char value[256] = {};
uint32_t size = sizeof(value);

CVS_ERROR err = ST_GetEnumReg(hDevice, "PixelFormat", value, &size);
if (err == MCAM_ERR_OK)
{
    printf("PixelFormat = %s\n", value);
}

5.8.9 ST_SetStrReg#

Sets a string register value.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_SetStrReg(int32_t hDevice, const char* NodeName, char* val);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
NodeName IN const char* The string register node name.
val IN char* The string value to set.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Notes

  • In the declaration, the input argument type is char*. Follow the header declaration as-is when writing calling code.

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
char userId[] = "LineA_Camera01";

CVS_ERROR err = ST_SetStrReg(hDevice, "DeviceUserID", userId);
if (err != MCAM_ERR_OK)
{
    printf("ST_SetStrReg failed: %d\n", err);
}

5.8.10 ST_GetStrReg#

Queries a string register value.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetStrReg(int32_t hDevice, const char* NodeName, char* pInfo, uint32_t* pSize);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
NodeName IN const char* The string register node name.
pInfo OUT char* A string buffer that receives the query result.
pSize IN/OUT uint32_t* A pointer to a variable used to specify the buffer size and receive the actual size after the call.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
char value[512] = {};
uint32_t size = sizeof(value);

CVS_ERROR err = ST_GetStrReg(hDevice, "DeviceUserID", value, &size);
if (err == MCAM_ERR_OK)
{
    printf("DeviceUserID = %s\n", value);
}

5.8.11 ST_SetCmdReg#

Executes a command register.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_SetCmdReg(int32_t hDevice, const char* NodeName);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
NodeName IN const char* The command register node name.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
// Example node names may vary depending on the device.
CVS_ERROR err = ST_SetCmdReg(hDevice, "UserSetLoad");
if (err != MCAM_ERR_OK)
{
    printf("ST_SetCmdReg failed: %d\n", err);
}

5.9 Register Information Query#

These functions query register ranges and enumeration entry information.

5.9.1 ST_GetIntRegRange#

Queries the range of an integer register.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetIntRegRange(int32_t hDevice, const char* NodeName, int64_t* pMin, int64_t* pMax, int64_t* pInc);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
NodeName IN const char* The integer register node name.
pMin OUT int64_t* A pointer to a variable that receives the minimum value.
pMax OUT int64_t* A pointer to a variable that receives the maximum value.
pInc OUT int64_t* A pointer to a variable that receives the increment step.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
int64_t minValue = 0;
int64_t maxValue = 0;
int64_t increment = 0;

CVS_ERROR err = ST_GetIntRegRange(hDevice, "Width", &minValue, &maxValue, &increment);
if (err == MCAM_ERR_OK)
{
    printf("Width range: min=%lld, max=%lld, inc=%lld\n",
           (long long)minValue,
           (long long)maxValue,
           (long long)increment);
}

5.9.2 ST_GetFloatRegRange#

Queries the range of a floating-point register.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetFloatRegRange(int32_t hDevice, const char* NodeName, double* pMin, double* pMax);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
NodeName IN const char* The floating-point register node name.
pMin OUT double* A pointer to a variable that receives the minimum value.
pMax OUT double* A pointer to a variable that receives the maximum value.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
double minValue = 0.0;
double maxValue = 0.0;

CVS_ERROR err = ST_GetFloatRegRange(hDevice, "ExposureTime", &minValue, &maxValue);
if (err == MCAM_ERR_OK)
{
    printf("ExposureTime range: min=%.3f, max=%.3f\n", minValue, maxValue);
}

5.9.3 ST_GetEnumEntrySize#

Queries the number of enumeration register entries.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetEnumEntrySize(int32_t hDevice, const char* NodeName, int32_t* pVal);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
NodeName IN const char* The enumeration register node name.
pVal OUT int32_t* A pointer to a variable that receives the number of entries.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
int32_t entryCount = 0;

CVS_ERROR err = ST_GetEnumEntrySize(hDevice, "PixelFormat", &entryCount);
if (err == MCAM_ERR_OK)
{
    printf("PixelFormat entryCount = %d\n", entryCount);
}

5.9.4 ST_GetEnumEntryIntValue#

Queries the integer value of an enumeration entry.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetEnumEntryIntValue(int32_t hDevice, const char* NodeName, int32_t EntryIdx, int32_t* pVal);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
NodeName IN const char* The enumeration register node name.
EntryIdx IN int32_t The enumeration entry index to query.
pVal OUT int32_t* A pointer to a variable that receives the integer value.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
int32_t intValue = 0;

CVS_ERROR err = ST_GetEnumEntryIntValue(hDevice, "PixelFormat", 0, &intValue);
if (err == MCAM_ERR_OK)
{
    printf("entry[0].intValue = %d\n", intValue);
}

5.9.5 ST_GetEnumEntryValue#

Queries the string value of an enumeration entry.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetEnumEntryValue(int32_t hDevice, const char* NodeName, int32_t EntryIdx, char* pInfo, uint32_t* pSize);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
NodeName IN const char* The enumeration register node name.
EntryIdx IN int32_t The enumeration entry index to query.
pInfo OUT char* A buffer that receives the enumeration entry string value.
pSize IN/OUT uint32_t* A pointer to a variable used to specify the buffer size and receive the actual size after the call.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
char value[256] = {};
uint32_t size = sizeof(value);

CVS_ERROR err = ST_GetEnumEntryValue(hDevice, "PixelFormat", 0, value, &size);
if (err == MCAM_ERR_OK)
{
    printf("entry[0].value = %s\n", value);
}

5.10 Parameter Read and Write#

These are address-based parameter read/write functions.

5.10.1 ST_ReadParam#

Reads parameters from the device.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_ReadParam(int32_t hDevice, unsigned char* pBuffer, int64_t Address, int64_t Length);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
pBuffer OUT unsigned char* A buffer that receives the parameter data.
Address IN int64_t The parameter address.
Length IN int64_t The number of bytes to read.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
// Set the address and length according to the actual device manual.
unsigned char buffer[16] = {};
int64_t address = 0x1000;
int64_t length = sizeof(buffer);

CVS_ERROR err = ST_ReadParam(hDevice, buffer, address, length);
if (err == MCAM_ERR_OK)
{
    printf("read %lld bytes from 0x%llX\n",
           (long long)length,
           (long long)address);
}

5.10.2 ST_WriteParam#

Writes parameters to the device.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_WriteParam(int32_t hDevice, const unsigned char* pBuffer, int64_t Address, int64_t Length);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
pBuffer IN const unsigned char* The parameter data buffer to write.
Address IN int64_t The parameter address.
Length IN int64_t The number of bytes to write.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
// Set the address and data format according to the actual device manual.
unsigned char buffer[4] = {0x01, 0x02, 0x03, 0x04};
int64_t address = 0x1000;
int64_t length = sizeof(buffer);

CVS_ERROR err = ST_WriteParam(hDevice, buffer, address, length);
if (err != MCAM_ERR_OK)
{
    printf("ST_WriteParam failed: %d\n", err);
}

5.11 Extended Register and Parameter Control#

These are module-based extended register/parameter access functions.

5.11.1 ST_SetIntRegEx#

Sets the integer register value of the specified module.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_SetIntRegEx(int32_t hDevice, CvsModuleType moduleType, const char* NodeName, int64_t val);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to access.
NodeName IN const char* The integer register node name.
val IN int64_t The value to set.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;

CVS_ERROR err = ST_SetIntRegEx(hDevice, moduleType, "Width", 1920);
if (err != MCAM_ERR_OK)
{
    printf("ST_SetIntRegEx failed: %d\n", err);
}

5.11.2 ST_GetIntRegEx#

Queries the integer register value of the specified module.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetIntRegEx(int32_t hDevice, CvsModuleType moduleType, const char* NodeName, int64_t* pVal);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to access.
NodeName IN const char* The integer register node name.
pVal OUT int64_t* A pointer to a variable that receives the query result.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
int64_t value = 0;

CVS_ERROR err = ST_GetIntRegEx(hDevice, moduleType, "Width", &value);
if (err == MCAM_ERR_OK)
{
    printf("Width = %lld\n", (long long)value);
}

5.11.3 ST_SetFloatRegEx#

Sets the floating-point register value of the specified module.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_SetFloatRegEx(int32_t hDevice, CvsModuleType moduleType, const char* NodeName, double fVal);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to access.
NodeName IN const char* The floating-point register node name.
fVal IN double The value to set.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;

CVS_ERROR err = ST_SetFloatRegEx(hDevice, moduleType, "ExposureTime", 5000.0);
if (err != MCAM_ERR_OK)
{
    printf("ST_SetFloatRegEx failed: %d\n", err);
}

5.11.4 ST_GetFloatRegEx#

Queries the floating-point register value of the specified module.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetFloatRegEx(int32_t hDevice, CvsModuleType moduleType, const char* NodeName, double* pFval);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to access.
NodeName IN const char* The floating-point register node name.
pFval OUT double* A pointer to a variable that receives the query result.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
double value = 0.0;

CVS_ERROR err = ST_GetFloatRegEx(hDevice, moduleType, "ExposureTime", &value);
if (err == MCAM_ERR_OK)
{
    printf("ExposureTime = %.3f\n", value);
}

5.11.5 ST_SetBoolRegEx#

Sets the Boolean register value of the specified module.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_SetBoolRegEx(int32_t hDevice, CvsModuleType moduleType, const char* NodeName, bool bVal);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to access.
NodeName IN const char* The Boolean register node name.
bVal IN bool The value to set.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;

CVS_ERROR err = ST_SetBoolRegEx(hDevice, moduleType, "GammaEnable", true);
if (err != MCAM_ERR_OK)
{
    printf("ST_SetBoolRegEx failed: %d\n", err);
}

5.11.6 ST_GetBoolRegEx#

Queries the Boolean register value of the specified module.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetBoolRegEx(int32_t hDevice, CvsModuleType moduleType, const char* NodeName, bool* pBval);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to access.
NodeName IN const char* The Boolean register node name.
pBval OUT bool* A pointer to a variable that receives the query result.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
bool value = false;

CVS_ERROR err = ST_GetBoolRegEx(hDevice, moduleType, "GammaEnable", &value);
if (err == MCAM_ERR_OK)
{
    printf("GammaEnable = %s\n", value ? "true" : "false");
}

5.11.7 ST_SetEnumRegEx#

Sets the enumeration register value of the specified module.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_SetEnumRegEx(int32_t hDevice, CvsModuleType moduleType, const char* NodeName, const char* val);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to access.
NodeName IN const char* The enumeration register node name.
val IN const char* The string value to set.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;

CVS_ERROR err = ST_SetEnumRegEx(hDevice, moduleType, "PixelFormat", "Mono8");
if (err != MCAM_ERR_OK)
{
    printf("ST_SetEnumRegEx failed: %d\n", err);
}

5.11.8 ST_GetEnumRegEx#

Queries the enumeration register value of the specified module.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetEnumRegEx(int32_t hDevice, CvsModuleType moduleType, const char* NodeName, char* pInfo, uint32_t* pSize);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to access.
NodeName IN const char* The enumeration register node name.
pInfo OUT char* A string buffer that receives the query result.
pSize IN/OUT uint32_t* A pointer to a variable used to specify the buffer size and receive the actual size after the call.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
char value[256] = {};
uint32_t size = sizeof(value);

CVS_ERROR err = ST_GetEnumRegEx(hDevice, moduleType, "PixelFormat", value, &size);
if (err == MCAM_ERR_OK)
{
    printf("PixelFormat = %s\n", value);
}

5.11.9 ST_SetStrRegEx#

Sets the string register value of the specified module.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_SetStrRegEx(int32_t hDevice, CvsModuleType moduleType, const char* NodeName, const char* val);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to access.
NodeName IN const char* The string register node name.
val IN const char* The string value to set.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;

CVS_ERROR err = ST_SetStrRegEx(hDevice, moduleType, "DeviceUserID", "LineA_Camera01");
if (err != MCAM_ERR_OK)
{
    printf("ST_SetStrRegEx failed: %d\n", err);
}

5.11.10 ST_GetStrRegEx#

Queries the string register value of the specified module.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetStrRegEx(int32_t hDevice, CvsModuleType moduleType, const char* NodeName, char* pInfo, uint32_t* pSize);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to access.
NodeName IN const char* The string register node name.
pInfo OUT char* A string buffer that receives the query result.
pSize IN/OUT uint32_t* A pointer to a variable used to specify the buffer size and receive the actual size after the call.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
char value[512] = {};
uint32_t size = sizeof(value);

CVS_ERROR err = ST_GetStrRegEx(hDevice, moduleType, "DeviceUserID", value, &size);
if (err == MCAM_ERR_OK)
{
    printf("DeviceUserID = %s\n", value);
}

5.11.11 ST_SetCmdRegEx#

Executes the command register of the specified module.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_SetCmdRegEx(int32_t hDevice, CvsModuleType moduleType, const char* NodeName);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to access.
NodeName IN const char* The command register node name.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;

// Example node names may vary depending on the device XML.
CVS_ERROR err = ST_SetCmdRegEx(hDevice, moduleType, "UserSetLoad");
if (err != MCAM_ERR_OK)
{
    printf("ST_SetCmdRegEx failed: %d\n", err);
}

5.11.12 ST_GetIntRegRangeEx#

Queries the integer register range of the specified module.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetIntRegRangeEx(int32_t hDevice, CvsModuleType moduleType, const char* NodeName, int64_t* pMin, int64_t* pMax, int64_t* pInc);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to access.
NodeName IN const char* The integer register node name.
pMin OUT int64_t* A pointer to a variable that receives the minimum value.
pMax OUT int64_t* A pointer to a variable that receives the maximum value.
pInc OUT int64_t* A pointer to a variable that receives the increment step.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
int64_t minValue = 0;
int64_t maxValue = 0;
int64_t increment = 0;

CVS_ERROR err = ST_GetIntRegRangeEx(hDevice, moduleType, "Width", &minValue, &maxValue, &increment);
if (err == MCAM_ERR_OK)
{
    printf("Width range: min=%lld, max=%lld, inc=%lld\n",
           (long long)minValue,
           (long long)maxValue,
           (long long)increment);
}

5.11.13 ST_GetFloatRegRangeEx#

Queries the floating-point register range of the specified module.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetFloatRegRangeEx(int32_t hDevice, CvsModuleType moduleType, const char* NodeName, double* pMin, double* pMax);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to access.
NodeName IN const char* The floating-point register node name.
pMin OUT double* A pointer to a variable that receives the minimum value.
pMax OUT double* A pointer to a variable that receives the maximum value.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
double minValue = 0.0;
double maxValue = 0.0;

CVS_ERROR err = ST_GetFloatRegRangeEx(hDevice, moduleType, "ExposureTime", &minValue, &maxValue);
if (err == MCAM_ERR_OK)
{
    printf("ExposureTime range: min=%.3f, max=%.3f\n", minValue, maxValue);
}

5.11.14 ST_GetEnumEntrySizeEx#

Queries the number of enumeration register entries of the specified module.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetEnumEntrySizeEx(int32_t hDevice, CvsModuleType moduleType, const char* NodeName, int32_t* pVal);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to access.
NodeName IN const char* The enumeration register node name.
pVal OUT int32_t* A pointer to a variable that receives the number of entries.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
int32_t entryCount = 0;

CVS_ERROR err = ST_GetEnumEntrySizeEx(hDevice, moduleType, "PixelFormat", &entryCount);
if (err == MCAM_ERR_OK)
{
    printf("PixelFormat entryCount = %d\n", entryCount);
}

5.11.15 ST_GetEnumEntryIntValueEx#

Queries the enumeration entry integer value of the specified module.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetEnumEntryIntValueEx(int32_t hDevice, CvsModuleType moduleType, const char* NodeName, int32_t EntryIdx, int32_t* pVal);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to access.
NodeName IN const char* The enumeration register node name.
EntryIdx IN int32_t The enumeration entry index to query.
pVal OUT int32_t* A pointer to a variable that receives the integer value.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
int32_t intValue = 0;

CVS_ERROR err = ST_GetEnumEntryIntValueEx(hDevice, moduleType, "PixelFormat", 0, &intValue);
if (err == MCAM_ERR_OK)
{
    printf("entry[0].intValue = %d\n", intValue);
}

5.11.16 ST_GetEnumEntryValueEx#

Queries the enumeration entry string value of the specified module.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetEnumEntryValueEx(int32_t hDevice, CvsModuleType moduleType, const char* NodeName, int32_t EntryIdx, char* pInfo, uint32_t* pSize);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to access.
NodeName IN const char* The enumeration register node name.
EntryIdx IN int32_t The enumeration entry index to query.
pInfo OUT char* A buffer that receives the enumeration entry string value.
pSize IN/OUT uint32_t* A pointer to a variable used to specify the buffer size and receive the actual size after the call.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
char value[256] = {};
uint32_t size = sizeof(value);

CVS_ERROR err = ST_GetEnumEntryValueEx(hDevice, moduleType, "PixelFormat", 0, value, &size);
if (err == MCAM_ERR_OK)
{
    printf("entry[0].value = %s\n", value);
}

5.11.17 ST_ReadParamEx#

Reads parameters from the specified module.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_ReadParamEx(int32_t hDevice, CvsModuleType moduleType, unsigned char* pBuffer, int64_t Address, int64_t Length);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to access.
pBuffer OUT unsigned char* A buffer that receives the parameter data.
Address IN int64_t The parameter address.
Length IN int64_t The number of bytes to read.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
// Set the address and length according to the actual module register map.
unsigned char buffer[16] = {};
int64_t address = 0x1000;
int64_t length = sizeof(buffer);

CVS_ERROR err = ST_ReadParamEx(hDevice, moduleType, buffer, address, length);
if (err == MCAM_ERR_OK)
{
    printf("read %lld bytes from module %d, address 0x%llX\n",
           (long long)length,
           (int)moduleType,
           (long long)address);
}

5.11.18 ST_WriteParamEx#

Writes parameters to the specified module.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_WriteParamEx(int32_t hDevice, CvsModuleType moduleType, const unsigned char* pBuffer, int64_t Address, int64_t Length);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to access.
pBuffer IN const unsigned char* The parameter data buffer to write.
Address IN int64_t The parameter address.
Length IN int64_t The number of bytes to write.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
// Set the address and data format according to the actual module register map.
unsigned char buffer[4] = {0x01, 0x02, 0x03, 0x04};
int64_t address = 0x1000;
int64_t length = sizeof(buffer);

CVS_ERROR err = ST_WriteParamEx(hDevice, moduleType, buffer, address, length);
if (err != MCAM_ERR_OK)
{
    printf("ST_WriteParamEx failed: %d\n", err);
}

5.12 Feature and Metadata Query#

These functions query the feature list, detailed metadata, and feature dependency relationships.

5.12.1 ST_GetFeatureSize#

Queries the number of features in the specified module.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetFeatureSize(int32_t hDevice, CvsModuleType moduleType, uint32_t* pFeatureSize);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to query.
pFeatureSize OUT uint32_t* a variable that receives the number of available features.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Notes

  • Use CvsModuleType values for moduleType. ModuleRemoteDevice is commonly used for general camera parameter queries.

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
uint32_t featureCount = 0;

CVS_ERROR err = ST_GetFeatureSize(hDevice, moduleType, &featureCount);
if (err == MCAM_ERR_OK)
{
    printf("featureCount = %u\n", featureCount);
}

5.12.2 ST_GetFeatureList#

Queries an item from the feature list of the specified module.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetFeatureList(int32_t hDevice, CvsModuleType moduleType, int32_t index, CVS_FEATURE* pFeatureList);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to query.
index IN int32_t The index of the feature in the feature list.
pFeatureList OUT CVS_FEATURE* A pointer to a CVS_FEATURE structure that receives the feature information.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Notes

  • When iterating through the feature list, the usual approach is to check the total count first with ST_GetFeatureSize() and then increment the index.

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
CVS_FEATURE feature = {};

CVS_ERROR err = ST_GetFeatureList(hDevice, moduleType, 0, &feature);
if (err == MCAM_ERR_OK)
{
    printf("name=%s, category=%s, type=%d\n",
           feature.name,
           feature.category,
           (int)feature.type);
}

5.12.3 ST_GetIntFeatureInfo#

Queries detailed information about an integer feature.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetIntFeatureInfo(int32_t hDevice, CvsModuleType moduleType, const char* FeatureName, CVS_FEATURE_INTEGER_INFO* pInfo);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to query.
FeatureName IN const char* The integer feature name.
pInfo OUT CVS_FEATURE_INTEGER_INFO* A pointer to a CVS_FEATURE_INTEGER_INFO structure that receives the integer feature information.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
CVS_FEATURE_INTEGER_INFO info = {};

CVS_ERROR err = ST_GetIntFeatureInfo(hDevice, moduleType, "Width", &info);
if (err == MCAM_ERR_OK)
{
    printf("Width: value=%lld, min=%lld, max=%lld, inc=%lld, unit=%s\n",
           (long long)info.value,
           (long long)info.min,
           (long long)info.max,
           (long long)info.inc,
           info.unit);
}

5.12.4 ST_GetFloatFeatureInfo#

Queries detailed information about a floating-point feature.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetFloatFeatureInfo(int32_t hDevice, CvsModuleType moduleType, const char* FeatureName, CVS_FEATURE_FLOAT_INFO* pInfo);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to query.
FeatureName IN const char* The floating-point feature name.
pInfo OUT CVS_FEATURE_FLOAT_INFO* A pointer to a CVS_FEATURE_FLOAT_INFO structure that receives the floating-point feature information.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
CVS_FEATURE_FLOAT_INFO info = {};

CVS_ERROR err = ST_GetFloatFeatureInfo(hDevice, moduleType, "ExposureTime", &info);
if (err == MCAM_ERR_OK)
{
    printf("ExposureTime: value=%.3f, min=%.3f, max=%.3f, unit=%s\n",
           info.value,
           info.min,
           info.max,
           info.unit);
}

5.12.5 ST_GetBoolFeatureInfo#

Queries detailed information about a Boolean feature.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetBoolFeatureInfo(int32_t hDevice, CvsModuleType moduleType, const char* FeatureName, CVS_FEATURE_BOOLEAN_INFO* pInfo);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to query.
FeatureName IN const char* The Boolean feature name.
pInfo OUT CVS_FEATURE_BOOLEAN_INFO* A pointer to a CVS_FEATURE_BOOLEAN_INFO structure that receives the Boolean feature information.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
CVS_FEATURE_BOOLEAN_INFO info = {};

CVS_ERROR err = ST_GetBoolFeatureInfo(hDevice, moduleType, "GammaEnable", &info);
if (err == MCAM_ERR_OK)
{
    printf("GammaEnable: value=%s, readable=%s, writable=%s\n",
           info.value ? "true" : "false",
           info.common.isReadable ? "true" : "false",
           info.common.isWritable ? "true" : "false");
}

5.12.6 ST_GetStrFeatureInfo#

Queries detailed information about a string feature.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetStrFeatureInfo(int32_t hDevice, CvsModuleType moduleType, const char* FeatureName, CVS_FEATURE_STRING_INFO* pInfo);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to query.
FeatureName IN const char* The string feature name.
pInfo OUT CVS_FEATURE_STRING_INFO* A pointer to a CVS_FEATURE_STRING_INFO structure that receives the string feature information.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
CVS_FEATURE_STRING_INFO info = {};

CVS_ERROR err = ST_GetStrFeatureInfo(hDevice, moduleType, "DeviceUserID", &info);
if (err == MCAM_ERR_OK)
{
    printf("DeviceUserID: value=%s, displayName=%s\n",
           info.value,
           info.common.displayName);
}

5.12.7 ST_GetEnumFeatureInfo#

Queries detailed information about an enumeration feature.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetEnumFeatureInfo(int32_t hDevice, CvsModuleType moduleType, const char* FeatureName, CVS_FEATURE_ENUMERATION_INFO* pInfo);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to query.
FeatureName IN const char* The enumeration feature name.
pInfo OUT CVS_FEATURE_ENUMERATION_INFO* A pointer to a CVS_FEATURE_ENUMERATION_INFO structure that receives the enumeration feature information.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
CVS_FEATURE_ENUMERATION_INFO info = {};

CVS_ERROR err = ST_GetEnumFeatureInfo(hDevice, moduleType, "PixelFormat", &info);
if (err == MCAM_ERR_OK)
{
    printf("PixelFormat: currentValue=%s, currentIntValue=%lld, entryCount=%d\n",
           info.currentValue,
           (long long)info.currentIntValue,
           info.entryCount);
}

5.12.8 ST_GetCommandFeatureInfo#

Queries detailed information about a command feature.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetCommandFeatureInfo(int32_t hDevice, CvsModuleType moduleType, const char* FeatureName, CVS_FEATURE_COMMAND_INFO* pInfo);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to query.
FeatureName IN const char* The command feature name.
pInfo OUT CVS_FEATURE_COMMAND_INFO* A pointer to a CVS_FEATURE_COMMAND_INFO structure that receives the command feature information.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
CVS_FEATURE_COMMAND_INFO info = {};

CVS_ERROR err = ST_GetCommandFeatureInfo(hDevice, moduleType, "UserSetLoad", &info);
if (err == MCAM_ERR_OK)
{
    printf("command displayName=%s, accessMode=%d\n",
           info.common.displayName,
           (int)info.common.accessMode);
}

5.12.9 ST_GetEnumEntryInfo#

Queries detailed information about an enumeration feature entry.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetEnumEntryInfo(int32_t hDevice, CvsModuleType moduleType, const char* FeatureName, int32_t EntryIdx, CVS_FEATURE_ENUM_ENTRY_INFO* pInfo);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to query.
FeatureName IN const char* The enumeration feature name.
EntryIdx IN int32_t The enumeration entry index to query.
pInfo OUT CVS_FEATURE_ENUM_ENTRY_INFO* A pointer to a CVS_FEATURE_ENUM_ENTRY_INFO structure that receives the enumeration entry information.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
CVS_FEATURE_ENUM_ENTRY_INFO info = {};

CVS_ERROR err = ST_GetEnumEntryInfo(hDevice, moduleType, "PixelFormat", 0, &info);
if (err == MCAM_ERR_OK)
{
    printf("entry[0]: value=%s, intValue=%d, displayName=%s\n",
           info.stringValue,
           info.intValue,
           info.displayName);
}

5.12.10 ST_GetDependingFeatureCount#

Queries the number of features that depend on the specified feature node.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetDependingFeatureCount(int32_t hDevice, CvsModuleType moduleType, const char* NodeName, uint32_t* pCount);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to query.
NodeName IN const char* The base feature node name.
pCount OUT uint32_t* A pointer to a variable that receives the number of dependent features.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
uint32_t count = 0;

CVS_ERROR err = ST_GetDependingFeatureCount(hDevice, moduleType, "TriggerMode", &count);
if (err == MCAM_ERR_OK)
{
    printf("depending feature count = %u\n", count);
}

5.12.11 ST_GetDependingFeatureName#

Queries the name of a feature that depends on the specified feature node by index.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_GetDependingFeatureName(int32_t hDevice, CvsModuleType moduleType, const char* NodeName, int32_t index, char* pInfo, uint32_t* pSize);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
moduleType IN CvsModuleType The module type to query.
NodeName IN const char* The base feature node name.
index IN int32_t The dependent feature index to query.
pInfo OUT char* A buffer that receives the dependent feature name.
pSize IN/OUT uint32_t* A pointer to a variable used to specify the buffer size and receive the actual written length.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CvsModuleType moduleType = ModuleRemoteDevice;
char featureName[256] = {};
uint32_t size = sizeof(featureName);

CVS_ERROR err = ST_GetDependingFeatureName(hDevice, moduleType, "TriggerMode", 0, featureName, &size);
if (err == MCAM_ERR_OK)
{
    printf("depending feature[0] = %s\n", featureName);
}

5.13 Image Color Conversion#

This function performs image color-space conversion.

5.13.1 ST_CvtColor#

Converts an image from one color space to another.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_CvtColor(CVS_BUFFER pSrc, CVS_BUFFER* pDest, int32_t code);

Parameters

Name I/O Type Description
pSrc IN CVS_BUFFER The source buffer.
pDest OUT CVS_BUFFER* A pointer to the destination buffer.
code IN int32_t The color conversion code.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Notes

  • The source and destination buffer memory must remain valid during the call.
  • It is recommended to prepare the destination buffer with channel count and size appropriate for the conversion result format.

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
// Example: Converting BayerRG 8-bit input to BGR
CVS_BUFFER src = {};
CVS_BUFFER dst = {};

if (ST_InitBuffer(hDevice, &src, 0) == MCAM_ERR_OK &&
    ST_InitBuffer(hDevice, &dst, 3) == MCAM_ERR_OK &&
    ST_SingleGrabImage(hDevice, &src) == MCAM_ERR_OK)
{
    CVS_ERROR err = ST_CvtColor(src, &dst, CVP_BayerRG2BGR);
    if (err == MCAM_ERR_OK)
    {
        printf("converted image: %d x %d, channels=%d\n",
               dst.image.width,
               dst.image.height,
               dst.image.channels);
    }

    ST_FreeBuffer(&src);
    ST_FreeBuffer(&dst);
}

5.14 XML and JSON File Management#

These functions import or export device settings as XML/JSON files.

5.14.1 ST_ImportXML#

Imports settings from an XML file.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_ImportXML(int32_t hDevice, const char* FileName);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
FileName IN const char* The XML file name or path.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CVS_ERROR err = ST_ImportXML(hDevice, "camera_config.xml");
if (err != MCAM_ERR_OK)
{
    printf("ST_ImportXML failed: %d\n", err);
}

5.14.2 ST_ExportXML#

Exports camera settings to an XML file.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_ExportXML(int32_t hDevice, const char* FileName, int Version = XML_VERSION_1_1, int Visibility = VISIBILITY_GURU);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
FileName IN const char* The XML file name or path to export.
Version IN int The XML version. The default value is XML_VERSION_1_1.
Visibility IN int The parameter visibility level to export. The default value is VISIBILITY_GURU.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Notes

  • The default values are Version = XML_VERSION_1_1 and Visibility = VISIBILITY_GURU.

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CVS_ERROR err = ST_ExportXML(
    hDevice,
    "camera_export.xml",
    XML_VERSION_1_1,
    VISIBILITY_GURU
);

if (err != MCAM_ERR_OK)
{
    printf("ST_ExportXML failed: %d\n", err);
}

5.14.3 ST_ImportJson#

Imports a JSON configuration file for the device.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_ImportJson(int32_t hDevice, const char* FileName);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
FileName IN const char* The JSON file name or path.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CVS_ERROR err = ST_ImportJson(hDevice, "camera_config.json");
if (err != MCAM_ERR_OK)
{
    printf("ST_ImportJson failed: %d\n", err);
}

5.14.4 ST_ExportJson#

Exports device settings to a JSON file.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_ExportJson(int32_t hDevice, const char* FileName, int Visibility = VISIBILITY_GURU);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
FileName IN const char* The JSON file name or path to export.
Visibility IN int The parameter visibility level to export. The default value is VISIBILITY_GURU.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Notes

  • The default value is Visibility = VISIBILITY_GURU.

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CVS_ERROR err = ST_ExportJson(hDevice, "camera_export.json", VISIBILITY_GURU);
if (err != MCAM_ERR_OK)
{
    printf("ST_ExportJson failed: %d\n", err);
}

5.15 Event and Callback Management#

These functions register/unregister Grab event and device event callbacks.

5.15.1 ST_RegisterGrabCallback#

Registers a Grab event callback function.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_RegisterGrabCallback(int32_t hDevice, int32_t Event, GrabCallback grabCallback, void* UserData);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
Event IN int32_t The Grab event ID.
grabCallback IN GrabCallback The callback function to register.
UserData IN void* A pointer to user-defined data.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

void WINAPI OnGrab(int32_t eventID, const CVS_BUFFER* pBuffer, void* pUserDefine)
{
    if (eventID == EVENT_NEW_IMAGE && pBuffer != nullptr)
    {
        printf("new image: %d x %d\n", pBuffer->image.width, pBuffer->image.height);
    }
}

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CVS_ERROR err = ST_RegisterGrabCallback(hDevice, EVENT_NEW_IMAGE, OnGrab, nullptr);
if (err != MCAM_ERR_OK)
{
    printf("ST_RegisterGrabCallback failed: %d\n", err);
}

5.15.2 ST_UnregisterGrabCallback#

Unregisters a Grab event callback function.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_UnregisterGrabCallback(int32_t hDevice, int32_t Event);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
Event IN int32_t The Grab event ID.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CVS_ERROR err = ST_UnregisterGrabCallback(hDevice, EVENT_NEW_IMAGE);
if (err != MCAM_ERR_OK)
{
    printf("ST_UnregisterGrabCallback failed: %d\n", err);
}

5.15.3 ST_RegisterEventCallback#

Registers a device event callback function.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_RegisterEventCallback(int32_t hDevice, int32_t Event, EventCallback eventCallback, void* UserData);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
Event IN int32_t The device event ID.
eventCallback IN EventCallback The callback function to register.
UserData IN void* A pointer to user-defined data.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

void WINAPI OnDeviceEvent(const CVS_EVENT* pEvent, void* pUserDefine)
{
    if (pEvent != nullptr)
    {
        printf("event id=%d, timestamp=%llu\n",
               pEvent->id,
               (unsigned long long)pEvent->timestamp);
    }
}

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CVS_ERROR err = ST_RegisterEventCallback(hDevice, EVENT_DEVICE_DISCONNECT, OnDeviceEvent, nullptr);
if (err != MCAM_ERR_OK)
{
    printf("ST_RegisterEventCallback failed: %d\n", err);
}

5.15.4 ST_UnregisterEventCallback#

Unregisters a device event callback function.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_UnregisterEventCallback(int32_t hDevice, int32_t Event);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
Event IN int32_t The device event ID.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CVS_ERROR err = ST_UnregisterEventCallback(hDevice, EVENT_DEVICE_DISCONNECT);
if (err != MCAM_ERR_OK)
{
    printf("ST_UnregisterEventCallback failed: %d\n", err);
}

5.16 Buffer Management#

These functions prepare and release CVS_BUFFER memory.

5.16.1 ST_InitBuffer#

Initializes a CVS_BUFFER structure.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_InitBuffer(int32_t hDevice, CVS_BUFFER* pBuffer, int32_t channels = 0);

Parameters

Name I/O Type Description
hDevice IN int32_t The device handle.
pBuffer OUT CVS_BUFFER* A pointer to the buffer structure to initialize.
channels IN int32_t The buffer channel count. The default value is 0.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Notes

  • When channels = 0, the channel count is designed to be determined automatically according to the camera settings.
  • Use this to prepare a buffer before image acquisition.

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CVS_BUFFER buffer = {};

// channels examples: 0 (auto/based on source), 1 (Gray), 3 (for BGR/RGB)
CVS_ERROR err = ST_InitBuffer(hDevice, &buffer, 3);
if (err == MCAM_ERR_OK)
{
    printf("buffer initialized\n");
}

5.16.2 ST_FreeBuffer#

Releases a CVS_BUFFER structure.

Signature

CVS_IMPORT_EXPORT CVS_ERROR WINAPI ST_FreeBuffer(CVS_BUFFER* pBuffer);

Parameters

Name I/O Type Description
pBuffer IN CVS_BUFFER* A pointer to the buffer structure to release.

Return Value

  • MCAM_ERR_OK: Success
  • Otherwise: Error code

Notes

  • To reuse a released buffer, call ST_InitBuffer() again.

Example

int32_t hDevice = /* Handle obtained after ST_OpenDevice() succeeds */ 0;
CVS_BUFFER buffer = {};

if (ST_InitBuffer(hDevice, &buffer, 0) == MCAM_ERR_OK)
{
    CVS_ERROR err = ST_FreeBuffer(&buffer);
    if (err != MCAM_ERR_OK)
    {
        printf("ST_FreeBuffer failed: %d\n", err);
    }
}

6. Notes#

  • This document is organized based on the attached header declarations. Actual behavior details may vary depending on the distributed DLL/SDK version.
  • Some events and device information may or may not be available depending on the interface (GEV, U3V, CXP).
  • For string/buffer arguments, allocate sufficiently large memory before the call, and for pSize-type arguments, handle both the buffer size and the actual returned size.
  • When using ST_GrabImage(), ST_GrabImageAsync(), ST_SingleGrabImage(), and ST_CvtColor(), manage the order of buffer initialization and memory release carefully.
  • Feature and module-based APIs operate correctly only when the CvsModuleType value and target node name are accurate.

7. License and Copyright#

This library is the property of ©2000 - 2026 CREVIS CO., LTD.

Unauthorized copying and redistribution may be restricted. Please comply with the license policy.