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