You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
5.6 KiB
1 line
5.6 KiB
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-demo-blue"],{2569:function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"c",(function(){return i})),n.d(e,"a",(function(){}));var o=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("v-uni-view",{staticClass:"demo_index_page"},[n("v-uni-view",{staticClass:"page_content"},[n("v-uni-view",{staticClass:"margin-lr-30"},[n("v-uni-button",{staticClass:"jc-avatar-200 bg-main text-center text-32 text-ff",staticStyle:{"line-height":"200rpx"},on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.startSearchBlooth.apply(void 0,arguments)}}},[t._v("开始搜索蓝牙")]),n("v-uni-button",{staticClass:"margin-top-30 line-height-90 radius-10 bg-auxiliary text-28 text-ff",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.stop.apply(void 0,arguments)}}},[t._v("停止搜索设备")]),n("v-uni-button",{staticClass:"margin-top-30 line-height-90 radius-10 bg-auxiliary text-28 text-ff",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.getDevices.apply(void 0,arguments)}}},[t._v("获取已发现设备")]),n("v-uni-button",{staticClass:"margin-top-30 line-height-90 radius-10 bg-auxiliary text-28 text-ff",on:{click:function(e){arguments[0]=e=t.$handleEvent(e),t.getDevices1.apply(void 0,arguments)}}},[t._v("获取已连接设备1")])],1)],1)],1)},i=[]},"6a5a":function(t,e,n){"use strict";(function(t){n("7a82"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,n("d3b7");var o={isAuth:function(){return new Promise((function(t,e){}))},init:function(){return new Promise((function(e,n){uni.openBluetoothAdapter({success:function(n){t("log","--初始化蓝牙成功--",n," at components/hzjc/utils/functions/bluetooth.js:62"),e(n)},fail:function(e){t("log","--初始化蓝牙失败--",e," at components/hzjc/utils/functions/bluetooth.js:66"),n(e)}})}))},startDiscovery:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return new Promise((function(n,o){uni.startBluetoothDevicesDiscovery({services:e,success:function(e){t("log","--开始搜寻附近的蓝牙外围设备成功--",e," at components/hzjc/utils/functions/bluetooth.js:84"),n(e)},fail:function(e){t("log","--开始搜寻附近的蓝牙外围设备失败--",e," at components/hzjc/utils/functions/bluetooth.js:88"),o(e)}})}))},stopDiscovery:function(){return new Promise((function(e,n){uni.stopBluetoothDevicesDiscovery({success:function(n){t("log","--停止搜寻附近的蓝牙外围设备成功--",n," at components/hzjc/utils/functions/bluetooth.js:105"),e(n)},fail:function(e){t("log","--停止搜寻附近的蓝牙外围设备失败--",e," at components/hzjc/utils/functions/bluetooth.js:109"),n(e)}})}))},getDevices:function(){return new Promise((function(e,n){uni.getBluetoothDevices({success:function(n){t("log","--获取在蓝牙模块生效期间所有已发现的蓝牙设备成功--",n," at components/hzjc/utils/functions/bluetooth.js:125"),e(n)},fail:function(e){t("log","--获取在蓝牙模块生效期间所有已发现的蓝牙设备失败--",e," at components/hzjc/utils/functions/bluetooth.js:129"),n(e)}})}))}},i=o;e.default=i}).call(this,n("0de9")["log"])},c170:function(t,e,n){"use strict";n.r(e);var o=n("2569"),i=n("f061");for(var u in i)["default"].indexOf(u)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(u);var c=n("f0c5"),a=Object(c["a"])(i["default"],o["b"],o["c"],!1,null,"f8c51744",null,!1,o["a"],void 0);e["default"]=a.exports},c7c5:function(t,e,n){"use strict";(function(t){n("7a82");var o=n("4ea4").default;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0,n("d3b7"),n("159b"),n("d81d"),n("ace4"),n("5cc6"),n("907a"),n("9a8c"),n("a975"),n("735e"),n("c1ac"),n("d139"),n("3a7b"),n("986a"),n("1d02"),n("d5d6"),n("82f8"),n("e91f"),n("60bd"),n("5f96"),n("3280"),n("3fcc"),n("ca91"),n("25a1"),n("cd26"),n("3c5d"),n("2954"),n("649e"),n("219c"),n("b39a"),n("72f7"),n("fb6a"),n("d401"),n("25f0");var i=o(n("6a5a")),u={data:function(){return{}},onReady:function(){t("log",2222," at pages/demo/blue.vue:29")},methods:{startSearchBlooth:function(){i.default.isAuth().then((function(e){i.default.init().then((function(e){t("log",1,e," at pages/demo/blue.vue:38"),i.default.startDiscovery().then((function(e){t("log",3,e," at pages/demo/blue.vue:41"),uni.onBluetoothDeviceFound((function(e){e.devices.forEach((function(e,n){t("log",e.name," at pages/demo/blue.vue:45"),t("log",e.deviceId," at pages/demo/blue.vue:46"),"76:8B:A0:B6:C3:BC"!=e.deviceId&&"76:8b:a0:b6:c3:bc"!=e.deviceId||(t("log","-------------------++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"," at pages/demo/blue.vue:48"),t("log",e," at pages/demo/blue.vue:49"))}))}))})).catch((function(e){t("log",4,e," at pages/demo/blue.vue:54")}))})).catch((function(e){t("log",2,e," at pages/demo/blue.vue:57"),uni.onBluetoothAdapterStateChange((function(e){t("log",e,"--监听状态改变--"," at pages/demo/blue.vue:60")}))}))}))},getDevices:function(){uni.getBluetoothDevices({success:function(e){t("log",e,999999," at pages/demo/blue.vue:69")}})},ab2hex:function(t){var e=Array.prototype.map.call(new Uint8Array(t),(function(t){return("00"+t.toString(16)).slice(-2)}));return e.join("")},getDevices1:function(){uni.getConnectedBluetoothDevices({success:function(e){t("log",e.devices,8888," at pages/demo/blue.vue:91"),e.devices[0]&&t("log",this.ab2hex(e.devices[0].advertisData)," at pages/demo/blue.vue:93")}})},stop:function(){i.default.stopDiscovery()}}};e.default=u}).call(this,n("0de9")["log"])},f061:function(t,e,n){"use strict";n.r(e);var o=n("c7c5"),i=n.n(o);for(var u in o)["default"].indexOf(u)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(u);e["default"]=i.a}}]); |