fix:蓝牙同步名称报错解决
This commit is contained in:
@@ -10,10 +10,7 @@ import { updateDeviceSettings } from '@/pages/device/settings/device-settings.ap
|
|||||||
import { buildBleDeviceName, isStandardBleDeviceName } from '@/utils/ble-device-name'
|
import { buildBleDeviceName, isStandardBleDeviceName } from '@/utils/ble-device-name'
|
||||||
import { releaseBleDevice } from '@/utils/bluetooth'
|
import { releaseBleDevice } from '@/utils/bluetooth'
|
||||||
import { clearZ2BleHandleCache, sendZ2BleRenameCommand } from '@/utils/z2-ble'
|
import { clearZ2BleHandleCache, sendZ2BleRenameCommand } from '@/utils/z2-ble'
|
||||||
import {
|
import { getZ2RenameProgressLabel } from '@/utils/z2-ble-protocol'
|
||||||
getZ2RenameProgressLabel,
|
|
||||||
isZ2RenameSuccessful,
|
|
||||||
} from '@/utils/z2-ble-protocol'
|
|
||||||
import { bindDevice } from '../add-device.api'
|
import { bindDevice } from '../add-device.api'
|
||||||
import { parseId, sameId } from '@/utils/device-id'
|
import { parseId, sameId } from '@/utils/device-id'
|
||||||
import { readStoredHomeId, saveSelectedHomeId } from '@/utils/selected-home'
|
import { readStoredHomeId, saveSelectedHomeId } from '@/utils/selected-home'
|
||||||
@@ -253,7 +250,7 @@ export function useCompleteDevice() {
|
|||||||
if (needRename) {
|
if (needRename) {
|
||||||
uni.showLoading({ title: '正在同步蓝牙名称…', mask: true })
|
uni.showLoading({ title: '正在同步蓝牙名称…', mask: true })
|
||||||
try {
|
try {
|
||||||
const renameProgress = await sendZ2BleRenameCommand(bleDeviceId.value, bleName, {
|
await sendZ2BleRenameCommand(bleDeviceId.value, bleName, {
|
||||||
timeoutMs: 25000,
|
timeoutMs: 25000,
|
||||||
onProgress: (progress) => {
|
onProgress: (progress) => {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
@@ -262,17 +259,8 @@ export function useCompleteDevice() {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if (!isZ2RenameSuccessful(renameProgress)) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '蓝牙名称同步未完成,将继续添加设备',
|
|
||||||
icon: 'none',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} catch {
|
} catch {
|
||||||
uni.showToast({
|
// 蓝牙名称同步失败不影响云端绑定,静默继续
|
||||||
title: '蓝牙名称同步失败,将继续添加设备',
|
|
||||||
icon: 'none',
|
|
||||||
})
|
|
||||||
} finally {
|
} finally {
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user