Merge branch 'feature_v1.0' of http://gitlab.xiaopeng.local:18080/robotaxi1/xp-robotaxi-miniprogram into feature_v1.0
| | |
| | | } |
| | | |
| | | findAndConnect() { |
| | | const { macAddress, isIOS } = this.state; |
| | | let key = madAddressToLocalName(macAddress); |
| | | if (isIOS) key = key + 'IOS'; |
| | | |
| | | const cacheDeviceId = Taro.getStorageSync(key); |
| | | if (cacheDeviceId) { |
| | | log.info('RtAuth: 使用缓存DeviceId连接', cacheDeviceId); |
| | | this.state.deviceId = cacheDeviceId; |
| | | this.connectDevice(); |
| | | } else { |
| | | this.startScan(); |
| | | } |
| | | // Robotaxi 场景每次都是不同车辆,直接扫描,不使用缓存 |
| | | this.startScan(); |
| | | } |
| | | |
| | | startScan() { |
| | |
| | | |
| | | wx.createBLEConnection({ |
| | | deviceId: this.state.deviceId, |
| | | timeout: 15000, // 15秒超时,鸿蒙设备可能需要更长时间 |
| | | success: () => { |
| | | log.info('RtAuth: 连接设备成功'); |
| | | this.state.connected = true; |
| | |
| | | log.debug.apply(log, arguments) |
| | | }, |
| | | info() { |
| | | console.log('[LOG]', ...arguments) |
| | | if (!log) return |
| | | log.info.apply(log, arguments) |
| | | }, |