Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

qcloud-iotexplorer-appdev-plugin-wificonf-softap

Package Overview
Dependencies
Maintainers
5
Versions
167
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

qcloud-iotexplorer-appdev-plugin-wificonf-softap - npm Package Compare versions

Comparing version 1.9.0 to 1.9.2

2

lib/softap/index.js

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SoftAp=void 0;var tslib_1=require("tslib"),qcloud_iotexplorer_appdev_plugin_wificonf_core_1=require("qcloud-iotexplorer-appdev-plugin-wificonf-core"),qcloud_iotexplorer_appdev_sdk_1=require("qcloud-iotexplorer-appdev-sdk"),WifiConfErrorMsg=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.constants.WifiConfErrorMsg,WifiConfStepCode=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.constants.WifiConfStepCode,UdpServer=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.utils.UdpServer,reconnectWifi=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.utils.reconnectWifi,tryRequest=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.utils.tryRequest,connectWifi=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.utils.connectWifi,getConnectedWifi=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.utils.getConnectedWifi,SoftAp=function(e){function o(o,t){var i=e.call(this,o,t)||this;return i.udpAddress="192.168.4.1",i.udpPort=8266,i.connectAborted=!1,i.udpAddress=i.options.udpAddress||i.udpAddress,i.udpPort=i.options.udpPort||i.udpPort,i}return tslib_1.__extends(o,e),o.prototype.start=function(e){var o=void 0===e?{}:e,t=o.doNotRetry,i=void 0!==t&&t,r=o.isUdpRetry,n=void 0!==r&&r;return tslib_1.__awaiter(this,void 0,void 0,(function(){var e,o,t,r=this;return tslib_1.__generator(this,(function(s){switch(s.label){case 0:n||(this.onProgress({code:WifiConfStepCode.WIFI_CONF_START}),this.onProgress({code:WifiConfStepCode.PROTOCOL_START,reportEvents:["配网"]})),e=Date.now(),console.log("come newsoftap,options:",this.options),s.label=1;case 1:return s.trys.push([1,5,,8]),this.options.softAPInfo?[4,connectWifi(this.options.softAPInfo,{onProgress:function(e){r.onProgress.call(r,e)}})]:[3,3];case 2:s.sent(),s.label=3;case 3:return[4,this.doBusiness()];case 4:return o=s.sent(),this.onProgress({code:WifiConfStepCode.WIFI_CONF_SUCCESS,detail:tslib_1.__assign({timeCost:Date.now()-e},o)}),this.onComplete(o),[3,8];case 5:return t=s.sent(),console.error(t),t&&t.code in WifiConfErrorMsg&&(t.uiMsg=WifiConfErrorMsg[t.code]),(null==t?void 0:t.udpServer)&&(null==t||t.udpServer.destroy(),delete t.udpServer),i||!this.options.autoRetry?[3,7]:[4,qcloud_iotexplorer_appdev_plugin_wificonf_core_1.issueHandler({error:t,targetWifiInfo:this.options.targetWifiInfo,softAPInfo:this.options.softAPInfo,wifiConfType:this.options.wifiConfType,onProgress:function(e){r.onProgress.call(r,e)}})];case 6:if(s.sent())return this.onProgress({code:WifiConfStepCode.WIFI_CONF_AUTO_RETRY}),[2,this.start({doNotRetry:!0,isUdpRetry:!0})];s.label=7;case 7:return this.connectAborted=!0,this.onProgress({code:WifiConfStepCode.WIFI_CONF_FAIL,detail:{error:t},reportEvents:["配网"]}),this.onError({code:"WIFI_CONF_FAIL",detail:{error:t}}),[3,8];case 8:return[2]}}))}))},o.prototype.doBusiness=function(){return tslib_1.__awaiter(this,void 0,void 0,(function(){var e,o,t,i,r,n,s=this;return tslib_1.__generator(this,(function(d){switch(d.label){case 0:return this.onProgress({code:WifiConfStepCode.CREATE_UDP_CONNECTION_START,reportEvents:["udp"]}),e=Date.now(),o=new UdpServer({address:this.udpAddress,port:this.udpPort,sdk:this.sdk,retryTime:10,retryWhenFail:!0}),t=qcloud_iotexplorer_appdev_sdk_1.AppDevSdk.utils.genPromise(),i=qcloud_iotexplorer_appdev_sdk_1.AppDevSdk.utils.genPromise(),o.onError((function(e){return t.reject({code:"UDP_ERROR",errMsg:e})})),o.onProgressError((function(e){return i.reject({code:"BUSINESS_DEVICE_ERROR",message:e})})),r=function(){return tslib_1.__awaiter(s,void 0,void 0,(function(){var t,i,r,n,s,d,c,_,a,u,p,l,f,S,v,g,C,h,I=this;return tslib_1.__generator(this,(function(E){switch(E.label){case 0:return[4,(t=function(e){return tslib_1.__awaiter(I,void 0,void 0,(function(){return tslib_1.__generator(this,(function(o){switch(o.label){case 0:return[4,qcloud_iotexplorer_appdev_sdk_1.AppDevSdk.utils.delay(e||this.options.stepInterval)];case 1:return o.sent(),this.connectAborted&&qcloud_iotexplorer_appdev_sdk_1.AppDevSdk.utils.logger.debug("connection aborted"),[2]}}))}))})()];case 1:E.sent(),this.onProgress({code:WifiConfStepCode.CREATE_UDP_CONNECTION_SUCCESS,detail:{timeCost:Date.now()-e},reportEvents:["udp"]}),this.onProgress({code:WifiConfStepCode.SOFTAP_SEND_TARGET_WIFIINFO_START,reportEvents:["ap发送wifi"]}),i=Date.now(),E.label=2;case 2:return E.trys.push([2,24,,25]),[4,o.send({cmdType:1,ssid:this.options.targetWifiInfo.SSID,password:this.options.targetWifiInfo.password,token:this.options.wifiConfToken})];case 3:switch(r=E.sent(),n=r.protoVersion,s=tslib_1.__rest(r,["protoVersion"]),n||(n="1.0"),console.log(n,"protoVersion"),this.onProgress({code:WifiConfStepCode.SOFTAP_SEND_TARGET_WIFIINFO_SUCCESS,detail:{data:s,timeCost:Date.now()-i,protoVersion:n},reportEvents:["ap发送wifi"]}),d=function(e){var o=e.useTargetWifi,t=void 0!==o&&o;return tslib_1.__awaiter(I,void 0,void 0,(function(){var e=this;return tslib_1.__generator(this,(function(o){switch(o.label){case 0:return[4,reconnectWifi(this.options.targetWifiInfo,{onProgress:function(o){e.onProgress.call(e,o)},ignoreError:!0,useTargetWifi:t})];case 1:return o.sent(),this.onProgress({code:WifiConfStepCode.PROTOCOL_SUCCESS,detail:{timeCost:Date.now()-i,protoVersion:n}}),this.onProgress({code:WifiConfStepCode.BUSINESS_START}),[2]}}))}))},c=function(){return tslib_1.__awaiter(I,void 0,void 0,(function(){var e,t,i,r=this;return tslib_1.__generator(this,(function(n){switch(n.label){case 0:return[4,d({useTargetWifi:!0})];case 1:n.sent(),e=!1,t=function(){return tslib_1.__awaiter(r,void 0,void 0,(function(){var e,t,i,r=this;return tslib_1.__generator(this,(function(n){switch(n.label){case 0:return[4,qcloud_iotexplorer_appdev_plugin_wificonf_core_1.queryTokenStateAndBind({token:this.options.wifiConfToken,productId:null==s?void 0:s.productId,deviceName:null==s?void 0:s.deviceName,familyId:this.options.familyId,roomId:this.options.roomId,onProgress:function(e){r.onProgress.call(r,e)},sdk:this.sdk,newTokenVersion:this.options.newTokenVersion})];case 1:return e=n.sent(),t=e.productId,i=e.deviceName,o.destroy(),_={productId:t,deviceName:i},[2]}}))}))},function(){return tslib_1.__awaiter(r,void 0,void 0,(function(){var t,i,r,n,s,d=this;return tslib_1.__generator(this,(function(c){switch(c.label){case 0:return[4,getConnectedWifi()];case 1:return(t=c.sent())&&t.SSID===(null===(r=null===(i=this.options)||void 0===i?void 0:i.targetWifiInfo)||void 0===r?void 0:r.SSID)&&(null===(s=null===(n=null==this?void 0:this.sdk)||void 0===n?void 0:n.reporter)||void 0===s||s.info({code:"Start_Check_Device_Connect_Target_Wifi_By_UDP"}),o.onMessage((function(t){return tslib_1.__awaiter(d,void 0,void 0,(function(){var i,r;return tslib_1.__generator(this,(function(n){return 7===t.cmdType&&(e=!0,console.log("Device_Connect_Target_Wifi_Success"),null===(r=null===(i=null==this?void 0:this.sdk)||void 0===i?void 0:i.reporter)||void 0===r||r.info({code:"Device_Connect_Target_Wifi_Success"}),o.destroy()),[2]}))}))}))),[2]}}))}))}(),n.label=2;case 2:return n.trys.push([2,4,,8]),[4,t()];case 3:return n.sent(),[3,8];case 4:return(i=n.sent())&&"BUSINESS_QUERY_BIND_TOKEN_TIMEOUT"===i.code&&!0===e?(e=!1,[4,t()]):[3,6];case 5:return n.sent(),[3,7];case 6:throw i;case 7:return[3,8];case 8:return[2]}}))}))},_={},n){case"1.0":return[3,4];case"2.0":return[3,14];case"3.0":return[3,20]}return[3,22];case 4:if("dataRecived"!==s.deviceReply)throw{code:"BUSINESS_INVALID_RESPONSE",detail:s};return[4,t(1e4)];case 5:return E.sent(),this.onProgress({code:WifiConfStepCode.SOFTAP_GET_DEVICE_SIGNATURE_START}),[4,o.send({cmdType:0,timestamp:parseInt(String(Date.now()/1e3),10)})];case 6:if(a=E.sent(),u=a.mqttState,p=a.wifiState,l=tslib_1.__rest(a,["mqttState","wifiState"]),"connected"!==u)throw{code:"BUSINESS_DEVICE_CONNECT_MQTT_FAIL"};if("connected"!==p)throw{code:"BUSINESS_DEVICE_CONNECT_WIFI_FAIL"};return this.onProgress({code:WifiConfStepCode.SOFTAP_GET_DEVICE_SIGNATURE_SUCCESS}),o.destroy(),[4,t()];case 7:return E.sent(),[4,reconnectWifi(this.options.targetWifiInfo,{onProgress:function(e){I.onProgress.call(I,e)}})];case 8:return E.sent(),[4,t()];case 9:E.sent(),this.onProgress({code:WifiConfStepCode.PROTOCOL_SUCCESS,detail:{timeCost:Date.now()-i,protoVersion:n}}),this.onProgress({code:WifiConfStepCode.BUSINESS_START}),this.onProgress({code:WifiConfStepCode.BUSINESS_ADD_DEVICE_START,detail:{data:{Signature:l.signature,DeviceTimestamp:l.timestamp,ProductId:l.productId,DeviceName:l.deviceName,ConnId:l.connId,FamilyId:this.options.familyId}}}),E.label=10;case 10:return E.trys.push([10,12,,13]),[4,tryRequest((function(){return I.sdk.requestApi("addDeviceBySigInFamily",{Signature:l.signature,DeviceTimestamp:l.timestamp,ProductId:l.productId,DeviceName:l.deviceName,ConnId:l.connId,FamilyId:I.options.familyId},{isTokenApi:!0})}),{reporter:this.sdk.reporter})];case 11:return E.sent(),[3,13];case 12:throw f=E.sent(),tslib_1.__assign(tslib_1.__assign({},f),{code:"BUSINESS_ADD_DEVICE_FAIL"});case 13:return _={productId:l.productId,deviceName:l.deviceName},[3,23];case 14:return E.trys.push([14,18,,19]),o.destroy(),[4,d({useTargetWifi:!1})];case 15:return E.sent(),[4,t()];case 16:return E.sent(),[4,qcloud_iotexplorer_appdev_plugin_wificonf_core_1.queryTokenStateAndBind({token:this.options.wifiConfToken,productId:null==s?void 0:s.productId,deviceName:null==s?void 0:s.deviceName,familyId:this.options.familyId,roomId:this.options.roomId,onProgress:function(e){I.onProgress.call(I,e)},sdk:this.sdk,newTokenVersion:this.options.newTokenVersion})];case 17:return S=E.sent(),v=S.productId,g=S.deviceName,_={productId:v,deviceName:g},[3,19];case 18:return C=E.sent(),console.log(C),[2,tslib_1.__assign(tslib_1.__assign({},C),{udpServer:o})];case 19:return[3,23];case 20:return[4,c()];case 21:return E.sent(),[3,23];case 22:throw err;case 23:return console.log("come to return,outDeviceInfo:",_),[2,{productId:_.productId,deviceName:_.deviceName}];case 24:throw h=E.sent(),console.log(h),tslib_1.__assign(tslib_1.__assign({},h),{udpServer:o});case 25:return[2]}}))}))},[4,Promise.race([r(),t.promise,i.promise])];case 1:return n=d.sent(),this.onProgress({code:WifiConfStepCode.BUSINESS_SUCCESS,detail:{response:n},reportEvents:["addDevice"]}),[2,n]}}))}))},o}(qcloud_iotexplorer_appdev_plugin_wificonf_core_1.WifiConfProtocolBase);exports.SoftAp=SoftAp;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SoftAp=void 0;var tslib_1=require("tslib"),qcloud_iotexplorer_appdev_plugin_wificonf_core_1=require("qcloud-iotexplorer-appdev-plugin-wificonf-core"),qcloud_iotexplorer_appdev_sdk_1=require("qcloud-iotexplorer-appdev-sdk"),WifiConfErrorMsg=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.constants.WifiConfErrorMsg,WifiConfStepCode=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.constants.WifiConfStepCode,UdpServer=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.utils.UdpServer,reconnectWifi=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.utils.reconnectWifi,tryRequest=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.utils.tryRequest,connectWifi=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.utils.connectWifi,getConnectedWifi=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.utils.getConnectedWifi,SoftAp=function(e){function o(o,t){var r=e.call(this,o,t)||this;return r.udpAddress="192.168.4.1",r.udpPort=8266,r.connectAborted=!1,r.udpAddress=r.options.udpAddress||r.udpAddress,r.udpPort=r.options.udpPort||r.udpPort,r}return tslib_1.__extends(o,e),o.prototype.start=function(e){var o=void 0===e?{}:e,t=o.doNotRetry,r=void 0!==t&&t,i=o.isUdpRetry,n=void 0!==i&&i;return tslib_1.__awaiter(this,void 0,void 0,(function(){var e,o,t,i=this;return tslib_1.__generator(this,(function(s){switch(s.label){case 0:n||(this.onProgress({code:WifiConfStepCode.WIFI_CONF_START}),this.onProgress({code:WifiConfStepCode.PROTOCOL_START,reportEvents:["配网"]})),e=Date.now(),console.log("come new softAp,options:",this.options),s.label=1;case 1:return s.trys.push([1,5,,8]),this.options.softAPInfo?[4,connectWifi(this.options.softAPInfo,{onProgress:function(e){i.onProgress.call(i,e)}})]:[3,3];case 2:s.sent(),s.label=3;case 3:return[4,this.doBusiness()];case 4:return o=s.sent(),this.onProgress({code:WifiConfStepCode.WIFI_CONF_SUCCESS,detail:tslib_1.__assign({timeCost:Date.now()-e},o)}),this.onComplete(o),[3,8];case 5:return t=s.sent(),console.error(t),t&&t.code in WifiConfErrorMsg&&(t.uiMsg=WifiConfErrorMsg[t.code]),(null==t?void 0:t.udpServer)&&(null==t||t.udpServer.destroy(),delete t.udpServer),r||!this.options.autoRetry?[3,7]:[4,qcloud_iotexplorer_appdev_plugin_wificonf_core_1.issueHandler({error:t,targetWifiInfo:this.options.targetWifiInfo,softAPInfo:this.options.softAPInfo,wifiConfType:this.options.wifiConfType,onProgress:function(e){i.onProgress.call(i,e)}})];case 6:if(s.sent())return this.onProgress({code:WifiConfStepCode.WIFI_CONF_AUTO_RETRY}),[2,this.start({doNotRetry:!0,isUdpRetry:!0})];s.label=7;case 7:return this.connectAborted=!0,this.onProgress({code:WifiConfStepCode.WIFI_CONF_FAIL,detail:{error:t},reportEvents:["配网"]}),this.onError({code:"WIFI_CONF_FAIL",detail:{error:t}}),[3,8];case 8:return[2]}}))}))},o.prototype.doBusiness=function(){return tslib_1.__awaiter(this,void 0,void 0,(function(){var e,o,t,r,i,n,s=this;return tslib_1.__generator(this,(function(d){switch(d.label){case 0:return this.onProgress({code:WifiConfStepCode.CREATE_UDP_CONNECTION_START,reportEvents:["udp"]}),e=Date.now(),o=new UdpServer({address:this.udpAddress,port:this.udpPort,sdk:this.sdk,retryTime:10,retryWhenFail:!0}),t=qcloud_iotexplorer_appdev_sdk_1.AppDevSdk.utils.genPromise(),r=qcloud_iotexplorer_appdev_sdk_1.AppDevSdk.utils.genPromise(),o.onError((function(e){return t.reject({code:"UDP_ERROR",errMsg:e})})),o.onProgressError((function(e){return r.reject({code:"BUSINESS_DEVICE_ERROR",message:e})})),i=function(){return tslib_1.__awaiter(s,void 0,void 0,(function(){var t,r,i,n,s,d,c,_,a,u,p,l,f,S,v,C,g,h,I=this;return tslib_1.__generator(this,(function(E){switch(E.label){case 0:return[4,(t=function(e){return tslib_1.__awaiter(I,void 0,void 0,(function(){return tslib_1.__generator(this,(function(o){switch(o.label){case 0:return[4,qcloud_iotexplorer_appdev_sdk_1.AppDevSdk.utils.delay(e||this.options.stepInterval)];case 1:return o.sent(),this.connectAborted&&qcloud_iotexplorer_appdev_sdk_1.AppDevSdk.utils.logger.debug("connection aborted"),[2]}}))}))})()];case 1:E.sent(),this.onProgress({code:WifiConfStepCode.CREATE_UDP_CONNECTION_SUCCESS,detail:{timeCost:Date.now()-e},reportEvents:["udp"]}),this.onProgress({code:WifiConfStepCode.SOFTAP_SEND_TARGET_WIFIINFO_START,reportEvents:["ap发送wifi"]}),r=Date.now(),E.label=2;case 2:return E.trys.push([2,24,,25]),[4,o.send({cmdType:1,ssid:this.options.targetWifiInfo.SSID,password:this.options.targetWifiInfo.password,token:this.options.wifiConfToken})];case 3:switch(i=E.sent(),n=i.protoVersion,s=tslib_1.__rest(i,["protoVersion"]),n||(n="1.0"),console.log(n,"protoVersion"),this.onProgress({code:WifiConfStepCode.SOFTAP_SEND_TARGET_WIFIINFO_SUCCESS,detail:{data:s,timeCost:Date.now()-r,protoVersion:n},reportEvents:["ap发送wifi"]}),d=function(e){var o=e.useTargetWifi,t=void 0!==o&&o;return tslib_1.__awaiter(I,void 0,void 0,(function(){var e=this;return tslib_1.__generator(this,(function(o){switch(o.label){case 0:return[4,reconnectWifi(this.options.targetWifiInfo,{onProgress:function(o){e.onProgress.call(e,o)},ignoreError:!0,useTargetWifi:t})];case 1:return o.sent(),this.onProgress({code:WifiConfStepCode.PROTOCOL_SUCCESS,detail:{timeCost:Date.now()-r,protoVersion:n}}),this.onProgress({code:WifiConfStepCode.BUSINESS_START}),[2]}}))}))},c=function(){return tslib_1.__awaiter(I,void 0,void 0,(function(){var e,t,r,i=this;return tslib_1.__generator(this,(function(n){switch(n.label){case 0:return[4,d({useTargetWifi:!0})];case 1:n.sent(),e=!1,t=function(){return tslib_1.__awaiter(i,void 0,void 0,(function(){var e,t,r,i=this;return tslib_1.__generator(this,(function(n){switch(n.label){case 0:return[4,qcloud_iotexplorer_appdev_plugin_wificonf_core_1.queryTokenStateAndBind({token:this.options.wifiConfToken,productId:null==s?void 0:s.productId,deviceName:null==s?void 0:s.deviceName,familyId:this.options.familyId,roomId:this.options.roomId,onProgress:function(e){i.onProgress.call(i,e)},sdk:this.sdk,newTokenVersion:this.options.newTokenVersion})];case 1:return e=n.sent(),t=e.productId,r=e.deviceName,o.destroy(),_={productId:t,deviceName:r},[2]}}))}))},function(){return tslib_1.__awaiter(i,void 0,void 0,(function(){var t,r,i,n,s,d=this;return tslib_1.__generator(this,(function(c){switch(c.label){case 0:return[4,getConnectedWifi()];case 1:return(t=c.sent())&&t.SSID===(null===(i=null===(r=this.options)||void 0===r?void 0:r.targetWifiInfo)||void 0===i?void 0:i.SSID)&&(null===(s=null===(n=null==this?void 0:this.sdk)||void 0===n?void 0:n.reporter)||void 0===s||s.info("Start_Check_Device_Connect_Target_Wifi_By_UDP"),o.onMessage((function(t){return tslib_1.__awaiter(d,void 0,void 0,(function(){var r,i;return tslib_1.__generator(this,(function(n){return 7===t.cmdType&&(e=!0,null===(i=null===(r=null==this?void 0:this.sdk)||void 0===r?void 0:r.reporter)||void 0===i||i.info("Device_Connect_Target_Wifi_Success"),o.destroy()),[2]}))}))}))),[2]}}))}))}(),n.label=2;case 2:return n.trys.push([2,4,,8]),[4,t()];case 3:return n.sent(),[3,8];case 4:return(r=n.sent())&&"BUSINESS_QUERY_BIND_TOKEN_TIMEOUT"===r.code&&!0===e?(e=!1,[4,t()]):[3,6];case 5:return n.sent(),[3,7];case 6:throw r;case 7:return[3,8];case 8:return[2]}}))}))},_={},n){case"1.0":return[3,4];case"2.0":return[3,14];case"3.0":return[3,20]}return[3,22];case 4:if("dataRecived"!==s.deviceReply)throw{code:"BUSINESS_INVALID_RESPONSE",detail:s};return[4,t(1e4)];case 5:return E.sent(),this.onProgress({code:WifiConfStepCode.SOFTAP_GET_DEVICE_SIGNATURE_START}),[4,o.send({cmdType:0,timestamp:parseInt(String(Date.now()/1e3),10)})];case 6:if(a=E.sent(),u=a.mqttState,p=a.wifiState,l=tslib_1.__rest(a,["mqttState","wifiState"]),"connected"!==u)throw{code:"BUSINESS_DEVICE_CONNECT_MQTT_FAIL"};if("connected"!==p)throw{code:"BUSINESS_DEVICE_CONNECT_WIFI_FAIL"};return this.onProgress({code:WifiConfStepCode.SOFTAP_GET_DEVICE_SIGNATURE_SUCCESS}),o.destroy(),[4,t()];case 7:return E.sent(),[4,reconnectWifi(this.options.targetWifiInfo,{onProgress:function(e){I.onProgress.call(I,e)}})];case 8:return E.sent(),[4,t()];case 9:E.sent(),this.onProgress({code:WifiConfStepCode.PROTOCOL_SUCCESS,detail:{timeCost:Date.now()-r,protoVersion:n}}),this.onProgress({code:WifiConfStepCode.BUSINESS_START}),this.onProgress({code:WifiConfStepCode.BUSINESS_ADD_DEVICE_START,detail:{data:{Signature:l.signature,DeviceTimestamp:l.timestamp,ProductId:l.productId,DeviceName:l.deviceName,ConnId:l.connId,FamilyId:this.options.familyId}}}),E.label=10;case 10:return E.trys.push([10,12,,13]),[4,tryRequest((function(){return I.sdk.requestApi("addDeviceBySigInFamily",{Signature:l.signature,DeviceTimestamp:l.timestamp,ProductId:l.productId,DeviceName:l.deviceName,ConnId:l.connId,FamilyId:I.options.familyId},{isTokenApi:!0})}),{reporter:this.sdk.reporter})];case 11:return E.sent(),[3,13];case 12:throw f=E.sent(),tslib_1.__assign(tslib_1.__assign({},f),{code:"BUSINESS_ADD_DEVICE_FAIL"});case 13:return _={productId:l.productId,deviceName:l.deviceName},[3,23];case 14:return E.trys.push([14,18,,19]),o.destroy(),[4,d({useTargetWifi:!1})];case 15:return E.sent(),[4,t()];case 16:return E.sent(),[4,qcloud_iotexplorer_appdev_plugin_wificonf_core_1.queryTokenStateAndBind({token:this.options.wifiConfToken,productId:null==s?void 0:s.productId,deviceName:null==s?void 0:s.deviceName,familyId:this.options.familyId,roomId:this.options.roomId,onProgress:function(e){I.onProgress.call(I,e)},sdk:this.sdk,newTokenVersion:this.options.newTokenVersion})];case 17:return S=E.sent(),v=S.productId,C=S.deviceName,_={productId:v,deviceName:C},[3,19];case 18:return g=E.sent(),console.log(g),[2,tslib_1.__assign(tslib_1.__assign({},g),{udpServer:o})];case 19:return[3,23];case 20:return[4,c()];case 21:return E.sent(),[3,23];case 22:throw err;case 23:return console.log("come to return,outDeviceInfo:",_),[2,{productId:_.productId,deviceName:_.deviceName}];case 24:throw h=E.sent(),console.log(h),tslib_1.__assign(tslib_1.__assign({},h),{udpServer:o});case 25:return[2]}}))}))},[4,Promise.race([i(),t.promise,r.promise])];case 1:return n=d.sent(),this.onProgress({code:WifiConfStepCode.BUSINESS_SUCCESS,detail:{response:n},reportEvents:["addDevice"]}),[2,n]}}))}))},o}(qcloud_iotexplorer_appdev_plugin_wificonf_core_1.WifiConfProtocolBase);exports.SoftAp=SoftAp;
//# sourceMappingURL=index.js.map
{
"name": "qcloud-iotexplorer-appdev-plugin-wificonf-softap",
"version": "1.9.0",
"version": "1.9.2",
"description": "",

@@ -17,4 +17,4 @@ "main": "lib/index.js",

"dependencies": {
"qcloud-iotexplorer-appdev-plugin-wificonf-core": "^1.9.0",
"qcloud-iotexplorer-appdev-sdk": "^1.9.0",
"qcloud-iotexplorer-appdev-plugin-wificonf-core": "^1.9.2",
"qcloud-iotexplorer-appdev-sdk": "^1.9.2",
"tslib": "^2.0.1"

@@ -25,3 +25,3 @@ },

},
"gitHead": "b5838d85e9fbd3444bbddcfd843d2bedd85d69dd"
"gitHead": "902a3ca640cb46524c3f7a1e9f66897db59be629"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc