1 line
8.4 KiB
JavaScript
1 line
8.4 KiB
JavaScript
|
|
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["BLEPages/adult/H09B"],{"0e4e":function(e,t,n){"use strict";var o;n.d(t,"b",(function(){return i})),n.d(t,"c",(function(){return c})),n.d(t,"a",(function(){return o}));var i=function(){var e=this,t=e.$createElement;e._self._c},c=[]},8143:function(e,t,n){"use strict";n.r(t);var o=n("0e4e"),i=n("caa5");for(var c in i)"default"!==c&&function(e){n.d(t,e,(function(){return i[e]}))}(c);var s,r=n("f0c5"),a=Object(r["a"])(i["default"],o["b"],o["c"],!1,null,"07eec542",null,!1,o["a"],s);t["default"]=a.exports},"94d0":function(e,t,n){"use strict";(function(e){n("0d2f");o(n("66fd"));var t=o(n("8143"));function o(e){return e&&e.__esModule?e:{default:e}}wx.__webpack_require_UNI_MP_PLUGIN__=n,e(t.default)}).call(this,n("543d")["createPage"])},c527:function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o,i=n("26cb");function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a={data:function(){return{text:"",textH:"",height:"",weight:"",imp:0,type:1,uuid1:"",uuid2:"",uuid3:"",macAddr:"",deviceId:"",serviceId:"",Unload:!1,isConnection:0}},computed:s(s({},(0,i.mapState)(["user","isConnected","isBluetoothTyle"])),{},{info:function(){return this.user}}),onUnload:function(){var e=this;e.Unload||(e.stopBluetoothDevicesDiscovery(),clearTimeout(o),e.closeBLEConnection(),e.closeBluetoothAdapter())},onLoad:function(t){var n=this;n.text="",n.textH="",n.imp=0,t&&t.deviceId&&(n.macAddr=t.deviceId,n.deviceId=t.deviceId,n.createBLEConnection()),n.onBLEConnectionStateChange(),e.onBluetoothAdapterStateChange((function(e){n.$store.commit("changeBluetooth",e.available)}))},watch:{isConnected:function(){var e=this;e.isConnected||(e.handleBack(),e.isConnection=2)},isBluetoothTyle:function(){var e=this;e.isBluetoothTyle||(e.handleBack(),e.isConnection=2)}},methods:{openBluetoothAdapter:function(){var t=this;t.type=1,e.openBluetoothAdapter({success:function(e){t.isConnection=0,t.startBluetoothDeviceDiscovery()},fail:function(e){t.isConnection=2,t.$tools.msg("请确定设备是开机状态、手机蓝牙权限已打开!")}})},startBluetoothDeviceDiscovery:function(){var t=this;e.startBluetoothDevicesDiscovery({allowDuplicatesKey:!1,interval:500,services:["FFE0"],success:function(e){t.isConnection=0,t.onBluetoothDeviceFound()},fail:function(e){t.isConnection=2,t.$tools.msg("请确定设备是开机状态、手机蓝牙权限已打开!")}})},onBluetoothDeviceFound:function(){var t=this;t.isConnection=0,e.onBluetoothDeviceFound((function(e){e.devices.forEach((function(e){if((e.name||e.localName)&&-1!=e.deviceId.indexOf(t.deviceId)){t.stopBluetoothDevicesDiscovery(),clearTimeout(o);var n=e.advertisData.slice(-6);e.mac=new Uint8Array(n);var i=Array.from(e.mac);return i.reverse(),e.macAddr=t.$tools.ab2hex(i,":").toUpperCase(),t.macAddr=e.macAddr,t.deviceId=e.deviceId,void t.createBLEConnection()}}))})),t.handleMyTime()},handleMyTime:function(){var e=this;o=setTimeout((function(){e.macAddr||(clearTimeout(o),e.Unload=!0,e.isConnection=2,e.closeBLEConnection(),e.closeBluetoothAdapter())}),2e4)},stopBluetoothDevicesDiscovery:function(){e.stopBluetoothDevicesDiscovery({success:function(e){console.log("停止搜索蓝牙设备",e)}})},onBLEConnectionStateChange:function(){var t=this;e.onBLEConnectionStateChange((function(e){console.log("监听蓝牙连接状态",e.connected),e.connected||(t.Unload=!0,t.isConnection=2,clearTime
|