
想了解更多内容,鸿蒙请访问:
和华为官方合作共建的架使鸿蒙技术社区
https://harmonyos.51cto.com

https://blog.csdn.net/qq_33259323/article/details/116143820
打开foundation\ace\ace_engine_lite\frameworks\src\core\modules\app_module.h
static JSIValue ToggleLed(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); JSI::SetModuleAPI(exports, "toggleLed", AppModule::ToggleLed);
打开foundation\ace\ace_engine_lite\frameworks\src\core\modules\app_module.cpp
JSIValue AppModule::ToggleLed(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum) { HILOG_ERROR(HILOG_MODULE_ACE, "led button pressed."); printf("led button pressedn"); return JSI::CreateUndefined(); } 
之后就进行编译烧录,C++层的亿华云用J用就弄好了
打开C:\Users\XX\AppData\Local\Huawei\Sdk\js\2.1.1.18\api\smartVision\@system.app.d.ts添加API
static toggleLed(): void;

然后打开DEVECO在你的页面上写个按钮和加个点击事件
import router from @system.router; import app from @system.app export default { data: { }, onInit() { }, led: function(){ app.toggleLed(); } }然后把编写好的HAP包装到3516上面
https://blog.csdn.net/qq_33259323/article/details/111307192

参考:https://harmonyos.51cto.com/posts/3112
想了解更多内容,服务器租用请访问:
和华为官方合作共建的鸿蒙鸿蒙技术社区
https://harmonyos.51cto.com
