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.4.30-alpha.0 to 1.4.31-alpha.0

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,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,s=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(n){switch(n.label){case 0:s||(this.onProgress({code:WifiConfStepCode.WIFI_CONF_START}),this.onProgress({code:WifiConfStepCode.PROTOCOL_START,reportEvents:["配网"]})),e=Date.now(),console.log("come newsoftap,options:",this.options),n.label=1;case 1:return n.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:n.sent(),n.label=3;case 3:return[4,this.doBusiness()];case 4:return o=n.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=n.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()),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(n.sent())return this.onProgress({code:WifiConfStepCode.WIFI_CONF_AUTO_RETRY}),[2,this.start({doNotRetry:!0,isUdpRetry:!0})];n.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,s,n=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(n,void 0,void 0,(function(){var t,r,i,s,n,d,c,a,p,_,u,l,f,S,I,g,v,C,h,m,E,T=this;return tslib_1.__generator(this,(function(P){switch(P.label){case 0:return[4,(t=function(e){return tslib_1.__awaiter(T,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:P.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(),P.label=2;case 2:return P.trys.push([2,29,,30]),[4,o.send({cmdType:1,ssid:this.options.targetWifiInfo.SSID,password:this.options.targetWifiInfo.password,token:this.options.wifiConfToken})];case 3:switch(i=P.sent(),s=i.protoVersion,n=i.cmdType,d=tslib_1.__rest(i,["protoVersion","cmdType"]),console.log("come to new softap,cmdType",n,d),s||(s="1.0"),n||(n=1),this.onProgress({code:WifiConfStepCode.SOFTAP_SEND_TARGET_WIFIINFO_SUCCESS,detail:{data:d,timeCost:Date.now()-r,protoVersion:s},reportEvents:["ap发送wifi"]}),c={},console.log("outdeviceinfo",c),s){case"1.0":return[3,4];case"2.0":return[3,14];case"3.0":return[3,20]}return[3,27];case 4:if("dataRecived"!==d.deviceReply)throw{code:"BUSINESS_INVALID_RESPONSE",detail:d};return[4,t(1e4)];case 5:return P.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=P.sent(),p=a.mqttState,_=a.wifiState,u=tslib_1.__rest(a,["mqttState","wifiState"]),"connected"!==p)throw{code:"BUSINESS_DEVICE_CONNECT_MQTT_FAIL"};if("connected"!==_)throw{code:"BUSINESS_DEVICE_CONNECT_WIFI_FAIL"};return this.onProgress({code:WifiConfStepCode.SOFTAP_GET_DEVICE_SIGNATURE_SUCCESS}),o.destroy(),[4,t()];case 7:return P.sent(),[4,reconnectWifi(this.options.targetWifiInfo,{onProgress:function(e){T.onProgress.call(T,e)},ignoreError:!0})];case 8:return P.sent(),[4,t()];case 9:P.sent(),this.onProgress({code:WifiConfStepCode.PROTOCOL_SUCCESS,detail:{timeCost:Date.now()-r,protoVersion:s}}),this.onProgress({code:WifiConfStepCode.BUSINESS_START}),this.onProgress({code:WifiConfStepCode.BUSINESS_ADD_DEVICE_START,detail:{data:{Signature:u.signature,DeviceTimestamp:u.timestamp,ProductId:u.productId,DeviceName:u.deviceName,ConnId:u.connId,FamilyId:this.options.familyId}}}),P.label=10;case 10:return P.trys.push([10,12,,13]),[4,tryRequest((function(){return T.sdk.requestApi("addDeviceBySigInFamily",{Signature:u.signature,DeviceTimestamp:u.timestamp,ProductId:u.productId,DeviceName:u.deviceName,ConnId:u.connId,FamilyId:T.options.familyId},{isTokenApi:!0})}),{reporter:this.sdk.reporter})];case 11:return P.sent(),[3,13];case 12:throw l=P.sent(),tslib_1.__assign(tslib_1.__assign({},l),{code:"BUSINESS_ADD_DEVICE_FAIL"});case 13:return c={productId:u.productId,deviceName:u.deviceName},[3,28];case 14:return P.trys.push([14,18,,19]),o.destroy(),[4,reconnectWifi(this.options.targetWifiInfo,{onProgress:function(e){T.onProgress.call(T,e)},ignoreError:!0,useTargetWifi:!0})];case 15:return P.sent(),this.onProgress({code:WifiConfStepCode.PROTOCOL_SUCCESS,detail:{timeCost:Date.now()-r,protoVersion:s}}),this.onProgress({code:WifiConfStepCode.BUSINESS_START}),[4,t()];case 16:return P.sent(),[4,qcloud_iotexplorer_appdev_plugin_wificonf_core_1.queryTokenStateAndBind({token:this.options.wifiConfToken,productId:null==d?void 0:d.productId,deviceName:null==d?void 0:d.deviceName,familyId:this.options.familyId,roomId:this.options.roomId,onProgress:function(e){T.onProgress.call(T,e)},sdk:this.sdk,newTokenVersion:this.options.newTokenVersion})];case 17:return f=P.sent(),g=f.productId,v=f.deviceName,console.log("update outDeviceInfo"),c={productId:g,deviceName:v},console.log("after update",c),[3,19];case 18:return S=P.sent(),[2,tslib_1.__assign(tslib_1.__assign({},S),{udpServer:o})];case 19:return[3,28];case 20:return console.log("3.0"),[4,reconnectWifi(this.options.targetWifiInfo,{onProgress:function(e){T.onProgress.call(T,e)},ignoreError:!0,useTargetWifi:!0})];case 21:return P.sent(),this.onProgress({code:WifiConfStepCode.PROTOCOL_SUCCESS,detail:{timeCost:Date.now()-r,protoVersion:s}}),this.onProgress({code:WifiConfStepCode.BUSINESS_START}),[4,t()];case 22:P.sent(),P.label=23;case 23:return P.trys.push([23,25,,26]),console.log("response",d),[4,qcloud_iotexplorer_appdev_plugin_wificonf_core_1.queryTokenStateAndBind({token:this.options.wifiConfToken,productId:null==d?void 0:d.productId,deviceName:null==d?void 0:d.deviceName,familyId:this.options.familyId,roomId:this.options.roomId,onProgress:function(e){T.onProgress.call(T,e)},sdk:this.sdk,newTokenVersion:this.options.newTokenVersion})];case 24:return I=P.sent(),g=I.productId,v=I.deviceName,console.log("query token come to return2,outdeviceInfo",c),o.destroy(),c={productId:g,deviceName:v},console.log("after query token, outDeviceInfo:",c),[3,26];case 25:if((C=P.sent())&&"BUSINESS_QUERY_BIND_TOKEN_TIMEOUT"===C.code)return h=new Promise((function(e,t){return tslib_1.__awaiter(T,void 0,void 0,(function(){var r=this;return tslib_1.__generator(this,(function(i){try{o.onMessage((function(t){return tslib_1.__awaiter(r,void 0,void 0,(function(){var r,i,s,n=this;return tslib_1.__generator(this,(function(a){switch(a.label){case 0:return console.log("timeout,try get mes by udp",t),7!==t.cmdType?[3,2]:(o.destroy(),console.log("query token retry"),[4,qcloud_iotexplorer_appdev_plugin_wificonf_core_1.queryTokenStateAndBind({token:this.options.wifiConfToken,productId:null==d?void 0:d.productId,deviceName:null==d?void 0:d.deviceName,familyId:this.options.familyId,roomId:this.options.roomId,onProgress:function(e){n.onProgress.call(n,e)},sdk:this.sdk,newTokenVersion:this.options.newTokenVersion})]);case 1:r=a.sent(),i=r.productId,s=r.deviceName,console.log("outdeviceinfo","productid",i,s),c={productId:i,deviceName:s},console.log("outdeviceinfo",c),e({productId:c.productId,deviceName:c.deviceName}),a.label=2;case 2:return[2]}}))}))}))}catch(e){t({code:"BUSINESS_QUERY_BIND_TOKEN_FAIL",detail:e})}return[2]}))}))})),m=setTimeout((function(){console.log("come to timeout"),reject({code:"QUERY_TOKEN_AND_UDP_RETRY_FAIL"})}),6e4),[2,Promise.race([h,m])];throw C;case 26:return console.log("come to go break"),[3,28];case 27:throw err;case 28:return console.log(" come to return,outDeviceInfo:",c),[2,{productId:c.productId,deviceName:c.deviceName}];case 29:throw E=P.sent(),tslib_1.__assign(tslib_1.__assign({},E),{udpServer:o});case 30:return[2]}}))}))},[4,Promise.race([i(),t.promise,r.promise])];case 1:return s=d.sent(),this.onProgress({code:WifiConfStepCode.BUSINESS_SUCCESS,detail:{response:s},reportEvents:["addDevice"]}),[2,s]}}))}))},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,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,s=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(n){switch(n.label){case 0:s||(this.onProgress({code:WifiConfStepCode.WIFI_CONF_START}),this.onProgress({code:WifiConfStepCode.PROTOCOL_START,reportEvents:["配网"]})),e=Date.now(),console.log("come newsoftap,options:",this.options),n.label=1;case 1:return n.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:n.sent(),n.label=3;case 3:return[4,this.doBusiness()];case 4:return o=n.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=n.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()),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(n.sent())return this.onProgress({code:WifiConfStepCode.WIFI_CONF_AUTO_RETRY}),[2,this.start({doNotRetry:!0,isUdpRetry:!0})];n.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,s,n=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(n,void 0,void 0,(function(){var t,r,i,s,n,d,c,a,p,_,u,l,f,S,I,g,v,C,h,m,E,T=this;return tslib_1.__generator(this,(function(P){switch(P.label){case 0:return[4,(t=function(e){return tslib_1.__awaiter(T,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:P.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(),P.label=2;case 2:return P.trys.push([2,29,,30]),[4,o.send({cmdType:1,ssid:this.options.targetWifiInfo.SSID,password:this.options.targetWifiInfo.password,token:this.options.wifiConfToken})];case 3:switch(i=P.sent(),s=i.protoVersion,n=i.cmdType,d=tslib_1.__rest(i,["protoVersion","cmdType"]),console.log("come to new softap,cmdType",n,d),s||(s="1.0"),n||(n=1),this.onProgress({code:WifiConfStepCode.SOFTAP_SEND_TARGET_WIFIINFO_SUCCESS,detail:{data:d,timeCost:Date.now()-r,protoVersion:s},reportEvents:["ap发送wifi"]}),c={},console.log("outDeviceInfo",c),s){case"1.0":return[3,4];case"2.0":return[3,14];case"3.0":return[3,20]}return[3,27];case 4:if("dataRecived"!==d.deviceReply)throw{code:"BUSINESS_INVALID_RESPONSE",detail:d};return[4,t(1e4)];case 5:return P.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=P.sent(),p=a.mqttState,_=a.wifiState,u=tslib_1.__rest(a,["mqttState","wifiState"]),"connected"!==p)throw{code:"BUSINESS_DEVICE_CONNECT_MQTT_FAIL"};if("connected"!==_)throw{code:"BUSINESS_DEVICE_CONNECT_WIFI_FAIL"};return this.onProgress({code:WifiConfStepCode.SOFTAP_GET_DEVICE_SIGNATURE_SUCCESS}),o.destroy(),[4,t()];case 7:return P.sent(),[4,reconnectWifi(this.options.targetWifiInfo,{onProgress:function(e){T.onProgress.call(T,e)},ignoreError:!0})];case 8:return P.sent(),[4,t()];case 9:P.sent(),this.onProgress({code:WifiConfStepCode.PROTOCOL_SUCCESS,detail:{timeCost:Date.now()-r,protoVersion:s}}),this.onProgress({code:WifiConfStepCode.BUSINESS_START}),this.onProgress({code:WifiConfStepCode.BUSINESS_ADD_DEVICE_START,detail:{data:{Signature:u.signature,DeviceTimestamp:u.timestamp,ProductId:u.productId,DeviceName:u.deviceName,ConnId:u.connId,FamilyId:this.options.familyId}}}),P.label=10;case 10:return P.trys.push([10,12,,13]),[4,tryRequest((function(){return T.sdk.requestApi("addDeviceBySigInFamily",{Signature:u.signature,DeviceTimestamp:u.timestamp,ProductId:u.productId,DeviceName:u.deviceName,ConnId:u.connId,FamilyId:T.options.familyId},{isTokenApi:!0})}),{reporter:this.sdk.reporter})];case 11:return P.sent(),[3,13];case 12:throw l=P.sent(),tslib_1.__assign(tslib_1.__assign({},l),{code:"BUSINESS_ADD_DEVICE_FAIL"});case 13:return c={productId:u.productId,deviceName:u.deviceName},[3,28];case 14:return P.trys.push([14,18,,19]),o.destroy(),[4,reconnectWifi(this.options.targetWifiInfo,{onProgress:function(e){T.onProgress.call(T,e)},ignoreError:!0,useTargetWifi:!0})];case 15:return P.sent(),this.onProgress({code:WifiConfStepCode.PROTOCOL_SUCCESS,detail:{timeCost:Date.now()-r,protoVersion:s}}),this.onProgress({code:WifiConfStepCode.BUSINESS_START}),[4,t()];case 16:return P.sent(),[4,qcloud_iotexplorer_appdev_plugin_wificonf_core_1.queryTokenStateAndBind({token:this.options.wifiConfToken,productId:null==d?void 0:d.productId,deviceName:null==d?void 0:d.deviceName,familyId:this.options.familyId,roomId:this.options.roomId,onProgress:function(e){T.onProgress.call(T,e)},sdk:this.sdk,newTokenVersion:this.options.newTokenVersion})];case 17:return f=P.sent(),g=f.productId,v=f.deviceName,console.log("update outDeviceInfo"),c={productId:g,deviceName:v},console.log("after update",c),[3,19];case 18:return S=P.sent(),[2,tslib_1.__assign(tslib_1.__assign({},S),{udpServer:o})];case 19:return[3,28];case 20:return console.log("3.0"),[4,reconnectWifi(this.options.targetWifiInfo,{onProgress:function(e){T.onProgress.call(T,e)},ignoreError:!0,useTargetWifi:!0})];case 21:return P.sent(),this.onProgress({code:WifiConfStepCode.PROTOCOL_SUCCESS,detail:{timeCost:Date.now()-r,protoVersion:s}}),this.onProgress({code:WifiConfStepCode.BUSINESS_START}),[4,t()];case 22:P.sent(),P.label=23;case 23:return P.trys.push([23,25,,26]),console.log("response",d),[4,qcloud_iotexplorer_appdev_plugin_wificonf_core_1.queryTokenStateAndBind({token:this.options.wifiConfToken,productId:null==d?void 0:d.productId,deviceName:null==d?void 0:d.deviceName,familyId:this.options.familyId,roomId:this.options.roomId,onProgress:function(e){T.onProgress.call(T,e)},sdk:this.sdk,newTokenVersion:this.options.newTokenVersion})];case 24:return I=P.sent(),g=I.productId,v=I.deviceName,console.log("query token come to return2,outdeviceInfo",c),o.destroy(),c={productId:g,deviceName:v},console.log("after query token, outDeviceInfo:",c),[3,26];case 25:if((C=P.sent())&&"BUSINESS_QUERY_BIND_TOKEN_TIMEOUT"===C.code)return h=new Promise((function(e,t){return tslib_1.__awaiter(T,void 0,void 0,(function(){var r=this;return tslib_1.__generator(this,(function(i){try{o.onMessage((function(t){return tslib_1.__awaiter(r,void 0,void 0,(function(){var r,i,s,n=this;return tslib_1.__generator(this,(function(a){switch(a.label){case 0:return console.log("timeout,try get mes by udp",t),7!==t.cmdType?[3,2]:(o.destroy(),console.log("query token retry"),[4,qcloud_iotexplorer_appdev_plugin_wificonf_core_1.queryTokenStateAndBind({token:this.options.wifiConfToken,productId:null==d?void 0:d.productId,deviceName:null==d?void 0:d.deviceName,familyId:this.options.familyId,roomId:this.options.roomId,onProgress:function(e){n.onProgress.call(n,e)},sdk:this.sdk,newTokenVersion:this.options.newTokenVersion})]);case 1:r=a.sent(),i=r.productId,s=r.deviceName,console.log("outdeviceinfo","productid",i,s),c={productId:i,deviceName:s},console.log("outdeviceinfo",c),e({productId:c.productId,deviceName:c.deviceName}),a.label=2;case 2:return[2]}}))}))}))}catch(e){t({code:"BUSINESS_QUERY_BIND_TOKEN_FAIL",detail:e})}return[2]}))}))})),m=setTimeout((function(){console.log("come to timeout"),reject({code:"QUERY_TOKEN_AND_UDP_RETRY_FAIL"})}),6e4),[2,Promise.race([h,m])];throw C;case 26:return console.log("come to go break"),[3,28];case 27:throw err;case 28:return console.log(" come to return,outDeviceInfo:",c),[2,{productId:c.productId,deviceName:c.deviceName}];case 29:throw E=P.sent(),tslib_1.__assign(tslib_1.__assign({},E),{udpServer:o});case 30:return[2]}}))}))},[4,Promise.race([i(),t.promise,r.promise])];case 1:return s=d.sent(),this.onProgress({code:WifiConfStepCode.BUSINESS_SUCCESS,detail:{response:s},reportEvents:["addDevice"]}),[2,s]}}))}))},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.4.30-alpha.0",
"version": "1.4.31-alpha.0",
"description": "",

@@ -21,3 +21,3 @@ "main": "lib/index.js",

},
"gitHead": "b4883d523d45a7dc34a35d8102f88cc6bafc745e"
"gitHead": "8202e4732a4550cf7e99516de11ede90c8a8ea41"
}
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