(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/bluetooth/bluetooth"],{"0e29":function(e,t,n){"use strict";var o=n("4bb8"),a=n.n(o);a.a},2564:function(e,t,n){"use strict";(function(e){n("4518");o(n("66fd"));var t=o(n("923a"));function o(e){return e&&e.__esModule?e:{default:e}}e(t.default)}).call(this,n("543d")["createPage"])},"4bb8":function(e,t,n){},7821:function(e,t,n){"use strict";n.r(t);var o=n("83a4"),a=n.n(o);for(var c in o)"default"!==c&&function(e){n.d(t,e,(function(){return o[e]}))}(c);t["default"]=a.a},"83a4":function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n("c5c3"),a=getApp(),c={data:function(){return{scanList:null}},components:{},props:{},onLoad:function(t){e.onBluetoothAdapterStateChange((function(e){})),this.scanDevices()},onPullDownRefresh:function(){e.stopPullDownRefresh(),"android"==a.globalData.platform&&e.stopBluetoothDevicesDiscovery({success:function(e){}}),this.scanDevices()},onUnload:function(){e.stopBluetoothDevicesDiscovery({success:function(e){}}),e.closeBluetoothAdapter({success:function(e){}})},methods:{scanDevices:function(){e.showLoading({title:"扫描中...",mask:!0});var t=this;o.scanDevices((function(n){if(!n.isBluetoothAvailable)return e.hideLoading(),void e.showModal({content:"请打开蓝牙",showCancel:!1,success:function(t){t.confirm&&e.navigateBack({delta:1})}});var o=n.scanList;if(0==o.length)return e.hideLoading(),void e.showModal({content:"未获取到设备信息，请靠近设备再试",showCancel:!1,success:function(t){t.confirm&&e.navigateBack({delta:1})}});e.hideLoading();for(var c=new Array,s=a.globalData.device_list,i=0;i<o.length;i++)for(var r=0;r<s.length;r++)o[i].name==s[r].dev_sn&&(o[i]["name"]=s[r].dev_name,o[i]["wxapp_ekey"]=s[r].wxapp_ekey,c.push(o[i]));if(0==c.length)return e.hideLoading(),void e.showModal({content:"未获取到授权设备",showCancel:!1,success:function(t){t.confirm&&e.navigateBack({delta:1})}});t.setData({scanList:c})}))},openDoor:function(t){e.showLoading({title:"开门中...",mask:!0});var n=t.currentTarget.dataset.deviceid,a=t.currentTarget.dataset.wxapp_ekey;console.info(n+"="+a),o.openDoor(n,a,(function(t){e.hideLoading(),console.log("----res.errCode:",t.errCode),0===t.errCode||10008===t.errCode?e.showToast({title:"开门成功",icon:"success"}):e.showToast({title:"开门失败,错误码："+t.errCode})}))}}};t.default=c}).call(this,n("543d")["default"])},"923a":function(e,t,n){"use strict";n.r(t);var o=n("d3f4"),a=n("7821");for(var c in a)"default"!==c&&function(e){n.d(t,e,(function(){return a[e]}))}(c);n("0e29");var s,i=n("f0c5"),r=Object(i["a"])(a["default"],o["b"],o["c"],!1,null,null,null,!1,o["a"],s);t["default"]=r.exports},d3f4:function(e,t,n){"use strict";var o;n.d(t,"b",(function(){return a})),n.d(t,"c",(function(){return c})),n.d(t,"a",(function(){return o}));var a=function(){var e=this,t=e.$createElement,n=(e._self._c,e.$isEmpty(e.scanList));e.$mp.data=Object.assign({},{$root:{m0:n}})},c=[]}},[["2564","common/runtime","common/vendor"]]]);