Browse Source

feature: 对页16进制与10进制切换方法类修改名称

332777428@qq.com 4 months ago
parent
commit
5d0d2f7df0
2 changed files with 6 additions and 6 deletions
  1. 6 6
      devices/ble_manager.js
  2. 0 0
      utils/hexUtil.js

+ 6 - 6
devices/ble_manager.js

@@ -58,14 +58,14 @@ class bleManager {
   ///监听搜索设备列表 监听设备列表
   getBluetoothDevices() {
     var that = this;
-    const hex_util = require('./../utils/hex_util');
+    const hexUtil = require('../utils/hexUtil');
     wx.onBluetoothDeviceFound(function (res) {
       // console.log("蓝牙设备列表", res.length);
       ///第一种情况
       if (res.deviceId) {
         if (that.callBackConnect != null) {
           if (that.connectWillDevice != null && res.name == that.connectWillDevice.clientType) {
-            res.mac = res.advertisData ? hex_util.buf2hex(res.advertisData) : '';
+            res.mac = res.advertisData ? hexUtil.buf2hex(res.advertisData) : '';
             // if (that.callBackConnect != null) {
             console.log("1111", res.mac);
             if (that.callBackConnect != null) {
@@ -102,7 +102,7 @@ class bleManager {
             //   console.log("2222", temp.name);
             // }
             if (that.connectWillDevice != null && temp.name == that.connectWillDevice.clientType) {
-              temp.mac = temp.advertisData ? hex_util.buf2hex(temp.advertisData) : '';
+              temp.mac = temp.advertisData ? hexUtil.buf2hex(temp.advertisData) : '';
               temp.mac2 = that.ab2hex(temp.advertisData ?? "")
 
               // if (that.testData(temp)) {
@@ -143,7 +143,7 @@ class bleManager {
       else if (res[0]) {
         if (that.callBackConnect != null) {
           if (that.connectWillDevice != null && res[0].name == that.connectWillDevice.clientType) {
-            res[0].mac = res[0].advertisData ? hex_util.buf2hex(res[0].advertisData) : '';
+            res[0].mac = res[0].advertisData ? hexUtil.buf2hex(res[0].advertisData) : '';
             // if (that.callBackConnect != null) {
             console.log("3333", res.mac);
             if (that.callBackConnect != null) {
@@ -221,7 +221,7 @@ class bleManager {
   ///获取 所有搜索到的蓝牙设备
   getConnectedDevices() {
     var that = this;
-    const hex_util = require('./../utils/hex_util');
+    const hexUtil = require('../utils/hexUtil');
 
     // wx.getConnectedBluetoothDevices({
     //   // services: ['ab00'],
@@ -248,7 +248,7 @@ class bleManager {
           for (var i = 0; i < res.devices.length; i++) {
             var temp = res.devices[i];
             if (that.connectWillDevice != null && temp.name == that.connectWillDevice.clientType) {
-              temp.mac = temp.advertisData ? hex_util.buf2hex(temp.advertisData) : '';
+              temp.mac = temp.advertisData ? hexUtil.buf2hex(temp.advertisData) : '';
               if (temp.mac) {
                 console.log("搜索到的" + JSON.stringify(temp));
               }

utils/hex_util.js → utils/hexUtil.js