|
@@ -26,6 +26,7 @@ Page({
|
|
onLoad(options) {
|
|
onLoad(options) {
|
|
var that = this;
|
|
var that = this;
|
|
var json = JSON.parse(options.param)
|
|
var json = JSON.parse(options.param)
|
|
|
|
+ json.clientType = "MW-S2(BLE)"
|
|
console.log("要连接设备:", json)
|
|
console.log("要连接设备:", json)
|
|
that.setData({
|
|
that.setData({
|
|
connectDevice: json
|
|
connectDevice: json
|
|
@@ -40,16 +41,17 @@ Page({
|
|
BtHelper.getInstance().startScan(
|
|
BtHelper.getInstance().startScan(
|
|
that.data.connectDevice,
|
|
that.data.connectDevice,
|
|
async function (b) {
|
|
async function (b) {
|
|
- if (!b) {
|
|
|
|
- that.setStatus(1);
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- async function (res) {
|
|
|
|
- await BtHelper.getInstance().stopSearch();
|
|
|
|
- that.setStatus(2);
|
|
|
|
- that.data.connectDevice.deviceId = res.deviceId;
|
|
|
|
- that.data.connectDevice.connectable = res.connectable;
|
|
|
|
|
|
+ if (!b) {
|
|
|
|
+ that.setStatus(1);
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ async function (res) {
|
|
|
|
+ await BtHelper.getInstance().stopSearch();
|
|
|
|
+ that.setStatus(2);
|
|
|
|
+ that.data.connectDevice.deviceId = res.deviceId;
|
|
|
|
+ that.data.connectDevice.connectable = res.connectable;
|
|
|
|
+ that.data.connectDevice.mac = res.mac;
|
|
|
|
+ }
|
|
);
|
|
);
|
|
},
|
|
},
|
|
|
|
|