syspara Module

This module provides the functions of obtaining and setting system attributes.

It can be used on the Hi3861, Hi3516D V300 and Hi3518E V300 platforms powered by LiteOS Cortex-M and LiteOS Cortex-A. Supported system attributes consist of default, OEM-specified, and custom system attributes. OEM-specified system attributes provide only default values. The specific values need to be adjusted as required.

Available APIs

Table 1 APIs for the syspara module

API

Description

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

Obtains a system parameter.

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

Sets or updates a system parameter.

char* GetProductType(void)

Obtains the device type.

char* GetManufacture(void)

Obtains the device manufacturer.

char* GetBrand(void)

Obtains the device brand.

char* GetMarketName(void)

Obtains the device marketing name.

char* GetProductSeries(void)

Obtains the device series name.

char* GetProductModel(void)

Obtains the device authentication model.

char* GetSoftwareModel(void)

Obtains the device software model.

char* GetHardwareModel(void)

Obtains the device hardware model.

char* GetHardwareProfile(void)

Obtains the device hardware profile.

char* GetSerial(void)

Obtains the device serial number (SN).

char* GetOsName(void)

Obtains the operating system name.

char* GetDisplayVersion(void)

Obtains the software version visible to users.

char* GetBootloaderVersion(void)

Obtains the bootloader version of this device.

char* GetSecurityPatchTag(void)

Obtains the security patch tag.

char* GetAbiList(void)

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

char* GetSdkApiLevel(void)

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

char* GetFirstApiLevel(void)

Obtains the first SDK API level of the system software.

char* GetIncrementalVersion(void)

Obtains the incremental version.

char* GetVersionId(void)

Obtains the version ID.

char* GetBuildType(void)

Obtains the build type.

char* GetBuildUser(void)

Obtains the build account user name.

char* GetBuildHost(void)

Obtains the build host name.

char* GetBuildTime(void)

Obtains the build time.

char* GetBuildRootHash(void)

Obtains the buildroot hash value of this version.

How to Use

The following is an example of using syspara.

// set && get
char key1[] = "rw.sys.version";
char value1[] = "10.1.0";
int ret = SetParameter(key1, value1);
char valueGet1[128] = {0};
ret = GetParameter(key1, "version=10.1.0", valueGet1, 128);

// get sysparm
char* value1 = GetProductType();
printf("Product type =%s\n", value1);
free(value1);
char* value2 = GetManufacture();
printf("Manufacture =%s\n", value2);
free(value2);
char* value3 = GetBrand();
printf("GetBrand =%s\n", value3);
free(value3);
char* value4 = GetMarketName();
printf("MarketName =%s\n", value4);
free(value4);
char* value5 = GetProductSeries();
printf("ProductSeries =%s\n", value5);
free(value5);
char* value6 = GetProductModel();
printf("ProductModel =%s\n", value6);
free(value6);
char* value7 = GetSoftwareModel();
printf("SoftwareModel =%s\n", value7);
free(value7);
char* value8 = GetHardwareModel();
printf("HardwareModel =%s\n", value8);
free(value8);
char* value9 = GetHardwareProfile();
printf("Software profile =%s\n", value9);
free(value9);
char* value10 = GetSerial();
printf("Serial =%s\n", value10);
free(value10);
char* value11 = GetOsName();
printf("OS name =%s\n", value11);
free(value11);
char* value12 = GetDisplayVersion();
printf("Display version =%s\n", value12);
free(value12);
char* value13 = GetBootloaderVersion();
printf("bootloader version =%s\n", value13);
free(value13);
char* value14 = GetSecurityPatchTag();
printf("secure patch level =%s\n", value14);
free(value14);
char* value15 = GetAbiList();
printf("abi list =%s\n", value15);
free(value15);
char* value16 = GetFirstApiLevel();
printf("first api level =%s\n", value16);
free(value16);
char* value17 = GetIncrementalVersion();
printf("Incremental version = %s\n", value17);
free(value17);
char* value187 = GetVersionId();
printf("formal id =%s\n", value187);
free(value187);
char* value18 = GetBuildType();
printf("build type =%s\n", value18);
free(value18);
char* value19 = GetBuildUser();
printf("build user =%s\n", value19);
free(value19);
char* value20 = GetBuildHost();
printf("Build host = %s\n", value20);
free(value20);
char* value21 = GetBuildTime();
printf("build time =%s\n", value21);
free(value21);
char* value22 = GetBuildRootHash();
printf("build root later..., %s\n", value22);
free(value22);