## **Overview**
**Related Modules:**
[DriverConfig](driverconfig.md)
**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
GetRootNode )(void) | const struct DeviceResourceNode *(* Obtains the root node of the configuration tree. |
GetBool )(const struct DeviceResourceNode *node, const char *attrName) | 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) | 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) | 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) | 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) | 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) | 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) | 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) | 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) | 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) | 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) | 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) | 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) | 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) | 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) | Obtains the value of a String array attribute numbered index of a configuration tree node. |
GetElemNum )(const struct DeviceResourceNode *node, const char *attrName) | 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
```
bool(* DeviceResourceIface::GetBool) (const struct [DeviceResourceNode](deviceresourcenode.md) *node, const char *attrName)
```
**Description:**
Obtains the value of a **BOOL** attribute of a configuration tree node.
**Parameters:**
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
```
const struct [DeviceResourceNode](deviceresourcenode.md)*(* DeviceResourceIface::GetChildNode) (const struct [DeviceResourceNode](deviceresourcenode.md) *node, const char *nodeName)
```
**Description:**
Obtains the child node with a specified node name from a parent node.
**Parameters:**
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
```
int32_t(* DeviceResourceIface::GetElemNum) (const struct [DeviceResourceNode](deviceresourcenode.md) *node, const char *attrName)
```
**Description:**
Obtains the number of values for an array attribute of a configuration tree node.
**Parameters:**
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
```
const struct [DeviceResourceNode](deviceresourcenode.md)*(* DeviceResourceIface::GetNodeByMatchAttr) (const struct [DeviceResourceNode](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:**
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
```
const struct [DeviceResourceNode](deviceresourcenode.md)*(* DeviceResourceIface::GetNodeByRefAttr) (const struct [DeviceResourceNode](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:**
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
```
const struct [DeviceResourceNode](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
```
int32_t(* DeviceResourceIface::GetString) (const struct [DeviceResourceNode](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:**
**Returns:**
Returns **0** if the operation is successful; returns a negative value otherwise.
## GetStringArrayElem
```
int32_t(* DeviceResourceIface::GetStringArrayElem) (const struct [DeviceResourceNode](deviceresourcenode.md) *node, const char *attrName, uint32_t [index](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:**
**Returns:**
Returns **0** if the operation is successful; returns a negative value otherwise.
## GetUint16
```
int32_t(* DeviceResourceIface::GetUint16) (const struct [DeviceResourceNode](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:**
**Returns:**
Returns **0** if the operation is successful; returns a negative value otherwise.
## GetUint16Array
```
int32_t(* DeviceResourceIface::GetUint16Array) (const struct [DeviceResourceNode](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:**
**Returns:**
Returns **0** if the operation is successful; returns a negative value otherwise.
## GetUint16ArrayElem
```
int32_t(* DeviceResourceIface::GetUint16ArrayElem) (const struct [DeviceResourceNode](deviceresourcenode.md) *node, const char *attrName, uint32_t [index](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:**
**Returns:**
Returns **0** if the operation is successful; returns a negative value otherwise.
## GetUint32
```
int32_t(* DeviceResourceIface::GetUint32) (const struct [DeviceResourceNode](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:**
**Returns:**
Returns **0** if the operation is successful; returns a negative value otherwise.
## GetUint32Array
```
int32_t(* DeviceResourceIface::GetUint32Array) (const struct [DeviceResourceNode](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:**
**Returns:**
Returns **0** if the operation is successful; returns a negative value otherwise.
## GetUint32ArrayElem
```
int32_t(* DeviceResourceIface::GetUint32ArrayElem) (const struct [DeviceResourceNode](deviceresourcenode.md) *node, const char *attrName, uint32_t [index](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:**
**Returns:**
Returns **0** if the operation is successful; returns a negative value otherwise.
## GetUint64
```
int32_t(* DeviceResourceIface::GetUint64) (const struct [DeviceResourceNode](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:**
**Returns:**
Returns **0** if the operation is successful; returns a negative value otherwise.
## GetUint64Array
```
int32_t(* DeviceResourceIface::GetUint64Array) (const struct [DeviceResourceNode](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:**
**Returns:**
Returns **0** if the operation is successful; returns a negative value otherwise.
## GetUint64ArrayElem
```
int32_t(* DeviceResourceIface::GetUint64ArrayElem) (const struct [DeviceResourceNode](deviceresourcenode.md) *node, const char *attrName, uint32_t [index](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:**
**Returns:**
Returns **0** if the operation is successful; returns a negative value otherwise.
## GetUint8
```
int32_t(* DeviceResourceIface::GetUint8) (const struct [DeviceResourceNode](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:**
**Returns:**
Returns **0** if the attribute value is obtained successfully; returns a negative value otherwise.
## GetUint8Array
```
int32_t(* DeviceResourceIface::GetUint8Array) (const struct [DeviceResourceNode](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:**
**Returns:**
Returns **0** if the operation is successful; returns a negative value otherwise.
## GetUint8ArrayElem
```
int32_t(* DeviceResourceIface::GetUint8ArrayElem) (const struct [DeviceResourceNode](deviceresourcenode.md) *node, const char *attrName, uint32_t [index](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:**
**Returns:**
Returns **0** if the array attribute value is obtained successfully; returns a negative value otherwise.