1 Star 0 Fork 5.3K

ycllz / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
syspara系统属性组件.md 14.25 KB
一键复制 编辑 原始数据 按行查看 历史
mamingshuai 提交于 2021-06-02 01:00 . update OpenHarmony 2.0 Canary

syspara系统属性组件

负责提供获取与设置操作系统相关的系统属性。

LiteOS-M内核和LiteOS-A内核的平台,包括:Hi3861平台,Hi3516DV300平台,Hi3518EV300平台。支持的系统属性包括:默认系统属性、OEM厂商系统属性和自定义系统属性。OEM厂商部分仅提供默认值,具体值需OEM产品方按需进行调整。

syspara系统接口说明

表 1 系统属性接口说明

接口名

描述

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

获取系统参数。

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

设置/更新系统参数。

char* GetProductType(void)

返回当前设备类型。

char* GetManufacture(void)

返回当前设备生产厂家信息。

char* GetBrand(void)

返回当前设备品牌信息。

char* GetMarketName(void)

返回当前设备传播名。

char* GetProductSeries(void)

返回当前设备产品系列名。

char* GetProductModel(void)

返回当前设备认证型号。

char* GetSoftwareModel(void)

返回当前设备内部软件子型号。

char* GetHardwareModel(void)

返回当前设备硬件版本号。

char* GetHardwareProfile(void)

返回当前设备硬件profile。

char* GetSerial(void)

返回当前设备序列号(SN号)。

char* GetOsName(void)

返回操作系统名。

char* GetDisplayVersion(void)

返回当前设备用户可见的软件版本号。

char* GetBootloaderVersion(void)

返回当前设备Bootloader版本号。

char* GetSecurityPatchTag(void)

返回安全补丁标签。

char* GetAbiList(void)

返回当前设备支持的指令集(Abi)列表。

char* GetSdkApiLevel(void)

返回与当前系统软件匹配的SDK API level。

char* GetFirstApiLevel(void)

返回系统软件首版本SDK API level。

char* GetIncrementalVersion(void)

返回差异版本号。

char* GetVersionId(void)

返回版本id。

char* GetBuildType(void)

返回构建类型。

char* GetBuildUser(void)

返回构建账户用户名。

char* GetBuildHost(void)

返回构建主机名。

char* GetBuildTime(void)

返回构建时间。

char* GetBuildRootHash(void)

返回当前版本hash。

开发实例

系统属性使用实例

// 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);
1
https://gitee.com/ycllz/docs.git
git@gitee.com:ycllz/docs.git
ycllz
docs
docs
master

搜索帮助