更新记录
1.0.3(2021-12-23)
markdow说明
平台兼容性
Android | Android CPU类型 | iOS |
---|---|---|
适用版本区间:5.0 - 11.0 | armeabi-v7a:支持,arm64-v8a:支持,x86:支持 | × |
原生插件通用使用流程:
- 购买插件,选择该插件绑定的项目。
- 在HBuilderX里找到项目,在manifest的app原生插件配置中勾选模块,如需要填写参数则参考插件作者的文档添加。
- 根据插件作者的提供的文档开发代码,在代码中引用插件,调用插件功能。
- 打包自定义基座,选择插件,得到自定义基座,然后运行时选择自定义基座,进行log输出测试。
- 开发完毕后正式云打包
付费原生插件目前不支持离线打包。
Android 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/android
iOS 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/ios
注意事项:使用HBuilderX2.7.14以下版本,如果同一插件且同一appid下购买并绑定了多个包名,提交云打包界面提示包名绑定不一致时,需要在HBuilderX项目中manifest.json->“App原生插件配置”->”云端插件“列表中删除该插件重新选择
Gpio
mfj
gpio 接口通用实例。
一、引入依赖
const testPlugin = uni.requireNativePlugin('mfj-TestPlugin');
二、使用接口
1,打开
使用GPIO前需打开设备。
//打开 GPIO
opendevice(){
debugger
let that =this
let GpioUtils = testPlugin.OpenDevice({},e=>{
uni.showToast({
title: JSON.stringify(e),
icon: 'none'
})
that.text =e.toString()
})
}
2,写入高
sethigh(){
let value =testPlugin.SetValueHigh({gpioId:50},e=>{
uni.showToast({
title: JSON.stringify(e),
icon: 'none'
})
this.text =e.toString()
})
}
3,写入低
setlow(){
let value= testPlugin.SetValueLow({gpioId:50},e=>{
uni.showToast({
title: JSON.stringify(e),
icon: 'none'
})
this.text =e.toString()
})
}
4,读取
getvalue(){
testPlugin.getValue({gpioId:50},e=>{
this.text1 =e.result
})
}