蓝牙模块添加在web平台默认成功方便调试功能,4877功能完成
This commit is contained in:
@ -27,7 +27,8 @@
|
||||
|
||||
<view class="item " v-for="item, index in PairEquip" v-show="PairEquip.length>0">
|
||||
<view class="leftImg ">
|
||||
<image src="/static/images/common/bluetooth.png" class="titleIco" mode="heightFix">
|
||||
<image src="/static/images/common/bluetooth.png" class="titleIco filterNone"
|
||||
mode="heightFix">
|
||||
</image>
|
||||
</view>
|
||||
<view class="centertxt ">
|
||||
@ -172,73 +173,80 @@
|
||||
let search = option.search;
|
||||
these = this;
|
||||
eventChannel = this.getOpenerEventChannel();
|
||||
// this.EquipMents = [{
|
||||
// "RSSI": -55,
|
||||
// "advertisData": "",
|
||||
// "advertisServiceUUIDs": [
|
||||
// "0000FFE0-0000-1000-8000-00805F9B34FB"
|
||||
// ],
|
||||
// "deviceId": "EBDA4E6F-3A28-FF65-A845-AE8CC7B78375",
|
||||
// "name": "HBY670-BF74EA",
|
||||
// "linkStatu": false
|
||||
// },
|
||||
// {
|
||||
// "RSSI": -61,
|
||||
// "advertisData": "",
|
||||
// "advertisServiceUUIDs": [
|
||||
// "0000FFE0-0000-1000-8000-00805F9B34FB"
|
||||
// ],
|
||||
// "deviceId": "469FB381-B47E-1E40-8073-EF50B5704AAB",
|
||||
// "name": "EF4651",
|
||||
// "linkStatu": false,
|
||||
// "isTarget": true
|
||||
// },
|
||||
// {
|
||||
// "RSSI": -69,
|
||||
// "advertisData": "",
|
||||
// "advertisServiceUUIDs": [
|
||||
// "0000FFE0-0000-1000-8000-00805F9B34FB"
|
||||
// ],
|
||||
// "deviceId": "4F0DAC91-4391-CB07-905E-72D7F03EFCD3",
|
||||
// "name": "4877-BF743D",
|
||||
// "linkStatu": false
|
||||
// }
|
||||
// ];
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
if (systemInfo.uniPlatform == 'web') {
|
||||
|
||||
|
||||
this.EquipMents = [{
|
||||
"RSSI": -55,
|
||||
"advertisData": "",
|
||||
"advertisServiceUUIDs": [
|
||||
"0000FFE0-0000-1000-8000-00805F9B34FB"
|
||||
],
|
||||
"deviceId": "EBDA4E6F-3A28-FF65-A845-AE8CC7B78375",
|
||||
"name": "HBY670-BF74EA",
|
||||
"linkStatu": false
|
||||
},
|
||||
{
|
||||
"RSSI": -61,
|
||||
"advertisData": "",
|
||||
"advertisServiceUUIDs": [
|
||||
"0000FFE0-0000-1000-8000-00805F9B34FB"
|
||||
],
|
||||
"deviceId": "469FB381-B47E-1E40-8073-EF50B5704AAB",
|
||||
"name": "EF4651",
|
||||
"linkStatu": false,
|
||||
"isTarget": true
|
||||
},
|
||||
{
|
||||
"RSSI": -69,
|
||||
"advertisData": "",
|
||||
"advertisServiceUUIDs": [
|
||||
"0000FFE0-0000-1000-8000-00805F9B34FB"
|
||||
],
|
||||
"deviceId": "4F0DAC91-4391-CB07-905E-72D7F03EFCD3",
|
||||
"name": "4877-BF743D",
|
||||
"linkStatu": false
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
these.PairEquip = [this.EquipMents[0]];
|
||||
return;
|
||||
}
|
||||
let StartSubsrib = () => {
|
||||
these.EquipMents = [];
|
||||
ble = bleTool.getBleTool();
|
||||
//蓝牙不可用的回调
|
||||
ble.addStateBreakCallback(res=>{
|
||||
ble.addStateBreakCallback(res => {
|
||||
if (these.Status.isPageHidden) {
|
||||
return;
|
||||
}
|
||||
console.log("处理蓝牙不可用");
|
||||
hideLoading(these);
|
||||
these.PairEquip=[];
|
||||
these.EquipMents=[];
|
||||
these.PairEquip = [];
|
||||
these.EquipMents = [];
|
||||
uni.showToast({
|
||||
icon:'fail',
|
||||
title:'蓝牙已不可用'
|
||||
icon: 'fail',
|
||||
title: '蓝牙已不可用'
|
||||
});
|
||||
these.showOpenSetting();
|
||||
|
||||
},pagePath);
|
||||
|
||||
}, pagePath);
|
||||
//蓝牙再次可用的回调
|
||||
ble.addStateRecoveryCallback(res=>{
|
||||
ble.addStateRecoveryCallback(res => {
|
||||
if (these.Status.isPageHidden) {
|
||||
return;
|
||||
}
|
||||
uni.showToast({
|
||||
icon:'success',
|
||||
title:'蓝牙恢复可用'
|
||||
icon: 'success',
|
||||
title: '蓝牙恢复可用'
|
||||
});
|
||||
these.Status.BottomMenu.show = false;
|
||||
these.EquipMents=[];
|
||||
these.EquipMents = [];
|
||||
these.refreshBleList();
|
||||
},pagePath);
|
||||
|
||||
}, pagePath);
|
||||
|
||||
//蓝牙断开连接的回调
|
||||
ble.addDisposeCallback(res => {
|
||||
if (these.Status.isPageHidden) {
|
||||
@ -469,9 +477,9 @@
|
||||
|
||||
}
|
||||
hideLoading(these);
|
||||
|
||||
eventChannel.emit('BindOver',these.device);
|
||||
|
||||
|
||||
eventChannel.emit('BindOver', these.device);
|
||||
|
||||
ble.updateCache();
|
||||
uni.navigateBack();
|
||||
return true;
|
||||
@ -941,4 +949,9 @@
|
||||
color: #232323;
|
||||
|
||||
}
|
||||
|
||||
.filterNone {
|
||||
filter: none !important;
|
||||
-webkit-filter: none !important;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user