|
@@ -3,7 +3,6 @@
|
|
|
class bleManager {
|
|
|
constructor() {
|
|
|
var that = this;
|
|
|
- that.isAvailable = false;
|
|
|
that.hasPermission = false;
|
|
|
that.scanDevices = [];
|
|
|
that.publicDevice = null;
|
|
@@ -43,18 +42,9 @@ class bleManager {
|
|
|
|
|
|
/// 监控蓝牙打开状态
|
|
|
initBluetoothAdapter() {
|
|
|
- var that = this;
|
|
|
- // wx.openBluetoothAdapter({
|
|
|
- // success: (res) => {
|
|
|
- // that.isAvailable = true;
|
|
|
- // },
|
|
|
- // fail: (err) => {
|
|
|
- // that.isAvailable = false;
|
|
|
- // }
|
|
|
- // });
|
|
|
wx.onBluetoothAdapterStateChange(function (res) {
|
|
|
- that.isAvailable = res.available;
|
|
|
- if (!that.isAvailable) {
|
|
|
+ var isAvailable = res.available;
|
|
|
+ if (!isAvailable) {
|
|
|
getCurrentPages()[0].updateDeviceList([], false, true);
|
|
|
}
|
|
|
})
|
|
@@ -697,6 +687,15 @@ class bleManager {
|
|
|
// 导出 bleManager 类
|
|
|
module.exports = bleManager;
|
|
|
|
|
|
+// wx.openBluetoothAdapter({
|
|
|
+// success: (res) => {
|
|
|
+// that.isAvailable = true;
|
|
|
+// },
|
|
|
+// fail: (err) => {
|
|
|
+// that.isAvailable = false;
|
|
|
+// }
|
|
|
+// });
|
|
|
+
|
|
|
// wx.getSetting({
|
|
|
// success(res) {
|
|
|
// if (res.authSetting["scope.userFuzzyLocation"]) {
|