get_attribute
Declaration
int get_attribute(int fd, unsigned int buffSize, unsigned char *buff)
Parameter Description
Parameter |
Type |
Description |
|---|---|---|
fd |
int |
Device file descriptor |
buffSize |
unsigned int |
Size of the array cache space |
buff |
unsigned char* |
Cache used to transfer data |
Function Description
Obtains attributes. The device is determined based on the input fd value, and the attribute ID and value are obtained by parsing the TLV-encoded buffer.
An attribute of the JSON type has multiple subattributes. The value of the JSON attribute is the size of all subattributes in TLV format. The TLV parsing needs to be performed again on the Value attribute. The TLV parsing of the JSON subattributes is performed cyclically using the offset mode until the parsing of the Value attribute is complete. The following figure shows the parsing mode.