(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["components/bluetooth"],{"0a71":function(t,e,i){"use strict";i.r(e);var o=i("4a3c"),n=i("3af2");for(var s in n)["default"].indexOf(s)<0&&function(t){i.d(e,t,(function(){return n[t]}))}(s);i("f71c");var c=i("828b"),a=Object(c["a"])(n["default"],o["b"],o["c"],!1,null,"62068ec0",null,!1,o["a"],void 0);e["default"]=a.exports},"3af2":function(t,e,i){"use strict";i.r(e);var o=i("7fc9"),n=i.n(o);for(var s in o)["default"].indexOf(s)<0&&function(t){i.d(e,t,(function(){return o[t]}))}(s);e["default"]=n.a},"4a3c":function(t,e,i){"use strict";i.d(e,"b",(function(){return n})),i.d(e,"c",(function(){return s})),i.d(e,"a",(function(){return o}));var o={uniIcons:function(){return Promise.all([i.e("common/vendor"),i.e("uni_modules/uni-icons/components/uni-icons/uni-icons")]).then(i.bind(null,"5de9"))}},n=function(){var t=this.$createElement;this._self._c},s=[]},"7fc9":function(t,e,i){"use strict";(function(t){var o=i("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=o(i("7eb4")),s=o(i("ee10")),c=o(i("7ca3")),a=i("8f59");function r(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,o)}return i}var h={data:function(){return{dw:"g",kcal:"",weight:"",weightALL:"",unit:"",weight0:0,stopblue:!1,isConnection:0,units:["kg","斤","st:lb","lb","g","ml","Waterml","milkml","oz","floz","lboz"]}},props:{weightKcal:{type:Number,default:0},weightType:{type:Number,default:-1},isLast:{type:Boolean,default:!1}},computed:function(t){for(var e=1;e1?u.substring(1,2):u,g=parseInt(u.substring(0,1),16).toString(8),d=g.toString().substring(0,1),f=0;g.toString().length>1&&(d=g.toString().substring(1,2),f=g.toString().substring(0,1)),"0"==l&&(e.dw="g"),"7"==l&&(e.dw="ml"),"3"==l&&(e.dw="oz"),"2"==l&&(e.dw="lb'oz"),"1"==d&&(h/=10),"2"==d&&(h/=100),"0"==f&&(h=h),"1"==f&&(h="-"+h),e.weight=h,e.kcal=(Number(e.weightKcal)/100*h).toFixed(2),console.log("analyzeData",a.weight,h)}}else-1==t.name.indexOf("Chipsea-BLE")&&-1==t.localName.indexOf("Chipsea-BLE")&&"a5fe"!=o||(e.stopBluetoothDevicesDiscovery(),e.connectDevice(t.deviceId))}))}))},connectDevice:function(e){var i=this;return(0,s.default)(n.default.mark((function o(){var s;return n.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:s=i,t.createBLEConnection({deviceId:e,success:function(t){setTimeout((function(){s.getBLEDeviceServices(e)}),200)},fail:function(t){console.log("设备连接失败,请重新连接",t)}});case 2:case"end":return o.stop()}}),o)})))()},getBLEDeviceServices:function(e){var i=[],o=this;t.getBLEDeviceServices({deviceId:e,success:function(t){console.log("获取设备的UUID成功",t),i=t.services;for(var n=0;n>4,c=15&n,a=o/Math.pow(10,s);i&&(a=-a),this.weight=a,this.dw=this.units[c]||"g",this.kcal=(Number(this.weightKcal)/100*a).toFixed(2)},handlesub:function(){console.log("weight",this.weight),Number(this.weight)>0?(this.$emit("handleBle",this.weight,this.dw,this.kcal),this.stopBluetoothDevicesDiscovery(),this.closeBLEConnection(),this.closeBluetoothAdapter()):this.$tools.msg("数据异常,请清零后重新测量!")},handleDetailSub:function(){1==this.weightType?(this.weight0=Number((Number(this.weight)-Number(this.weightALL)).toFixed(2)),this.weight0>0?this.weightALL=this.weight:this.$tools.msg("数据异常,请清零后重新测量!")):this.weight0=this.weight,Number(this.weight0)>0?(this.$emit("handleDetailSub",this.weight0,this.dw,this.kcal),this.weight=0,this.weight0=0):this.$tools.msg("数据异常,请重新测量!")},handleDetailNext:function(){1==this.weightType?(console.log("weight:"+this.weight),console.log("weight0:"+this.weight0),console.log("weightALL:"+this.weightALL),this.weight0=Number((Number(this.weight)-Number(this.weightALL)).toFixed(2)),this.weight0>0?this.weightALL=this.weight:this.$tools.msg("数据异常,请清零后重新测量!")):this.weight0=this.weight,Number(this.weight0)>0?(this.$emit("handleDetailNext",this.weight0,this.dw,this.kcal),this.weight=0,this.weight0=0):this.$tools.msg("数据异常,请清零后重新测量!")},handlechongzhi:function(t){console.log("当前总重:"+this.weightALL),console.log("重置重量:"+t),1==this.weightType&&(this.weightALL=Number((Number(this.weightALL)-Number(t)).toFixed(2)),console.log("剩余重量:"+this.weightALL))},handleBack:function(){this.isConnection=1,this.stopBluetoothDevicesDiscovery(),this.closeBLEConnection(),this.closeBluetoothAdapter()},closeBluetoothAdapter:function(){t.closeBluetoothAdapter({success:function(t){console.log("蓝牙模块关闭成功")}})},closeBLEConnection:function(){t.closeBLEConnection({deviceId:this.deviceId,success:function(t){console.log("断开蓝牙连接成功")}})}}};e.default=h}).call(this,i("df3c")["default"])},b7d8:function(t,e,i){},f71c:function(t,e,i){"use strict";var o=i("b7d8"),n=i.n(o);n.a}}]); ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([ 'components/bluetooth-create-component', { 'components/bluetooth-create-component':(function(module, exports, __webpack_require__){ __webpack_require__('df3c')['createComponent'](__webpack_require__("0a71")) }) }, [['components/bluetooth-create-component']] ]);