自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

鴻蒙ACE框架-使用JS調(diào)用C++(1)

開發(fā) 后端
文章由鴻蒙社區(qū)產(chǎn)出,想要了解更多內(nèi)容請(qǐng)前往:51CTO和華為官方戰(zhàn)略合作共建的鴻蒙技術(shù)社區(qū)https://harmonyos.51cto.com

[[397654]]

想了解更多內(nèi)容,請(qǐng)?jiān)L問:

51CTO和華為官方合作共建的鴻蒙技術(shù)社區(qū)

https://harmonyos.51cto.com

 鴻蒙ACE框架-使用JS調(diào)用C++(1)

1.下載編譯燒錄代碼

https://blog.csdn.net/qq_33259323/article/details/116143820

2.編寫測(cè)試用例

打開foundation\ace\ace_engine_lite\frameworks\src\core\modules\app_module.h

  1. static JSIValue ToggleLed(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); 
  1. JSI::SetModuleAPI(exports, "toggleLed", AppModule::ToggleLed); 

打開foundation\ace\ace_engine_lite\frameworks\src\core\modules\app_module.cpp

  1. JSIValue AppModule::ToggleLed(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum) 
  2.     HILOG_ERROR(HILOG_MODULE_ACE, "led button pressed."); 
  3.     printf("led button pressed\n"); 
  4.   
  5.     return JSI::CreateUndefined(); 

 

之后就進(jìn)行編譯燒錄,C++層的就弄好了

3.編寫HAP

打開C:\Users\XX\AppData\Local\Huawei\Sdk\js\2.1.1.18\api\smartVision\@system.app.d.ts添加API

static toggleLed(): void;

然后打開DEVECO在你的頁面上寫個(gè)按鈕和加個(gè)點(diǎn)擊事件

  1. <input class="btu" type="button" value="進(jìn)入" onclick="led"></input> 

  1. import router from '@system.router'
  2. import app from '@system.app' 
  3.   
  4. export default { 
  5.     data: { 
  6.   
  7.     }, 
  8.     onInit() { 
  9.   
  10.     }, 
  11.     led: function(){ 
  12.          
  13.         app.toggleLed(); 
  14.     } 

 然后把編寫好的HAP包裝到3516上面

https://blog.csdn.net/qq_33259323/article/details/111307192

4.運(yùn)行

參考:https://harmonyos.51cto.com/posts/3112

想了解更多內(nèi)容,請(qǐng)?jiān)L問:

51CTO和華為官方合作共建的鴻蒙技術(shù)社區(qū)

https://harmonyos.51cto.com

 

責(zé)任編輯:jianghua 來源: 鴻蒙社區(qū)
相關(guān)推薦

2010-01-28 13:35:41

調(diào)用C++函數(shù)

2010-01-20 14:35:55

C++調(diào)用

2010-01-26 15:51:06

C++變量

2012-08-08 09:32:26

C++多進(jìn)程并發(fā)框架

2015-04-21 13:37:44

Google開源CC++版

2010-01-21 11:23:58

C++函數(shù)調(diào)用

2021-10-11 11:53:07

C++接口代碼

2023-03-15 15:58:11

Python動(dòng)態(tài)庫C++

2012-04-28 15:28:21

JNI混合編程Java

2019-08-28 14:21:39

C++C接口代碼

2020-07-31 18:33:56

C++編程語言

2010-01-26 14:10:22

Visual C++

2010-02-01 10:54:37

C++框架

2010-02-01 13:25:32

Python腳本

2023-11-09 23:31:02

C++函數(shù)調(diào)用

2011-08-22 17:25:31

LuaC++函數(shù)

2010-01-20 14:25:56

函數(shù)調(diào)用

2011-05-18 18:05:47

C#C++

2011-05-18 17:56:38

C#C++

2020-07-30 12:40:35

CC++編程語言
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)