|
@@ -180,7 +180,6 @@
|
|
|
}).then(
|
|
}).then(
|
|
|
res => {
|
|
res => {
|
|
|
console.log('BLEFINDHASBIND:', res);
|
|
console.log('BLEFINDHASBIND:', res);
|
|
|
- // uni.hideToast();
|
|
|
|
|
if (res.code == 0) {
|
|
if (res.code == 0) {
|
|
|
//code = 0 是新的地址,没绑定过
|
|
//code = 0 是新的地址,没绑定过
|
|
|
//绑定设备使用者
|
|
//绑定设备使用者
|
|
@@ -283,7 +282,7 @@
|
|
|
//2.跳转蓝牙设置
|
|
//2.跳转蓝牙设置
|
|
|
uni.showModal({
|
|
uni.showModal({
|
|
|
title:'蓝牙提示',
|
|
title:'蓝牙提示',
|
|
|
- content:'请在弹出框点击确定匹配蓝牙。\r\n如没有提示框,重新刷新手机蓝牙,是否跳转手机蓝牙页面?',
|
|
|
|
|
|
|
+ content:'1.请在弹出框点击确定匹配蓝牙。\r\n2.如没有提示框,重新刷新手机蓝牙,是否跳转手机蓝牙页面?',
|
|
|
success: (res) => {
|
|
success: (res) => {
|
|
|
if(res.confirm){
|
|
if(res.confirm){
|
|
|
this.B_OpenBLESetting();
|
|
this.B_OpenBLESetting();
|
|
@@ -331,7 +330,6 @@
|
|
|
let _self = this;
|
|
let _self = this;
|
|
|
if (_self.bOpenBluetooth) {
|
|
if (_self.bOpenBluetooth) {
|
|
|
|
|
|
|
|
-
|
|
|
|
|
//先查询最近使用的硬件,如果最近使用的和当前需要连接的item id一样,则认为是
|
|
//先查询最近使用的硬件,如果最近使用的和当前需要连接的item id一样,则认为是
|
|
|
if (_self.finallyUseDevice !== null) {
|
|
if (_self.finallyUseDevice !== null) {
|
|
|
if (_self.finallyUseDevice.id == _self.currentItem.id) {
|
|
if (_self.finallyUseDevice.id == _self.currentItem.id) {
|
|
@@ -342,7 +340,7 @@
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
title: '设备连接中...',
|
|
title: '设备连接中...',
|
|
|
icon: 'loading',
|
|
icon: 'loading',
|
|
|
- duration: 10000,
|
|
|
|
|
|
|
+ duration: 12000,
|
|
|
mask: true
|
|
mask: true
|
|
|
})
|
|
})
|
|
|
// 先直连,然后判断版本
|
|
// 先直连,然后判断版本
|
|
@@ -351,7 +349,7 @@
|
|
|
|
|
|
|
|
uni.showModal({
|
|
uni.showModal({
|
|
|
title: '连接提示!',
|
|
title: '连接提示!',
|
|
|
- content: "确定则连接最近使用的设备。\r\n取消则重新搜索设备。",
|
|
|
|
|
|
|
+ content: "1.确定则连接最近使用的设备。\r\n2.取消则重新搜索设备。",
|
|
|
success: (res) => {
|
|
success: (res) => {
|
|
|
if (res.confirm) {
|
|
if (res.confirm) {
|
|
|
//currentItem 是mode 页面选中的item
|
|
//currentItem 是mode 页面选中的item
|
|
@@ -363,7 +361,7 @@
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
title: '设备连接中...',
|
|
title: '设备连接中...',
|
|
|
icon: 'loading',
|
|
icon: 'loading',
|
|
|
- duration: 10000,
|
|
|
|
|
|
|
+ duration: 12000,
|
|
|
mask: true
|
|
mask: true
|
|
|
})
|
|
})
|
|
|
console.log("_onConnectDevice:::===", obj);
|
|
console.log("_onConnectDevice:::===", obj);
|
|
@@ -422,7 +420,7 @@
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
title: '设备连接中...',
|
|
title: '设备连接中...',
|
|
|
icon: 'loading',
|
|
icon: 'loading',
|
|
|
- duration: 10000,
|
|
|
|
|
|
|
+ duration: 12000,
|
|
|
mask: true
|
|
mask: true
|
|
|
})
|
|
})
|
|
|
console.log("B_GetBondedDevices:::===", obj);
|
|
console.log("B_GetBondedDevices:::===", obj);
|
|
@@ -442,7 +440,7 @@
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
title: '设备连接中...',
|
|
title: '设备连接中...',
|
|
|
icon: 'loading',
|
|
icon: 'loading',
|
|
|
- duration: 10000,
|
|
|
|
|
|
|
+ duration: 12000,
|
|
|
mask: true
|
|
mask: true
|
|
|
})
|
|
})
|
|
|
// 1.已经搜索到的,根据蓝牙回调的mac 地址判断合法性。
|
|
// 1.已经搜索到的,根据蓝牙回调的mac 地址判断合法性。
|
|
@@ -465,13 +463,13 @@
|
|
|
_self.searchTimeOut = null;
|
|
_self.searchTimeOut = null;
|
|
|
}
|
|
}
|
|
|
_self.searchTimeOut = setTimeout(() => {
|
|
_self.searchTimeOut = setTimeout(() => {
|
|
|
- //1.搜索10秒钟之后,停止搜索,走其他流程判断
|
|
|
|
|
|
|
+ //1.搜索12秒钟之后,停止搜索
|
|
|
_self.stopBluetoothDevicesDiscovery();
|
|
_self.stopBluetoothDevicesDiscovery();
|
|
|
uni.showModal({
|
|
uni.showModal({
|
|
|
title: '搜索失败',
|
|
title: '搜索失败',
|
|
|
content: '1.请开启设备。\r\n2.或者断开手机蓝牙页面连接的手柄。\r\n待蓝色设备灯闪烁,再重新搜索连接。'
|
|
content: '1.请开启设备。\r\n2.或者断开手机蓝牙页面连接的手柄。\r\n待蓝色设备灯闪烁,再重新搜索连接。'
|
|
|
})
|
|
})
|
|
|
- }, 10000)
|
|
|
|
|
|
|
+ }, 12000)
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
* 停止搜索蓝牙设备
|
|
* 停止搜索蓝牙设备
|
|
@@ -554,6 +552,12 @@
|
|
|
console.log("*****getBLEDeviceServices************");
|
|
console.log("*****getBLEDeviceServices************");
|
|
|
//连接成功了,设置旧的item
|
|
//连接成功了,设置旧的item
|
|
|
this.oldItem = this.currentItem;
|
|
this.oldItem = this.currentItem;
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '正在验证设备信息...',
|
|
|
|
|
+ icon: 'loading',
|
|
|
|
|
+ duration: 6000,
|
|
|
|
|
+ mask: true
|
|
|
|
|
+ })
|
|
|
// 初始化服务后,获取版本,判断
|
|
// 初始化服务后,获取版本,判断
|
|
|
// 停止蓝牙加速计
|
|
// 停止蓝牙加速计
|
|
|
this.writeMacTimeout = setTimeout(() => {
|
|
this.writeMacTimeout = setTimeout(() => {
|
|
@@ -570,9 +574,10 @@
|
|
|
this.searchMac = null;
|
|
this.searchMac = null;
|
|
|
}
|
|
}
|
|
|
this.searchMac = setTimeout(() => {
|
|
this.searchMac = setTimeout(() => {
|
|
|
|
|
+ uni.hideToast();
|
|
|
uni.showModal({
|
|
uni.showModal({
|
|
|
title: '提示',
|
|
title: '提示',
|
|
|
- content: '检测设备失败,再次尝试连接或者 重启手柄(Reset键位也可)后再尝试重新连接'
|
|
|
|
|
|
|
+ content: '检测设备失败。\r\n1.检查手机蓝牙是否已连接上设备。\r\n2.再次尝试连接或者 重启手柄(Reset键位也可)后再尝试连接'
|
|
|
})
|
|
})
|
|
|
this.onOnlyCloseBLEConnection({
|
|
this.onOnlyCloseBLEConnection({
|
|
|
getSuccess: () => {
|
|
getSuccess: () => {
|
|
@@ -601,6 +606,12 @@
|
|
|
console.log("******getBLEDeviceServices************", res);
|
|
console.log("******getBLEDeviceServices************", res);
|
|
|
//连接成功了,设置旧的item
|
|
//连接成功了,设置旧的item
|
|
|
this.oldItem = this.currentItem;
|
|
this.oldItem = this.currentItem;
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '正在验证设备信息...',
|
|
|
|
|
+ icon: 'loading',
|
|
|
|
|
+ duration: 6000,
|
|
|
|
|
+ mask: true
|
|
|
|
|
+ })
|
|
|
// 初始化服务后,获取版本,判断
|
|
// 初始化服务后,获取版本,判断
|
|
|
// 停止蓝牙加速计
|
|
// 停止蓝牙加速计
|
|
|
this.writeMacTimeout = setTimeout(() => {
|
|
this.writeMacTimeout = setTimeout(() => {
|
|
@@ -617,9 +628,10 @@
|
|
|
this.searchMac = null;
|
|
this.searchMac = null;
|
|
|
}
|
|
}
|
|
|
this.searchMac = setTimeout(() => {
|
|
this.searchMac = setTimeout(() => {
|
|
|
|
|
+ uni.hideToast();
|
|
|
uni.showModal({
|
|
uni.showModal({
|
|
|
title: '提示',
|
|
title: '提示',
|
|
|
- content: '检测设备失败,再次尝试连接或者 重启手柄(Reset键位也可)后再尝试重新连接'
|
|
|
|
|
|
|
+ content: '检测设备失败。\r\n1.检查手机蓝牙是否已连接上设备。\r\n2.再次尝试连接或者 重启手柄(Reset键位也可)后再尝试连接'
|
|
|
})
|
|
})
|
|
|
this.onOnlyCloseBLEConnection({
|
|
this.onOnlyCloseBLEConnection({
|
|
|
getSuccess: () => {
|
|
getSuccess: () => {
|