(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/search/devType"],{"054f":function(e,t,o){"use strict";var n=o("4007"),c=o.n(n);c.a},4007:function(e,t,o){},"7a41":function(e,t,o){"use strict";o.r(t);var n=o("f1f8"),c=o("7dbd");for(var i in c)"default"!==i&&function(e){o.d(t,e,(function(){return c[e]}))}(i);o("054f");var s,r=o("f0c5"),a=Object(r["a"])(c["default"],n["b"],n["c"],!1,null,"8aef6236",null,!1,n["a"],s);t["default"]=a.exports},"7dbd":function(e,t,o){"use strict";o.r(t);var n=o("95ed"),c=o.n(n);for(var i in n)"default"!==i&&function(e){o.d(t,e,(function(){return n[e]}))}(i);t["default"]=c.a},"95ed":function(e,t,o){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,c,i=o("26cb");function s(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function r(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){a(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 a(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{Unload:!1,issearch:!1,isdevTip:!1,devList:[],devicesList:[]}},computed:r({},(0,i.mapState)(["user","isConnected","isBluetoothTyle","appTheme"])),onLoad:function(){n=this,e.setNavigationBarColor({frontColor:"#ffffff",backgroundColor:this.appTheme}),n.openBluetoothAdapter(),n.onBLEConnectionStateChange(),e.onBluetoothAdapterStateChange((function(e){n.$store.commit("changeBluetooth",e.available)}))},onUnload:function(){var e=this;e.Unload||(e.stopBluetoothDevicesDiscovery(),e.closeBLEConnection(),e.closeBluetoothAdapter(),console.log("搜索页返回"))},watch:{isBluetoothTyle:function(){var e=this;e.isBluetoothTyle||(e.issearch=!0,e.isdevTip=!0,e.devList=[],clearTimeout(c),e.closeBLEConnection(),e.closeBluetoothAdapter(),e.stopBluetoothDevicesDiscovery())}},methods:{openBluetoothAdapter:function(){var t=this;e.openBluetoothAdapter({success:function(e){console.log("蓝牙初始化成功"),t.issearch=!1,t.isdevTip=!1,t.devList=[],t.startBluetoothDeviceDiscovery()},fail:function(e){t.$tools.msg("请打开蓝牙！安卓系统需打开蓝牙、定位权限；ios系统需打开设置——>应用——>微信里的蓝牙权限！")}})},onBLEConnectionStateChange:function(){var t=this;e.onBLEConnectionStateChange((function(e){console.log("蓝牙连接状态",e.connected),t.$store.commit("changeConnected",e.connected)}))},stopBluetoothDevicesDiscovery:function(){e.stopBluetoothDevicesDiscovery({success:function(e){console.log("停止搜索蓝牙设备",e)}})},startBluetoothDeviceDiscovery:function(){var t=this;e.startBluetoothDevicesDiscovery({allowDuplicatesKey:!1,success:function(e){t.onBluetoothDeviceFound()},fail:function(e){t.$tools.msg("请打开蓝牙！安卓系统需打开蓝牙、定位权限；ios系统需打开设置——>应用——>微信里的蓝牙权限！")}})},onBluetoothDeviceFound:function(){var t=this;e.onBluetoothDeviceFound((function(e){e.devices.forEach((function(e){if(e.name||e.localName){console.log("设备列表",e);var o="";o=-1!==e.name.indexOf("ELK")&&-1!==e.advertisServiceUUIDs[0].indexOf("F0A0")?e.advertisData.slice(0,8):e.advertisData.slice(-6),e.mac=new Uint8Array(o);var n=Array.from(e.mac);-1==e.name.indexOf("My")&&n.reverse(),e.macAddr=t.$tools.ab2hex(n,":").toUpperCase();var c=t.devicesList,i=t.$tools.inArray(c,"deviceId",e.deviceId);-1===i&&(t.devicesList.push(e),""!=e.macAddr&&t.handleDevType(e.macAddr))}}))})),t.handleMyTime()},handleMyTime:function(){var e=this;c=setTimeout((function(){e.devList.length||(e.isdevTip=!0,e.devList=[]),e.issearch=!0,clearTimeout(c),e.closeBLEConnection(),e.closeBluetoothAdapter(),e.stopBluetoothDevicesDiscovery()}),3e4)},handleDevType:function(e){n=this,n.$model.getdevdetail({sn:e}).then((function(t){0==t.code&&(t.data.deviceId=e,n.devList.push(t.data))}))},handleWeight:function(e){var t=this;t.Unload=!0,clearTimeout(c),4==e.type&&5==e.type&&16==e.type||t.stopBluetoothDevicesDiscovery(),t.$tools.handlePages(e.type,e.deviceId)},closeBluetoothAdapter:function(){e.closeBluetoothAdapter({success:function(e){console.log("蓝牙模块关闭成功")}})},closeBLEConnection:function(){e.closeBLEConnection({success:function(e){console.log("断开蓝牙连接成功")}})}}};t.default=u}).call(this,o("543d")["default"])},d18e:function(e,t,o){"use strict";(function(e){o("e568");n(o("66fd"));var t=n(o("7a41"));function n(e){return e&&e.__esModule?e:{default:e}}wx.__webpack_require_UNI_MP_PLUGIN__=o,e(t.default)}).call(this,o("543d")["createPage"])},f1f8:function(e,t,o){"use strict";var n;o.d(t,"b",(function(){return c})),o.d(t,"c",(function(){return i})),o.d(t,"a",(function(){return n}));var c=function(){var e=this,t=e.$createElement;e._self._c},i=[]}},[["d18e","common/runtime","common/vendor"]]]);