DeviceResourceIface

Overview

Related Modules:

DriverConfig

Description:

Provides functions for obtaining information about the device resource configuration tree.

This structure provides functions for obtaining information about the device resource configuration tree, including the root node, the unit attribute data, and the String attribute data.

Since:

1.0

Version:

1.0

Summary

Data Fields

Variable Name

Description

GetRootNode )(void)

const struct DeviceResourceNode ( 

Obtains the root node of the configuration tree.

GetBool )(const struct DeviceResourceNode node, const char attrName)

bool( 

Obtains the value of a BOOL attribute of a configuration tree node.

GetUint8 )(const struct DeviceResourceNode node, const char attrName, uint8_t value, uint8_t def)

int32_t( 

Obtains the value of a Uint8 attribute of a configuration tree node.

GetUint8ArrayElem )(const struct DeviceResourceNode node, const char attrName, uint32_t index, uint8_t value, uint8_t def)

int32_t( 

Obtains the value of a Unit8 array attribute numbered index of a configuration tree node.

GetUint8Array )(const struct DeviceResourceNode node, const char attrName, uint8_t value, uint32_t len, uint8_t def)

int32_t( 

Obtains the values of a Uint8 array attribute of a configuration tree node.

GetUint16 )(const struct DeviceResourceNode node, const char attrName, uint16_t value, uint16_t def)

int32_t( 

Obtains the value of a Uint16 attribute of a configuration tree node.

GetUint16ArrayElem )(const struct DeviceResourceNode node, const char attrName, uint32_t index, uint16_t value, uint16_t def)

int32_t( 

Obtains the value of a Uint16 array attribute numbered index of a configuration tree node.

GetUint16Array )(const struct DeviceResourceNode node, const char attrName, uint16_t value, uint32_t len, uint16_t def)

int32_t( 

Obtains the values of a Uint16 array attribute of a configuration tree node.

GetUint32 )(const struct DeviceResourceNode node, const char attrName, uint32_t value, uint32_t def)

int32_t( 

Obtains the value of a Uint32 attribute of a configuration tree node.

GetUint32ArrayElem )(const struct DeviceResourceNode node, const char attrName, uint32_t index, uint32_t value, uint32_t def)

int32_t( 

Obtains the value of a Uint32 array attribute numbered index of a configuration tree node.

GetUint32Array )(const struct DeviceResourceNode node, const char attrName, uint32_t value, uint32_t len, uint32_t def)

int32_t( 

Obtains the values of a Uint32 array attribute of a configuration tree node.

GetUint64 )(const struct DeviceResourceNode node, const char attrName, uint64_t value, uint64_t def)

int32_t( 

Obtains the value of a Uint64 attribute of a configuration tree node.

GetUint64ArrayElem )(const struct DeviceResourceNode node, const char attrName, uint32_t index, uint64_t value, uint64_t def)

int32_t( 

Obtains the value of a Uint64 array attribute numbered index of a configuration tree node.

GetUint64Array )(const struct DeviceResourceNode node, const char attrName, uint64_t value, uint32_t len, uint64_t def)

int32_t( 

Obtains the values of a Uint64 array attribute of a configuration tree node.

GetString )(const struct DeviceResourceNode node, const char attrName, const char **value, const char def)

int32_t( 

Obtains the value of a String attribute of a configuration tree node.

GetStringArrayElem )(const struct DeviceResourceNode node, const char attrName, uint32_t index, const char **value, const char def)

int32_t( 

Obtains the value of a String array attribute numbered index of a configuration tree node.

GetElemNum )(const struct DeviceResourceNode node, const char attrName)

int32_t( 

Obtains the number of values for an array attribute of a configuration tree node.

GetNodeByMatchAttr )(const struct DeviceResourceNode node, const char attrValue)

const struct DeviceResourceNode ( 

Obtains a specified child node of the current tree node based on the value of a specific reserved attribute (for example, the reserved attribute of the HCS is match_attr).

GetChildNode )(const struct DeviceResourceNode node, const char nodeName)

const struct DeviceResourceNode ( 

Obtains the child node with a specified node name from a parent node.

GetNodeByRefAttr )(const struct DeviceResourceNode node, const char attrName)

const struct DeviceResourceNode ( 

Obtains the node that is specified by a node-type attribute of a configuration tree node.

Details

Field Documentation

GetBool

  1. bool(* DeviceResourceIface::GetBool) (const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md) *node, const char *attrName)

Description:

Obtains the value of a BOOL attribute of a configuration tree node.

Parameters:

Name

Description

node Indicates the pointer to the configuration tree node.
attrName Indicates the pointer to the name of the attribute.

Returns:

Returns the value of the BOOL attribute if the operation is successful; returns false if node and attrName are null pointers.

GetChildNode

  1. const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md)*(* DeviceResourceIface::GetChildNode) (const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md) *node, const char *nodeName)

Description:

Obtains the child node with a specified node name from a parent node.

Parameters:

Name

Description

node Indicates the pointer to the parent node.
nodeName Indicates the pointer to the name of the child node to obtain.

Returns:

Returns the child nodes if the operation is successful; returns NULL otherwise.

GetElemNum

  1. int32_t(* DeviceResourceIface::GetElemNum) (const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md) *node, const char *attrName)

Description:

Obtains the number of values for an array attribute of a configuration tree node.

Parameters:

Name

Description

node Indicates the pointer to the configuration tree node.
attrName Indicates the pointer to the name of the array attribute.

Returns:

Returns the number of values for an array attribute if the operation is successful; return a negative value otherwise.

GetNodeByMatchAttr

  1. const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md)*(* DeviceResourceIface::GetNodeByMatchAttr) (const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md) *node, const char *attrValue)

Description:

Obtains a specified child node of the current tree node based on the value of a specific reserved attribute (for example, the reserved attribute of the HCS is match_attr).

There is a specific reserved attribute in the syntax of the device resource configuration source file. If this attribute is set for a tree node, you can obtain the node based on the attribute value. Users can set the attribute value based on the usage of their own nodes, but they must ensure that the attribute values are unique.

Parameters:

Name

Description

node Indicates the pointer to the node for whom a child node is to be obtained. The node can be the child node’s parent node or grandparent node.
attrValue Indicates the pointer to the value of the reserved attribute configured for the child node.

Returns:

Returns the target node if the operation is successful; returns NULL otherwise.

GetNodeByRefAttr

  1. const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md)*(* DeviceResourceIface::GetNodeByRefAttr) (const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md) *node, const char *attrName)

Description:

Obtains the node that is specified by a node-type attribute of a configuration tree node.

If the attribute value is a configuration tree node, the path of the node is converted to a globally unique hashValue when the device resource source file is compiled (for example, the compilation tool of the HCS source file is hc-gen). For details about the hashValue, see DeviceResourceNode. When you obtain a tree node using the node-type attribute, you obtain the hashValue through the node-type attribute first, and then traverse the tree to obtain the tree node corresponding to the hashValue.

Parameters:

Name

Description

node Indicates the pointer to the tree node whose attribute is to obtain.
attrName Indicates the pointer to the name of attribute whose value is a node path.

Returns:

Returns the target node if the operation is successful; returns NULL otherwise.

GetRootNode

  1. const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md)*(* DeviceResourceIface::GetRootNode) (void)

Description:

Obtains the root node of the configuration tree.

When the driver framework is started, a configuration tree is created. You can use this function to obtain the root node of the configuration tree.

Returns:

Returns the root node of the configuration tree if the operation is successful; returns NULL otherwise.

GetString

  1. int32_t(* DeviceResourceIface::GetString) (const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md) *node, const char *attrName, const char **value, const char *def)

Description:

Obtains the value of a String attribute of a configuration tree node.

Parameters:

Name

Description

node Indicates the pointer to the configuration tree node.
attrName Indicates the pointer to the name of the attribute.
value Indicates the double pointer to the memory where the obtained data is stored. The string memory is provided by the function implementer. Users only need to transfer the double pointer. The memory cannot be released after being used.
def Indicates the value to be passed to value if the operation fails.

Returns:

Returns 0 if the operation is successful; returns a negative value otherwise.

GetStringArrayElem

  1. int32_t(* DeviceResourceIface::GetStringArrayElem) (const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md) *node, const char *attrName, uint32_t [index]($api-api-SmartVision-Devices-UTILS.md#ga1d3748ca570dcb09a2fb28e8015107dd), const char **value, const char *def)

Description:

Obtains the value of a String array attribute numbered index of a configuration tree node.

Parameters:

Name

Description

node Indicates the pointer to the configuration tree node.
attrName Indicates the pointer to the name of the array attribute.
index Indicates the number of the index (counting from 0) where the value is to obtain.
value Indicates the double pointer to the memory where the obtained data is stored. The string memory is provided by the function implementer. Users only need to transfer the double pointer. The memory cannot be released after being used.
def def Indicates the value to be passed to value if the operation fails.

Returns:

Returns 0 if the operation is successful; returns a negative value otherwise.

GetUint16

  1. int32_t(* DeviceResourceIface::GetUint16) (const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md) *node, const char *attrName, uint16_t *value, uint16_t def)

Description:

Obtains the value of a Uint16 attribute of a configuration tree node.

Parameters:

Name

Description

node Indicates the pointer to the configuration tree node.
attrName Indicates the pointer to the name of the attribute.
value Indicates the pointer to the memory that stores the obtained data. The memory is applied by the user.
def Indicates the value to fill into the memory pointed by value if the operation fails.

Returns:

Returns 0 if the operation is successful; returns a negative value otherwise.

GetUint16Array

  1. int32_t(* DeviceResourceIface::GetUint16Array) (const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md) *node, const char *attrName, uint16_t *value, uint32_t len, uint16_t def)

Description:

Obtains the values of a Uint16 array attribute of a configuration tree node.

Parameters:

Name

Description

node Indicates the pointer to the configuration tree node.
attrName Indicates the pointer to the name of the array attribute.
value Indicates the pointer to the array that stores the obtained data. The memory of the array is applied by the user.
len Indicates the length of the array.
def Indicates the value to fill into value if the operation fails. If the obtained attribute value contains 32-bit or 64-bit data, the element corresponding to the 32-bit or 64-bit data in the array is filled using the value of def, and the other elements are filled with the actual value obtained. If the failure is caused by other exceptions, the first element in the array is filled using the value of def.

Returns:

Returns 0 if the operation is successful; returns a negative value otherwise.

GetUint16ArrayElem

  1. int32_t(* DeviceResourceIface::GetUint16ArrayElem) (const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md) *node, const char *attrName, uint32_t [index]($api-api-SmartVision-Devices-UTILS.md#ga1d3748ca570dcb09a2fb28e8015107dd), uint16_t *value, uint16_t def)

Description:

Obtains the value of a Uint16 array attribute numbered index of a configuration tree node.

Parameters:

Name

Description

node Indicates the pointer to the configuration tree node.
attrName Indicates the pointer to the name of the array attribute.
index Indicates the number of the index (counting from 0) where the value is to obtain.
value Indicates the pointer to the memory that stores the obtained data. The memory is applied by the user.
def Indicates the value to fill into the memory pointed by value if the operation fails.

Returns:

Returns 0 if the operation is successful; returns a negative value otherwise.

GetUint32

  1. int32_t(* DeviceResourceIface::GetUint32) (const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md) *node, const char *attrName, uint32_t *value, uint32_t def)

Description:

Obtains the value of a Uint32 attribute of a configuration tree node.

Parameters:

Name

Description

node Indicates the pointer to the configuration tree node.
attrName Indicates the pointer to the name of the attribute.
value Indicates the pointer to the memory that stores the obtained data. The memory is applied by the user.
def Indicates the value to fill into the memory pointed by value if the operation fails.

Returns:

Returns 0 if the operation is successful; returns a negative value otherwise.

GetUint32Array

  1. int32_t(* DeviceResourceIface::GetUint32Array) (const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md) *node, const char *attrName, uint32_t *value, uint32_t len, uint32_t def)

Description:

Obtains the values of a Uint32 array attribute of a configuration tree node.

Parameters:

Name

Description

node Indicates the pointer to the configuration tree node.
attrName Indicates the pointer to the name of the array attribute.
value Indicates the pointer to an array that stores the obtained data.
len Indicates the pointer to the array that stores the obtained data. The memory of the array is applied by the user.
def Indicates the value to fill into value if the operation fails. If the obtained attribute value contains 64-bit data, the element corresponding to the 64-bit data in the array is filled using the value of def, and the other elements are filled with the actual value obtained. If the failure is caused by other exceptions, the first element in the array is filled using the value of def.

Returns:

Returns 0 if the operation is successful; returns a negative value otherwise.

GetUint32ArrayElem

  1. int32_t(* DeviceResourceIface::GetUint32ArrayElem) (const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md) *node, const char *attrName, uint32_t [index]($api-api-SmartVision-Devices-UTILS.md#ga1d3748ca570dcb09a2fb28e8015107dd), uint32_t *value, uint32_t def)

Description:

Obtains the value of a Uint32 array attribute numbered index of a configuration tree node.

Parameters:

Name

Description

node Indicates the pointer to the configuration tree node.
attrName Indicates the pointer to the name of the array attribute.
index Indicates the number of the index (counting from 0) where the value is to obtain.
value Indicates the pointer to the memory that stores the obtained data. The memory is applied by the user.
def Indicates the value to fill into the memory pointed by value if the operation fails.

Returns:

Returns 0 if the operation is successful; returns a negative value otherwise.

GetUint64

  1. int32_t(* DeviceResourceIface::GetUint64) (const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md) *node, const char *attrName, uint64_t *value, uint64_t def)

Description:

Obtains the value of a Uint64 attribute of a configuration tree node.

Parameters:

Name

Description

node Indicates the pointer to the configuration tree node.
attrName Indicates the pointer to the name of the attribute.
value Indicates the pointer to the memory that stores the obtained data. The memory is applied by the user.
def Indicates the value to fill into the memory pointed by value if the operation fails.

Returns:

Returns 0 if the operation is successful; returns a negative value otherwise.

GetUint64Array

  1. int32_t(* DeviceResourceIface::GetUint64Array) (const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md) *node, const char *attrName, uint64_t *value, uint32_t len, uint64_t def)

Description:

Obtains the values of a Uint64 array attribute of a configuration tree node.

Parameters:

Name

Description

node Indicates the pointer to the configuration tree node.
attrName Indicates the pointer to the name of the array attribute.
value Indicates the pointer to the array that stores the obtained data. The memory of the array is applied by the user.
len Indicates the length of the array.
def Indicates the value to fill into the first element in the value array if the operation fails.

Returns:

Returns 0 if the operation is successful; returns a negative value otherwise.

GetUint64ArrayElem

  1. int32_t(* DeviceResourceIface::GetUint64ArrayElem) (const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md) *node, const char *attrName, uint32_t [index]($api-api-SmartVision-Devices-UTILS.md#ga1d3748ca570dcb09a2fb28e8015107dd), uint64_t *value, uint64_t def)

Description:

Obtains the value of a Uint64 array attribute numbered index of a configuration tree node.

Parameters:

Name

Description

node Indicates the pointer to the configuration tree node.
attrName Indicates the pointer to the name of the array attribute.
index Indicates the number of the index (counting from 0) where the value is to obtain.
value Indicates the pointer to the memory that stores the obtained data. The memory is applied by the user.
def Indicates the value to fill into the memory pointed by value if the operation fails.

Returns:

Returns 0 if the operation is successful; returns a negative value otherwise.

GetUint8

  1. int32_t(* DeviceResourceIface::GetUint8) (const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md) *node, const char *attrName, uint8_t *value, uint8_t def)

Description:

Obtains the value of a Uint8 attribute of a configuration tree node.

Parameters:

Name

Description

node Indicates the pointer to the configuration tree node.
attrName Indicates the pointer to the name of the attribute.
value Indicates the pointer to the memory that stores the obtained data. The memory is applied by the user.
def Indicates the value to fill into the memory pointed by value if the operation fails.

Returns:

Returns 0 if the attribute value is obtained successfully; returns a negative value otherwise.

GetUint8Array

  1. int32_t(* DeviceResourceIface::GetUint8Array) (const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md) *node, const char *attrName, uint8_t *value, uint32_t len, uint8_t def)

Description:

Obtains the values of a Uint8 array attribute of a configuration tree node.

Parameters:

Name

Description

node Indicates the pointer to the configuration tree node.
attrName Indicates the pointer to the name of the array attribute.
value Indicates the pointer to the array that stores the obtained data. The memory of the array is applied by the user.
len Indicates the length of the array.
def Indicates the value to fill into value if the operation fails. If the obtained attribute value contains 16-bit, 32-bit, or 64-bit data, the element corresponding to the 16-bit, 32-bit, or 64-bit data in the array is filled using the value of def, and the other elements are filled with the actual value obtained. If the failure is caused by other exceptions, the first element in the array is filled using the value of def.

Returns:

Returns 0 if the operation is successful; returns a negative value otherwise.

GetUint8ArrayElem

  1. int32_t(* DeviceResourceIface::GetUint8ArrayElem) (const struct [DeviceResourceNode]($api-api-SmartVision-Devices-DeviceResourceNode.md) *node, const char *attrName, uint32_t [index]($api-api-SmartVision-Devices-UTILS.md#ga1d3748ca570dcb09a2fb28e8015107dd), uint8_t *value, uint8_t def)

Description:

Obtains the value of a Unit8 array attribute numbered index of a configuration tree node.

Parameters:

Name

Description

node Indicates the pointer to the configuration tree node.
attrName Indicates the pointer to the name of the array attribute.
index Indicates the number of the index (counting from 0) where the value is to obtain.
value Indicates the pointer to the memory that stores the obtained data. The memory is applied by the user.
def Indicates the value to fill into the memory pointed by value if the operation fails.

Returns:

Returns 0 if the array attribute value is obtained successfully; returns a negative value otherwise.