kitchendDevice/unpackage/dist/build/mp-weixin/components/bluetooth.js

11 lines
9.0 KiB
JavaScript
Raw Normal View History

2025-09-04 17:33:41 +08:00
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["components/bluetooth"],{"028a":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,"6c3a"))}},n=function(){var t=this.$createElement;this._self._c},s=[]},"0bde":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=requirePlugin("sdkPlugin").AiLink,u={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;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?r(Object(i),!0).forEach((function(e){(0,c.default)(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):r(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({},(0,a.mapState)(["user","isConnected","isBluetoothTyle"])),mounted:function(){var e=this;console.log("mounted_new",e.weightType),e.openBluetoothAdapter(),e.onBLEConnectionStateChange(),t.onBluetoothAdapterStateChange((function(t){e.$store.commit("changeBluetooth",t.available)}))},destroyed:function(){this.isConnection=1,this.closeBLEConnection(),this.closeBluetoothAdapter()},watch:{isBluetoothTyle:function(){this.isBluetoothTyle||this.handleBack()},isLast:function(){this.stopblue=this.isLast,console.log("最后",this.isLast)}},methods:{openBluetoothAdapter:function(){var e=this;e.weight="",e.kcal="",t.openBluetoothAdapter({success:function(t){e.isConnection=0,e.startBluetoothDeviceDiscovery()},fail:function(t){e.isConnection=1,console.log("openBluetoothAdapter",t),e.$tools.msg("请确定设备是开机状态、手机蓝牙权限已打开!")}})},startBluetoothDeviceDiscovery:function(){var e=this;t.startBluetoothDevicesDiscovery({allowDuplicatesKey:!0,services:[],success:function(t){e.isConnection=0,e.onBluetoothDeviceFound()},fail:function(t){e.isConnection=1,console.log("startBluetoothDeviceDiscovery",t),e.$tools.msg("请确定设备是开机状态、手机蓝牙权限已打开!")}})},onBLEConnectionStateChange:function(){var e=this;t.onBLEConnectionStateChange((function(t){console.log("监听蓝牙连接状态",t.connected),t.connected||(e.isConnection=1,e.closeBLEConnection(),e.closeBluetoothAdapter()),e.$store.commit("changeConnected",t.connected)}))},stopBluetoothDevicesDiscovery:function(){t.stopBluetoothDevicesDiscovery({success:function(t){console.log("停止搜索蓝牙设备",t)}})},onBluetoothDeviceFound:function(){var e=this;e.isConnection=0,t.onBluetoothDeviceFound((function(t){t.devices.forEach((function(t){t.advertisData=t.advertisData?t.advertisData:"",t.advertisServiceUUIDs=t.advertisServiceUUIDs?t.advertisServiceUUIDs:"";var i=e.$tools.ab2hex(t.advertisData,""),o=i.substring(0,4);if(t.name||t.localName)if(-1!==t.name.indexOf("EL")&&""!=t.advertisServiceUUIDs){e.isConnection=3;e.$tools.ab2hex(t.advertisData);var n=h.parseBroadcastData(t.advertisData),s=h.analyzeBroadcastScaleData(n);s.text,s.data;if(1==n.status){var c=n.payload,a=parseInt(c[3]).toString(16);console.log("data"+a);var r=parseInt(c[4]).toString(16),u=parseInt(a+r,16),l=parseInt(c[5]).toString(16),g=l.length>1?l.substring(1,2):l,d=parseInt(l.substring(0,1),16).toString(8),f=d.toString().substring(0,1),v=0;d.toString().length>1&&(f=d.toString().substring(1,2),v=d.toString().substring(0,1)),"0"=
;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
'components/bluetooth-create-component',
{
'components/bluetooth-create-component':(function(module, exports, __webpack_require__){
__webpack_require__('df3c')['createComponent'](__webpack_require__("6b13"))
})
},
[['components/bluetooth-create-component']]
]);