From b4aeff31fd901761aa37aa0ffbf02831ba531c35 Mon Sep 17 00:00:00 2001 From: liyi Date: Mon, 3 Mar 2025 16:46:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=85=BC=E5=AE=B97258=2032=E4=BD=8DUUI?= =?UTF-8?q?D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- stores/bluetooth.js | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/stores/bluetooth.js b/stores/bluetooth.js index 594f8bf..499c992 100644 --- a/stores/bluetooth.js +++ b/stores/bluetooth.js @@ -797,6 +797,9 @@ export const useBluetoothStore = defineStore('ble', { if (uuid && uuid.slice(2, 8) === '758824' && uuid.slice(30, 32) === '00') { that.deviceList.push(deviceList[i]) } + if (uuid && uuid.slice(0, 2) === '75' && uuid.slice(4, 6) === '00') { + that.deviceList.push(deviceList[i]) + } } } console.log('设备列表', that.deviceList) @@ -1073,6 +1076,11 @@ export const useBluetoothStore = defineStore('ble', { for (let i = 0; i < deviceList.length; i++) { if (deviceList[i]?.name === that.currentLockInfo.name) { const uuid = deviceList[i]?.advertisServiceUUIDs[0] + if (uuid && uuid.slice(2, 8) === '758824') { + console.log('设备UUID', uuid, uuid.slice(2, 8), uuid.slice(30, 32)) + } else if (uuid && uuid.slice(0, 2) === '75') { + console.log('设备UUID', uuid, uuid.slice(2, 8), uuid.slice(4, 6)) + } if ( uuid && uuid.slice(2, 8) === '758824' && @@ -1106,6 +1114,30 @@ export const useBluetoothStore = defineStore('ble', { code: -2 }) break + } else if (uuid && uuid.slice(0, 2) === '75' && uuid.slice(4, 6) === '01') { + uni.stopBluetoothDevicesDiscovery() + clearTimeout(timer2) + clearInterval(timer1) + resolve({ + code: 0, + data: { + deviceId: deviceList[i].deviceId + } + }) + break + } else if (uuid && uuid.slice(0, 2) === '75' && uuid.slice(4, 6) === '00') { + uni.stopBluetoothDevicesDiscovery() + clearTimeout(timer2) + clearInterval(timer1) + uni.hideLoading() + uni.showToast({ + title: '锁已被重置,请重新绑定', + icon: 'none' + }) + resolve({ + code: -2 + }) + break } else { uni.stopBluetoothDevicesDiscovery() clearTimeout(timer2) @@ -1475,7 +1507,7 @@ export const useBluetoothStore = defineStore('ble', { console.log('写入未执行', this.bluetoothStatus) this.getBluetoothStatus() return { - code: -21 + code: -1 } } @@ -2919,7 +2951,7 @@ export const useBluetoothStore = defineStore('ble', { console.log('写入未执行', this.bluetoothStatus) this.getBluetoothStatus() return { - code: -21 + code: -1 } }