如何按需配置部件的系统能力
SysCap(SystemCapability,系统能力)是部件向开发者提供的接口的集合。
开发前请熟悉鸿蒙开发指导文档:[gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md
]
部件配置系统能力
部件配置系统能力是为了方便某个特定部件是否要打开或关闭特定的系统能力。
部件配置系统能力的位置在部件目录下的bundle.json,配置示例如下所示:
"component": {
"name": "wifi",
"subsystem": "communication",
"syscap": [
"SystemCapability.Communication.WiFi.STA = true",
"SystemCapability.Communication.WiFi.AP = true",
"SystemCapability.Communication.WiFi.P2P = false",
"SystemCapability.Communication.WiFi.Core = false",
"SystemCapability.Communication.WiFi.HotspotExt"
]
],
...
}
在component下加入关键字syscap,对内部配置相应的系统能力。系统能力若无赋值,则默认为true,若有赋值,则按实际值为准。若值为true,则表示该部件默认开启此系统能力,若值为false,则表明该部件默认关闭此系统能力。
以上配置表明,WIFI的STA、AP、和HotspotExt三个系统能力是打开的,而P2P和Core是关闭的。
产品配置系统能力
产品配置系统能力是为了方便某个特定产品是否要打开或关闭特定的系统能力,若无配置,则以部件侧的配置为准,产品配置系统能力的位置在vender/{company}/{product}/config.json。
如果要对产品的系统能力进行精细化配置,可在产品配置中加入syscap关键字,并对要配置的系统能力赋值。产品侧的配置优先级大于部件系统能力默认配置,若某一个系统能力在部件侧默认配置为false,在产品侧配置为true,则这个系统能力的最终配置为true。示例如下:
{
"subsystem": "communication",
"components": [
...
{
"component": "wifi",
"features": [],
"syscap": [
"SystemCapability.Communication.WiFi.AP = false",
"SystemCapability.Communication.WiFi.P2P = true",
"SystemCapability.Communication.WiFi.HotspotExt = false"
]
},
...
`HarmonyOS与OpenHarmony鸿蒙文档籽料:mau123789是v直接拿`
以上配置表明,WiFi的AP和HotspotExt系统能力是关闭的,而P2P是打开的。综合部件侧的配置,最终STA、P2P为打开系统能力,而AP、Core和HotspotExt为关闭的系统能力。
部件侧配置和产品侧配置的作用
一般来说,当产品没有特性化差异的时候,我们仅需在部件侧配置系统能力,部件侧配置的系统能力是我们的基础,只有当产品存在特性化差异,需要关闭某个默认打开的系统能力或打开某个系统默认关闭的系统能力时,我们才会需要在产品侧配置。
审核编辑 黄宇
-
开发板
+关注
关注
25文章
5144浏览量
98446 -
鸿蒙
+关注
关注
57文章
2398浏览量
43133 -
OpenHarmony
+关注
关注
25文章
3753浏览量
16729
发布评论请先 登录
相关推荐
鸿蒙OpenHarmony开发板解析:【 模块配置规则】
![<b class='flag-5'>鸿蒙</b><b class='flag-5'>OpenHarmony</b><b class='flag-5'>开发板</b><b class='flag-5'>解析</b>:【 模块<b class='flag-5'>配置</b><b class='flag-5'>规则</b>】](https://file1.elecfans.com/web2/M00/C9/99/wKgaomYeL0WAZFDHAAACSiKnE8w930.jpg)
鸿蒙OpenHarmony开发板解析:【Rust模块配置规则和指导】
![<b class='flag-5'>鸿蒙</b><b class='flag-5'>OpenHarmony</b><b class='flag-5'>开发板</b><b class='flag-5'>解析</b>:【Rust模块<b class='flag-5'>配置</b><b class='flag-5'>规则</b>和指导】](https://file1.elecfans.com/web2/M00/E4/89/wKgaomY814aAXIR1AAA01VxEKNI913.jpg)
鸿蒙OpenHarmony南向/北向快速开发教程-迅为RK3568开发板
迅为RK3568开发板鸿蒙OpenHarmony系统固件烧写步骤
openharmony开发版 openharmony开发板
开发板如何适配OpenHarmony 3.2
瑞芯微RK3566鸿蒙开发板OpenHarmony标准系统应用兼容性测试指导
![瑞芯微RK3566<b class='flag-5'>鸿蒙</b><b class='flag-5'>开发板</b><b class='flag-5'>OpenHarmony</b>标准<b class='flag-5'>系统</b>应用兼容性测试指导](https://file1.elecfans.com/web2/M00/06/CC/wKgaombfwriAd7r-AACXgQwhofQ225.png)
瑞芯微RK3568鸿蒙开发板OpenHarmony系统修改cfg文件权限方法
![瑞芯微RK3568<b class='flag-5'>鸿蒙</b><b class='flag-5'>开发板</b><b class='flag-5'>OpenHarmony</b><b class='flag-5'>系统</b>修改cfg文件权限方法](https://file1.elecfans.com/web2/M00/06/01/wKgZombhKSWAfaYCAACRBodpoiI952.png)
触觉智能Purple Pi OH鸿蒙开发板成功适配OpenHarmony5.0 Release,开启新征程
![触觉智能Purple Pi OH<b class='flag-5'>鸿蒙</b><b class='flag-5'>开发板</b>成功适配<b class='flag-5'>OpenHarmony</b>5.0 Release,开启新征程](https://file1.elecfans.com/web2/M00/0B/17/wKgaomcbB5CAT81-AABxUeJzZxU480.png)
如何在开源鸿蒙OpenHarmony开启SELinux模式?RK3566鸿蒙开发板演示
![如何在开源<b class='flag-5'>鸿蒙</b><b class='flag-5'>OpenHarmony</b>开启SELinux模式?RK3566<b class='flag-5'>鸿蒙</b><b class='flag-5'>开发板</b>演示](https://file1.elecfans.com/web2/M00/0C/C1/wKgaomc7Hr6AL1UtAAB6Pp_Ckc0170.png)
OpenHarmony属性信息怎么修改?触觉智能RK3566鸿蒙开发板来演示
![<b class='flag-5'>OpenHarmony</b>属性信息怎么修改?触觉智能RK3566<b class='flag-5'>鸿蒙</b><b class='flag-5'>开发板</b>来演示](https://file1.elecfans.com/web3/M00/00/12/wKgZPGdGdlaAQcG2AAB7LqkFe94757.png)
OpenHarmony默认30秒熄屏太麻烦?触觉智能鸿蒙开发板教你轻松取消
![<b class='flag-5'>OpenHarmony</b>默认30秒熄屏太麻烦?触觉智能<b class='flag-5'>鸿蒙</b><b class='flag-5'>开发板</b>教你轻松取消](https://file1.elecfans.com/web3/M00/01/8E/wKgZPGdWZ_GAGdDCAAB7Ia_4sBM517.png)
OpenHarmony怎么修改DPI密度值?触觉智能RK3566鸿蒙开发板演示
![<b class='flag-5'>OpenHarmony</b>怎么修改DPI密度值?触觉智能RK3566<b class='flag-5'>鸿蒙</b><b class='flag-5'>开发板</b>演示](https://file1.elecfans.com/web3/M00/03/8B/wKgZPGdqLoyAKZgAAAB1wHV_XdE820.png)
OpenHarmony源码编译后烧录镜像教程,RK3566鸿蒙开发板演示
![<b class='flag-5'>OpenHarmony</b>源码编译后烧录镜像教程,RK3566<b class='flag-5'>鸿蒙</b><b class='flag-5'>开发板</b>演示](https://file1.elecfans.com/web3/M00/04/41/wKgZO2dyAH2AFFx6AAB2FN45Lh8124.png)
评论