微信小程序 低功耗蓝牙模块封装
- 蓝牙适配器接口是基础库版本 1.1.0 开始支持。
- iOS 微信客户端 6.5.6 版本开始支持,Android 客户端暂不支持
- 发送队列支持,全局管理等特性
详细见官网: https://mp.weixin.qq.com/debug/wxadoc/dev/api/bluetooth.html#wxgetconnectedbluethoothdevicesobject
var Ble = require('./ble/ble.js').Ble var ble = new Ble();
ble.scanBle(1000, 10000,
function (result) {
//do shomthing
},
function (deviceName) {
return true;
});
}
ble.connectBle(deviceMac, deviceName, {
onSuccess: function () {
//do shomthing
},
onFailure(errorCode){
console.log(errorCode);
}
});