|
@@ -39,6 +39,7 @@ Page({
|
|
|
}
|
|
|
|
|
|
// AIrSMArT_861210052356337===D0:31:10:86:AC:9A
|
|
|
+ /// 纯蓝牙:MW_BLE CC:90:DD:88:C7:E8
|
|
|
var name = options.name;
|
|
|
var deviceId = options.deviceId;
|
|
|
that.setData({
|
|
@@ -46,22 +47,50 @@ Page({
|
|
|
connectedDeviceId: deviceId,
|
|
|
});
|
|
|
|
|
|
+ // var device = {
|
|
|
+ // "mac": name,
|
|
|
+ // "deviceId": deviceId
|
|
|
+ // };
|
|
|
+
|
|
|
var device = {
|
|
|
- "mac": name,
|
|
|
- "deviceId": deviceId
|
|
|
+ "mac": "MW_BLE",
|
|
|
+ "deviceId": "CC:90:DD:88:C7:E8"
|
|
|
};
|
|
|
|
|
|
console.log("gadsfasdfadfaf===00==");
|
|
|
|
|
|
- BtHelper.getInstance().connect(device, function (isConnected, device) {
|
|
|
- if (isConnected) {
|
|
|
+ // BtHelper.getInstance().connect(device, function (isConnected, device) {
|
|
|
+ // if (isConnected) {
|
|
|
|
|
|
- }
|
|
|
- }, true, device);
|
|
|
- // BleUtil.getInstance().startConnect(device, function (changed) {
|
|
|
- // if (changed) {
|
|
|
- // BleUtil.getInstance().sendData(device, app.globalData.ssid, app.globalData.pwdData);
|
|
|
// }
|
|
|
- // });
|
|
|
+ // }, true, device);
|
|
|
+
|
|
|
+ BtHelper.getInstance().startScan(device,
|
|
|
+ async function (b) {
|
|
|
+ console.log("gadsfasdfadfaf===xxx==" + b);
|
|
|
+ if (b) {
|
|
|
+ setTimeout(function () {
|
|
|
+ console.log("gadsfasdfadfaf===yyy==");
|
|
|
+
|
|
|
+ BleUtil.getInstance().startConnect(device, function (changed) {
|
|
|
+ if (changed) {
|
|
|
+ BleUtil.getInstance().sendData(device, app.globalData.ssid, app.globalData.pwdData);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }, 10 * 1000);
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ async function (res) {
|
|
|
+ console.log("gadsfasdfadfaf===yyy==");
|
|
|
+ await BtHelper.getInstance().stopSearch();
|
|
|
+ BleUtil.getInstance().startConnect(device, function (changed) {
|
|
|
+ if (changed) {
|
|
|
+ BleUtil.getInstance().sendData(device, app.globalData.ssid, app.globalData.pwdData);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ );
|
|
|
+
|
|
|
},
|
|
|
})
|