Browse Source

Q系列门锁蓝牙连接优化

master
LAPTOP-9N9MIRBL\琥 1 year ago
parent
commit
c020829ce9
2 changed files with 23 additions and 10 deletions
  1. +23
    -9
      pages/roomDetail/roomDetail.js
  2. +0
    -1
      utils/ICINPakage/ICINLocker.js

+ 23
- 9
pages/roomDetail/roomDetail.js View File

@ -1251,7 +1251,8 @@ Page({
this.personnelmanagement() this.personnelmanagement()
} }
} else { } else {
this.searchDevicesMethods()
this.searchDevicesMethods()
} }
} }
}, },
@ -1268,10 +1269,10 @@ Page({
searchDevicesMethods() { searchDevicesMethods() {
var that = this; var that = this;
wx.showLoading({
title: '正在搜索',
// mask: true
})
// wx.showLoading({
// title: '正在搜索',
// // mask: true
// })
this.setData({ this.setData({
searchClick: false searchClick: false
}) })
@ -1279,11 +1280,24 @@ Page({
success: function (res) { success: function (res) {
wx.startBluetoothDevicesDiscovery({ wx.startBluetoothDevicesDiscovery({
success: function (res) { success: function (res) {
let it={name:that.data.deviceinfo.deviceNum,deviceId:that.data.deviceinfo.bluetoothMac,mac:that.data.deviceinfo.bluetoothMac,localName:that.data.deviceinfo.deviceId}
lockModel = util1.getLockModel(that.data.deviceinfo.deviceNum)
it.lockType = util1.getLockType(lockModel)
app.addDeviceWithDevName(it.name, it)
connectedDeviceId = it.deviceId
lockDevice = it
app.globalData.isSearch = true
that.data.isSearch = true
console.log(that.data.deviceinfo.deviceNum,it.name,'ppppp')
that.connectTo()
return
wx.getBluetoothDevices({ wx.getBluetoothDevices({
success: function (res) { success: function (res) {
console.log(res) console.log(res)
let i=1
res.devices.map(it => { res.devices.map(it => {
var status = it.name.indexOf('WSL') var status = it.name.indexOf('WSL')
i++
if (status != -1) { if (status != -1) {
if (it.RSSI != 127) { if (it.RSSI != 127) {
if (it.advertisData != null) { if (it.advertisData != null) {
@ -1344,9 +1358,10 @@ Page({
} }
} }
}) })
if (!that.data.isSearch && that.data.toSearch) {
that.searchDevicesMethods()
}
// if (!that.data.isSearch) {
// that.searchDevicesMethods()
// console.log(i,'iii1')
// }
} }
}) })
}, },
@ -1552,7 +1567,6 @@ Page({
deviceId: lockDevice.deviceId, deviceId: lockDevice.deviceId,
timeout: config.ble.connectTimeOut, timeout: config.ble.connectTimeOut,
success: function (res) { success: function (res) {
console.debug('connectTo', res)
isConnected = true isConnected = true
wx.hideLoading() wx.hideLoading()
setTimeout(function () { setTimeout(function () {


+ 0
- 1
utils/ICINPakage/ICINLocker.js View File

@ -2634,7 +2634,6 @@ export default class ICINLocker {
let userID4AuthCode = str2Hex(_userID); let userID4AuthCode = str2Hex(_userID);
let userId = userID4AuthCode.PadRight(40, "0"); let userId = userID4AuthCode.PadRight(40, "0");
let pwd = str2Hex(_pwd).PadRight(40, "0"); let pwd = str2Hex(_pwd).PadRight(40, "0");
console.log("2637", _useCountLimit, _useCountLimit.toString(16), typeof (_useCountLimit.toString(16)));
let useCountLimit = _useCountLimit.toString(16).PadLeft(2, "0"); let useCountLimit = _useCountLimit.toString(16).PadLeft(2, "0");
let token = "00000000".PadRight(8, "0"); let token = "00000000".PadRight(8, "0");
let startTime = _startTime.PadRight(8, "0"); let startTime = _startTime.PadRight(8, "0");


Loading…
Cancel
Save