CB_Device SDK · 参数系统

版本 1.0 · 更新于 2026-10-21 · 阅读 0

CB_Device 采用 GenICam 风格的参数树:先按索引或名称查询参数,再按类型(整型/浮点/布尔/枚举/字符串)读写,并可枚举枚举型参数的可选条目。

CB_GetParamNum

CB_RESULT CB_GetParamNum(int32_t iDevIndex, int32_t* piParamNum)

获取所有可能支持的参数数目。

参数 方向 说明
iDevIndex in 设备索引,取值范围[0,(CB_EnumerateDevices()-1)]
piParamNum out 获取参数个数

返回:成功返回 CB_E_SUCCESS;失败返回错误码(见错误码章节)

CB_GetParamNameByIndex

CB_RESULT CB_GetParamNameByIndex(int32_t iDevIndex, int32_t iParamIndex, char* szParamName, int32_t* piBufSize)

通过索引获取参数名称。

参数 方向 说明
iDevIndex in 设备索引,取值范围[0,(CB_EnumerateDevices()-1)]
iParamIndex in 参数索引值,取值范围[0,(CB_GetParamNum()-1)]
szParamName out 用于接收参数名称字符串的内存指针
piBufSize inout 接收内存字节长度

返回:成功返回 CB_E_SUCCESS;失败返回错误码(见错误码章节)

说明

  • @note 如果CB_GetParamNum获取的数目为N,则iParamIndex索引值的范围为[0,N-1]。
  • szParamName指向的内存必须足够大(包括字符串终止符'\0')以接收完整字符串。

CB_GetParamInfoByName

CB_RESULT CB_GetParamInfoByName(int32_t iDevIndex, const char* szParamName, CB_TParamInfo* ptParamInfo)

通过参数名称,获取参数信息。

参数 方向 说明
iDevIndex in 设备索引,取值范围[0,(CB_EnumerateDevices()-1)]
szParamName in 指针指向参数名称字符串
ptParamInfo out 接收参数信息结构体的指针

返回:成功返回 CB_E_SUCCESS;失败返回错误码(见错误码章节)

CB_GetEnumParamEntryNum

CB_RESULT CB_GetEnumParamEntryNum(int32_t iDevIndex, const char* szParamName, int32_t* piEntryNum)

获取枚举类型参数的所有枚举成员个数。

参数 方向 说明
iDevIndex in 设备索引,取值范围[0,(CB_EnumerateDevices()-1)]
szParamName in 参数名称,必须是ParamType_Enumeration类型的参数
piEntryNum out 接收枚举成员数目的内存指针

返回:成功返回 CB_E_SUCCESS;失败返回错误码(见错误码章节)

CB_GetEnumParamEntryNameByIndex

CB_RESULT CB_GetEnumParamEntryNameByIndex(int32_t iDevIndex, const char* szParamName, int32_t iEntryIndex, char* szEntryNameBuf, int32_t* piBufSize)

获取与索引对应的枚举成员名。

参数 方向 说明
iDevIndex in 设备索引,取值范围[0,(CB_EnumerateDevices()-1)]
szParamName in 参数名称,必须是ParamType_Enumeration类型的参数
iEntryIndex in 枚举成员索引,取值范围[0,(CB_GetEnumParamEntryNum()-1)]
szEntryNameBuf out 用于接收字符串的内存指针

返回:成功返回 CB_E_SUCCESS;失败返回错误码(见错误码章节)

说明

  • szEntryNameBuf指向的内存必须足够大(包括字符串终止符'\0')以接收完整字符串。

CB_GetEnumParamEntryValueByIndex

CB_RESULT CB_GetEnumParamEntryValueByIndex(int32_t iDevIndex, const char* szParamName, int32_t iEntryIndex, int32_t* piEntryValue)

获取与索引对应的枚举常量值。

参数 方向 说明
iDevIndex in 设备索引,取值范围[0,(CB_EnumerateDevices()-1)]
szParamName in 参数名称,必须是ParamType_Enumeration类型的参数
iEntryIndex in 枚举成员索引,取值范围[0,(CB_GetEnumParamEntryNum()-1)]
piEntryValue out 用于接收枚举常量值的内存指针

返回:成功返回 CB_E_SUCCESS;失败返回错误码(见错误码章节)

CB_GetEnumParamEntryValueByName

CB_RESULT CB_GetEnumParamEntryValueByName(int32_t iDevIndex, const char* szParamName, const char* szEntryName, int32_t* piEntryValue)

通过枚举成员名,获取与之对应的枚举常量值。

参数 方向 说明
iDevIndex in 设备索引,取值范围[0,(CB_EnumerateDevices()-1)]
szParamName in 参数名称,必须是ParamType_Enumeration类型的参数
szEntryName in 枚举成员名
piEntryValue out 用于接收枚举常量值的内存指针

返回:成功返回 CB_E_SUCCESS;失败返回错误码(见错误码章节)

CB_GetEnumParamEntryNameByValue

CB_RESULT CB_GetEnumParamEntryNameByValue(int32_t iDevIndex, const char* szParamName, int32_t iEntryValue, char* szEntryNameBuf, int32_t* piBufSize)

通过枚举常量值,获取与之对应的枚举成员名。

参数 方向 说明
iDevIndex in 设备索引,取值范围[0,(CB_EnumerateDevices()-1)]
szParamName in 参数名称,必须是ParamType_Enumeration类型的参数
iEntryValue in 枚举常量值
szEntryNameBuf out 用于接收枚举成员名称字符串的内存指针

返回:成功返回 CB_E_SUCCESS;失败返回错误码(见错误码章节)

说明

  • szEntryNameBuf指向的内存必须足够大(包括字符串终止符'\0')以接收完整字符串。