qcloud-iotexplorer-bluetooth-adapter
Advanced tools
Comparing version 0.8.2 to 0.8.4
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BlueToothAdapter4H5=void 0;var tslib_1=require("tslib"),base_1=require("../base"),BlueToothBridge_1=require("./BlueToothBridge"),BlueToothAdapter4H5=function(e){function t(t){var o=t.h5Websocket,n=t.devMode,i=t.actions,r=tslib_1.__rest(t,["h5Websocket","devMode","actions"]),c=this,s=new BlueToothBridge_1.BlueToothBridge({h5Websocket:o});return(c=e.call(this,tslib_1.__assign({actions:tslib_1.__assign({registerDevice:function(e){var t=e.deviceName,o=e.productId;return tslib_1.__awaiter(c,void 0,void 0,(function(){return tslib_1.__generator(this,(function(e){switch(e.label){case 0:return[4,s.control("registryDevice",{deviceName:t,productId:this.devMode?o:""})];case 1:return e.sent(),[2]}}))}))},bindDevice:function(e){var t=e.deviceName,o=e.productId;return tslib_1.__awaiter(c,void 0,void 0,(function(){return tslib_1.__generator(this,(function(e){switch(e.label){case 0:return[4,s.control("bindDevice",{deviceName:t,productId:this.devMode?o:""})];case 1:return e.sent(),[2]}}))}))}},i),devMode:n,h5Websocket:o,bluetoothApi:s},r))||this)._onDeviceFoundThrottle=0,c._blueToothBridge=s,c._h5Websocket.on("connect",(function(){c.syncDeviceConnectStatus()})),c._h5Websocket.on("message",(function(e){e&&"connect"===e.action&&c.syncDeviceConnectStatus()})),c}return tslib_1.__extends(t,e),t.prototype.onBluetoothDeviceFound=function(e){var t=(void 0===e?{}:e).devices;return tslib_1.__awaiter(this,void 0,void 0,(function(){return tslib_1.__generator(this,(function(e){switch(e.label){case 0:return t?[3,2]:[4,this.getBluetoothDevices()];case 1:return t=e.sent(),console.log("onBluetoothDeviceFound from getBluetoothDevices",t),[3,3];case 2:console.log("onBluetoothDeviceFound from mp event",t),e.label=3;case 3:try{"function"==typeof this._onBluetoothDeviceFoundHandler&&this._onBluetoothDeviceFoundHandler(t)}catch(e){console.error("_onBluetoothDeviceFoundHandler error",e)}return[2,t]}}))}))},t.prototype.syncDeviceConnectStatus=function(){var e=this._deviceAdapterStore.getAll().filter((function(e){return e.isConnected})).map((function(e){return{deviceId:e.deviceId,connected:e.isConnected}}));e.length&&this._blueToothBridge.control("syncDeviceConnectStatus",{devices:e})},t}(base_1.BlueToothAdapter);exports.BlueToothAdapter4H5=BlueToothAdapter4H5; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BlueToothAdapter4H5=void 0;var tslib_1=require("tslib"),base_1=require("../base"),BlueToothBridge_1=require("./BlueToothBridge"),BlueToothAdapter4H5=function(e){function t(t){var o=t.h5Websocket,n=t.devMode,i=t.actions,r=tslib_1.__rest(t,["h5Websocket","devMode","actions"]),c=this,s=new BlueToothBridge_1.BlueToothBridge({h5Websocket:o});return c=e.call(this,tslib_1.__assign({actions:tslib_1.__assign({registerDevice:function(e){var t=e.deviceName,o=e.productId;return tslib_1.__awaiter(c,void 0,void 0,(function(){return tslib_1.__generator(this,(function(e){switch(e.label){case 0:return[4,s.control("registryDevice",{deviceName:t,productId:this.devMode?o:""})];case 1:return e.sent(),[2]}}))}))},bindDevice:function(e){var t=e.deviceName,o=e.productId;return tslib_1.__awaiter(c,void 0,void 0,(function(){return tslib_1.__generator(this,(function(e){switch(e.label){case 0:return[4,s.control("bindDevice",{deviceName:t,productId:this.devMode?o:""})];case 1:return e.sent(),[2]}}))}))}},i),devMode:n,h5Websocket:o,bluetoothApi:s},r))||this,c._onDeviceFoundThrottle=0,c._blueToothBridge=s,c._h5Websocket.on("connect",(function(){c.syncDeviceConnectStatus()})),c._h5Websocket.on("message",(function(e){e&&"connect"===e.action&&c.syncDeviceConnectStatus()})),c}return tslib_1.__extends(t,e),t.prototype.onBluetoothDeviceFound=function(e){var t=(void 0===e?{}:e).devices;return tslib_1.__awaiter(this,void 0,void 0,(function(){return tslib_1.__generator(this,(function(e){switch(e.label){case 0:return t?[3,2]:[4,this.getBluetoothDevices()];case 1:return t=e.sent(),console.log("onBluetoothDeviceFound from getBluetoothDevices",t),[3,3];case 2:console.log("onBluetoothDeviceFound from mp event",t),e.label=3;case 3:try{"function"==typeof this._onBluetoothDeviceFoundHandler&&this._onBluetoothDeviceFoundHandler(t)}catch(e){console.error("_onBluetoothDeviceFoundHandler error",e)}return[2,t]}}))}))},t.prototype.syncDeviceConnectStatus=function(){var e=this._deviceAdapterStore.getAll().filter((function(e){return e.isConnected})).map((function(e){return{deviceId:e.deviceId,connected:e.isConnected}}));e.length&&this._blueToothBridge.control("syncDeviceConnectStatus",{devices:e})},t}(base_1.BlueToothAdapter);exports.BlueToothAdapter4H5=BlueToothAdapter4H5; | ||
//# sourceMappingURL=BlueToothAdapter4H5.js.map |
{ | ||
"name": "qcloud-iotexplorer-bluetooth-adapter", | ||
"version": "0.8.2", | ||
"version": "0.8.4", | ||
"description": "", | ||
@@ -17,6 +17,6 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"event-emitter-for-miniprogram": "^0.8.2", | ||
"event-emitter-for-miniprogram": "^0.8.4", | ||
"lodash.uniqwith": "^4.5.0", | ||
"qcloud-iotexplorer-appdev-sdk": "^1.9.2", | ||
"qcloud-iotexplorer-common-libs": "^0.9.2", | ||
"qcloud-iotexplorer-appdev-sdk": "^1.9.4", | ||
"qcloud-iotexplorer-common-libs": "^0.9.4", | ||
"tslib": "^2.0.1" | ||
@@ -27,3 +27,3 @@ }, | ||
}, | ||
"gitHead": "902a3ca640cb46524c3f7a1e9f66897db59be629" | ||
"gitHead": "f906e1b31dc7039d72c1f73b498e7a2ea465522f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
180632