# Parameter ## **Overview** Provides functions for obtaining system parameters. This module can obtain device information such as device type and manufacturer. **Since:** 1.0 **Version:** 1.0 ## **Summary** ## Files

File Name

Description

parameter.h

Declares functions for obtaining system parameters.

## Functions

Function Name

Description

GetParameter (const char *key, const char *def, char *value, unsigned int len)

int 

Obtains a system parameter matching the specified key.

SetParameter (const char *key, const char *value)

int 

Sets or updates a system parameter.

GetProductType (void)

char * 

Obtains the device type.

GetManufacture (void)

char * 

Obtains the device manufacturer.

GetBrand (void)

char * 

Obtains the device brand.

GetMarketName (void)

char * 

Obtains the device marketing name.

GetProductSeries (void)

char * 

Obtains the device series name.

GetProductModel (void)

char * 

Obtains the device authentication model.

GetSoftwareModel (void)

char * 

Obtains the device software model.

GetHardwareModel (void)

char * 

Obtains the device hardware model.

GetHardwareProfile (void)

char * 

Obtains the device hardware profile.

GetSerial (void)

char * 

Obtains the device serial number (SN).

GetOsName (void)

char * 

Obtains the operating system (OS) name.

GetDisplayVersion (void)

char * 

Obtains the software version visible to users.

GetBootloaderVersion (void)

char * 

Obtains the bootloader version of this device.

GetSecurityPatchTag (void)

char * 

Obtains the security patch tag.

GetAbiList (void)

char * 

Obtains the list of application binary interfaces (ABIs) supported on this device.

GetSdkApiLevel (void)

char * 

Obtains the SDK API level that matches the current system software.

GetFirstApiLevel (void)

char * 

Obtains the first SDK API level of the system software.

GetIncrementalVersion (void)

char * 

Obtains the incremental version.

GetVersionId (void)

char * 

Obtains the version ID.

GetBuildType (void)

char * 

Obtains the build type.

GetBuildUser (void)

char * 

Obtains the build account user name.

GetBuildHost (void)

char * 

Obtains the build host name.

GetBuildTime (void)

char * 

Obtains the version build time.

GetBuildRootHash (void)

char * 

Obtains the buildroot hash value of this version.

## **Details** ## **Function Documentation** ## GetAbiList\(\) ``` char* GetAbiList (void ) ``` **Description:** Obtains the list of application binary interfaces \(ABIs\) supported on this device. The interfaces in the ABI list are separated by commas \(,\). This function is available only for an OS with an ecosystem accommodating native applications. **Returns:** Returns the ABI list if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetBootloaderVersion\(\) ``` char* GetBootloaderVersion (void ) ``` **Description:** Obtains the bootloader version of this device. The bootloader version can have a maximum length of 64 characters. **Returns:** Returns the bootloader version if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetBrand\(\) ``` char* GetBrand (void ) ``` **Description:** Obtains the device brand. The device brand can have a maximum length of 32 characters. **Returns:** Returns the device brand if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetBuildHost\(\) ``` char* GetBuildHost (void ) ``` **Description:** Obtains the build host name. The build host name can have a maximum length of 32 characters. **Returns:** Returns the build host name if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetBuildRootHash\(\) ``` char* GetBuildRootHash (void ) ``` **Description:** Obtains the buildroot hash value of this version. The buildroot hash value is represented by the root hash value in the software version hash tree. **Returns:** Returns the buildroot hash value if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetBuildTime\(\) ``` char* GetBuildTime (void ) ``` **Description:** Obtains the version build time. The version build time is represented by the number of milliseconds elapsed since 1970-01-01 00:00:00 GMT. **Returns:** Returns the version build time if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetBuildType\(\) ``` char* GetBuildType (void ) ``` **Description:** Obtains the build type. Different build types with the same baseline codes will be returned, for example, **debug/release** and **log/nolog**. Multiple build types can be separated by semicolons \(;\). **Returns:** Returns the build type if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetBuildUser\(\) ``` char* GetBuildUser (void ) ``` **Description:** Obtains the build account user name. The build account user name can have a maximum length of 32 characters. **Returns:** Returns the build account user name if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetDisplayVersion\(\) ``` char* GetDisplayVersion (void ) ``` **Description:** Obtains the software version visible to users. The software version visible to users can have a maximum length of 64 characters. **Returns:** Returns the software version visible to users if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetFirstApiLevel\(\) ``` char* GetFirstApiLevel (void ) ``` **Description:** Obtains the first SDK API level of the system software. In general, the first SDK API level is an integer. This function is only available for an OS with an ecosystem. **Returns:** Returns the first SDK API level if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetHardwareModel\(\) ``` char* GetHardwareModel (void ) ``` **Description:** Obtains the device hardware model. The device hardware model can have a maximum length of 32 characters. **Returns:** Returns the device hardware model if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetHardwareProfile\(\) ``` char* GetHardwareProfile (void ) ``` **Description:** Obtains the device hardware profile. The device hardware profile is a string in JSON format and has a maximum length of 1000 characters. **Returns:** Returns the device hardware profile if a result is found; returns **NULL** otherwise. The return result is released by the caller. The JSON field in the device hardware profile is defined as follows:

Description

key

Audio playback

aout

Display

display

Camera

camera

2D acceleration capability

DMA_2D

Random-access memory

RAM

Read-only memory

ROM

Graphics processing unit

GPU

Neural-network processing unit

NPU

Radio

radio

Bluetooth

bluetooth

Wi-Fi

WIFI

USB

usbhost

## GetIncrementalVersion\(\) ``` char* GetIncrementalVersion (void ) ``` **Description:** Obtains the incremental version. The incremental version can be used as the unique software version when the device model is the same. **Returns:** Returns the incremental version if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetManufacture\(\) ``` char* GetManufacture (void ) ``` **Description:** Obtains the device manufacturer. The device manufacturer can have a maximum length of 32 characters. **Returns:** Returns the device manufacturer if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetMarketName\(\) ``` char* GetMarketName (void ) ``` **Description:** Obtains the device marketing name. The device marketing name can have a maximum length of 32 characters. **Returns:** Returns the device marketing name if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetOsName\(\) ``` char* GetOsName (void ) ``` **Description:** Obtains the operating system \(OS\) name. The device OS name can have a maximum length of 32 characters. **Returns:** Returns the device OS name if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetParameter\(\) ``` int GetParameter (const char * key, const char * def, char * value, unsigned int len ) ``` **Description:** Obtains a system parameter matching the specified **key**. If no system parameter is found, the **def** parameter will be returned. **Parameters:**

Name

Description

key Indicates the key for the system parameter to query. The value can contain lowercase letters, digits, underscores (_), and dots (.). Its length cannot exceed 32 bytes (including the end-of-text character in the string).
def Indicates the default value to return when no query result is found. This parameter is specified by the caller.
value Indicates the data buffer that stores the query result. This parameter is applied for and released by the caller and can be used as an output parameter.
len Indicates the length of the data in the buffer.
**Returns:** Returns the number of bytes of the system parameter if the operation is successful; returns **-9** if a parameter is incorrect; returns **-1** in other scenarios. ## GetProductModel\(\) ``` char* GetProductModel (void ) ``` **Description:** Obtains the device authentication model. The device authentication model can have a maximum length of 32 characters. **Returns:** Returns the device authentication model if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetProductSeries\(\) ``` char* GetProductSeries (void ) ``` **Description:** Obtains the device series name. The device series name can have a maximum length of 32 characters. **Returns:** Returns the device series name if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetProductType\(\) ``` char* GetProductType (void ) ``` **Description:** Obtains the device type. The device type can have a maximum length of 32 characters. **Returns:** Returns the device type if a result is found, for example, returns **wifiiot** if the application is running on a Wi-Fi connected IoT device; returns **NULL** otherwise. The return result is released by the caller. ## GetSdkApiLevel\(\) ``` char* GetSdkApiLevel (void ) ``` **Description:** Obtains the SDK API level that matches the current system software. In general, the SDK API level is an integer. This function is only available for an OS with an ecosystem. **Returns:** Returns the SDK API level if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetSecurityPatchTag\(\) ``` char* GetSecurityPatchTag (void ) ``` **Description:** Obtains the security patch tag. **Returns:** Returns the security patch tag if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetSerial\(\) ``` char* GetSerial (void ) ``` **Description:** Obtains the device serial number \(SN\). The device SN can have a maximum length of 64 characters. **Returns:** Returns the device SN if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetSoftwareModel\(\) ``` char* GetSoftwareModel (void ) ``` **Description:** Obtains the device software model. The device software model can have a maximum length of 32 characters. **Returns:** Returns the device software model if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## GetVersionId\(\) ``` char* GetVersionId (void ) ``` **Description:** Obtains the version ID. The version ID can have a maximum length of 127 characters. It is the unique identifier of a device. **Returns:** Returns the version ID if a result is found; returns **NULL** otherwise. The return result is released by the caller. ## SetParameter\(\) ``` int SetParameter (const char * key, const char * value ) ``` **Description:** Sets or updates a system parameter. You can use this function to set a system parameter that matches **key** as **value**. **Parameters:**

Name

Description

key Indicates the key for the parameter to set or update. The value can contain lowercase letters, digits, underscores (_), and dots (.). Its length cannot exceed 32 bytes (including the end-of-text character in the string).
value Indicates the system parameter value. Its length cannot exceed 128 bytes (including the end-of-text character in the string).
**Returns:** Returns **0** if the operation is successful; returns **-9** if a parameter is incorrect; returns **-1** in other scenarios.