Skip to content

Commit bb56872

Browse files
committed
update : 修改关闭蓝牙模块的时候执行断开蓝牙操作异常
1 parent 614fecc commit bb56872

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎pages/API/bluetooth/bluetooth.vue‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ export default {
148148
showMaskType: 'device',
149149
servicesData: [],
150150
characteristicsData: [],
151-
valueChangeData: {},
151+
valueChangeData: {},
152+
isStop:true ,
152153
list: []
153154
};
154155
},
@@ -206,7 +207,8 @@ export default {
206207
uni.openBluetoothAdapter({
207208
success: e => {
208209
console.log('初始化蓝牙成功:' + e.errMsg);
209-
console.log(JSON.stringify(e));
210+
console.log(JSON.stringify(e));
211+
this.isStop = false ;
210212
this.$set(this.disabled, 0, true);
211213
this.$set(this.disabled, 1, false);
212214
this.$set(this.disabled, 10, false);
@@ -455,7 +457,8 @@ export default {
455457
// 该方法回调中可以用于处理连接意外断开等异常情况
456458
console.log(`蓝牙连接状态 -------------------------->`);
457459
console.log(JSON.stringify(res));
458-
if (!res.connected) {
460+
if (!res.connected) {
461+
if(this.isStop) return ;
459462
console.log('断开低功耗蓝牙成功:');
460463
this.$set(this.disabled, 1, false);
461464
this.$set(this.disabled, 3, true);
@@ -548,7 +551,8 @@ export default {
548551
closeBluetoothAdapter(OBJECT) {
549552
uni.closeBluetoothAdapter({
550553
success: res => {
551-
console.log('断开蓝牙模块成功');
554+
console.log('断开蓝牙模块成功');
555+
this.isStop = true ;
552556
this.$set(this.disabled, 0, false);
553557
this.$set(this.disabled, 1, true);
554558
this.$set(this.disabled, 2, true);

0 commit comments

Comments
 (0)