1 line
7.9 KiB
JavaScript
1 line
7.9 KiB
JavaScript
|
|
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["BLEPages/child/H01pro"],{"1abe":function(e,t,o){"use strict";var i;o.d(t,"b",(function(){return n})),o.d(t,"c",(function(){return c})),o.d(t,"a",(function(){return i}));var n=function(){var e=this,t=e.$createElement;e._self._c},c=[]},"60a0":function(e,t,o){"use strict";o.r(t);var i=o("1abe"),n=o("e563");for(var c in n)"default"!==c&&function(e){o.d(t,e,(function(){return n[e]}))}(c);var s,a=o("f0c5"),r=Object(a["a"])(n["default"],i["b"],i["c"],!1,null,"86c31068",null,!1,i["a"],s);t["default"]=r.exports},"9aea":function(e,t,o){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i,n,c=o("26cb");function s(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,i)}return o}function a(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?s(Object(o),!0).forEach((function(t){r(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):s(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function r(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var u={data:function(){return{textW:"",textH:"",height:"",weight:"",imp:0,type:1,deviceId:"",serviceId:"",uuid1:"",uuid2:"",uuid3:"",devicesList:[],Unload:!1,isConnection:null}},computed:a(a({},(0,c.mapState)(["user","isConnected","isBluetoothTyle"])),{},{info:function(){return this.user}}),onUnload:function(){var e=this;e.Unload||(e.stopBluetoothDevicesDiscovery(),clearTimeout(n),clearTimeout(i),e.closeBLEConnection(),e.closeBluetoothAdapter(),console.log("页面返回onUnload"))},watch:{isConnected:function(){var e=this;e.isConnected||e.handleBack()},isBluetoothTyle:function(){var e=this;e.isBluetoothTyle||e.handleBack()}},onLoad:function(t){var o=this;o.textW="",o.textH="",t&&t.deviceId&&(o.deviceId=t.deviceId),o.createBLEConnection(),o.onBLEConnectionStateChange(),e.onBluetoothAdapterStateChange((function(e){o.$store.commit("changeBluetooth",e.available)}))},methods:{openBluetoothAdapter:function(){var t=this;e.openBluetoothAdapter({success:function(e){t.startBluetoothDeviceDiscovery(),console.log("初始化蓝牙成功:"+e.errMsg)},fail:function(o){t.$tools.msg("请打开蓝牙!安卓系统需打开蓝牙、定位权限;ios系统需打开设置——>应用——>微信里的蓝牙权限!"),setTimeout((function(){e.navigateBack({delta:1})}),500)}})},onBLEConnectionStateChange:function(){var t=this;e.onBLEConnectionStateChange((function(e){console.log("蓝牙连接状态",JSON.stringify(e)),t.$store.commit("changeConnected",e.connected)}))},startBluetoothDeviceDiscovery:function(){var t=this;e.startBluetoothDevicesDiscovery({allowDuplicatesKey:!0,interval:1e3,success:function(e){t.onBluetoothDeviceFound()},fail:function(t){setTimeout((function(){e.navigateBack({delta:1})}),500)}})},onBluetoothDeviceFound:function(){var t=this;e.onBluetoothDeviceFound((function(e){console.log("开始监听寻找到新设备的事件",e),e.devices.forEach((function(e){if((e.name||e.localName)&&-1!=e.name.indexOf("My")){console.log("deviceId",e),clearTimeout(n),t.stopBluetoothDevicesDiscovery();var o=e.advertisData.slice(-6);e.mac=new Uint8Array(o);var i=Array.from(e.mac);return e.macAddr=t.$tools.ab2hex(i,":").toUpperCase(),t.deviceId=e.macAddr,void t.createBLEConnection()}}))})),t.handleMyTime()},handleMyTime:function(){var t=this;n=setTimeout((function(){t.deviceId||(clearTimeout(n),t.stopBluetoothDevicesDiscovery(),e.showModal({title:"提示",content:"请确定蓝牙和手机位置信息已打开!请确定设备已开机;ios系统需打开设置——>应用——>微信里的蓝牙权限!是否继续?",cancelText:"取消",confirmText:"继续",success:function(o){o.confirm?(console.log("连接设备重新测量"),t.startBluetoothDeviceDiscovery()
|