Socket
Socket
Sign inDemoInstall

qcloud-iotexplorer-appdev-plugin-wificonf-softap

Package Overview
Dependencies
13
Maintainers
6
Versions
167
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.3.23 to 2.3.24

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,checkIsTargetWifi=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.utils.checkIsTargetWifi,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,t,i=void 0===e?{}:e,r=i.doNotRetry,n=void 0!==r&&r,s=i.isUdpRetry,d=void 0!==s&&s;return tslib_1.__awaiter(this,void 0,void 0,(function(){var e,i,r,s=this;return tslib_1.__generator(this,(function(c){switch(c.label){case 0:d||(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),c.label=1;case 1:return c.trys.push([1,5,,8]),this.options.softAPInfo?[4,connectWifi(this.options.softAPInfo,{onProgress:function(e){s.onProgress.call(s,e)}})]:[3,3];case 2:c.sent(),c.label=3;case 3:return[4,this.doBusiness()];case 4:return i=c.sent(),this.onProgress({code:WifiConfStepCode.WIFI_CONF_SUCCESS,detail:tslib_1.__assign({timeCost:Date.now()-e},i)}),this.onComplete(i),[3,8];case 5:return r=c.sent(),console.error(r),r&&r.code in WifiConfErrorMsg&&(r.uiMsg=WifiConfErrorMsg[r.code]),(null===(o=null==r?void 0:r.detail)||void 0===o?void 0:o.code)===WifiConfStepCode.QUERY_TOKEN_RESULT_ERROR&&(r.uiMsg=null===(t=null==r?void 0:r.detail)||void 0===t?void 0:t.msg),n||!this.options.autoRetry?[3,7]:[4,qcloud_iotexplorer_appdev_plugin_wificonf_core_1.issueHandler({error:r,targetWifiInfo:this.options.targetWifiInfo,softAPInfo:this.options.softAPInfo,wifiConfType:this.options.wifiConfType,onProgress:function(e){s.onProgress.call(s,e)}})];case 6:if(c.sent())return this.onProgress({code:WifiConfStepCode.WIFI_CONF_AUTO_RETRY}),[2,this.start({doNotRetry:!0,isUdpRetry:!0})];c.label=7;case 7:return this.connectAborted=!0,this.onProgress({code:WifiConfStepCode.WIFI_CONF_FAIL,detail:{error:r},reportEvents:["配网"]}),this.onError({code:"WIFI_CONF_FAIL",detail:{error:r}}),[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,d=this;return tslib_1.__generator(this,(function(c){switch(c.label){case 0: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(tslib_1.__assign(tslib_1.__assign({},e),{code:"UDP_ERROR"}))})),o.onProgressError((function(e){return i.reject({code:"BUSINESS_DEVICE_ERROR",message:e})})),r=function(){return tslib_1.__awaiter(d,void 0,void 0,(function(){var t,i,r,n,s,d,c,_,a,u,p,l,f,v,S,h,C=this;return tslib_1.__generator(this,(function(I){switch(I.label){case 0:return t=function(e){return void 0===e&&(e=1e3),tslib_1.__awaiter(C,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]}}))}))},[4,t()];case 1:return I.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(),[4,o.send({cmdType:1,ssid:this.options.targetWifiInfo.SSID,password:this.options.targetWifiInfo.password,token:this.options.wifiConfToken})];case 2:switch(r=I.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(C,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(C,void 0,void 0,(function(){var e,t,i,r,n=this;return tslib_1.__generator(this,(function(c){switch(c.label){case 0:return[4,d({useTargetWifi:!0})];case 1:c.sent(),e=!1,t=function(){return tslib_1.__awaiter(n,void 0,void 0,(function(){var t,i,r,n=this;return tslib_1.__generator(this,(function(s){switch(s.label){case 0:return[4,checkIsTargetWifi(null===(t=this.options)||void 0===t?void 0:t.targetWifiInfo)];case 1:return s.sent()&&(null===(r=null===(i=null==this?void 0:this.sdk)||void 0===i?void 0:i.reporter)||void 0===r||r.info("Start_Check_Device_Connect_Target_Wifi_By_UDP"),o.onMessage((function(t){return tslib_1.__awaiter(n,void 0,void 0,(function(){var i,r;return tslib_1.__generator(this,(function(n){return 7===t.cmdType&&(e=!0,null===(r=null===(i=null==this?void 0:this.sdk)||void 0===i?void 0:i.reporter)||void 0===r||r.info("Device_Connect_Target_Wifi_Success"),o.destroy()),[2]}))}))}))),[2]}}))}))},i=function(){return tslib_1.__awaiter(n,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]}}))}))},t(),c.label=2;case 2:return c.trys.push([2,4,,8]),[4,i()];case 3:return c.sent(),[3,8];case 4:return(r=c.sent())&&"BUSINESS_QUERY_BIND_TOKEN_TIMEOUT"===r.code&&!0===e?(e=!1,[4,i()]):[3,6];case 5:return c.sent(),[3,7];case 6:throw r;case 7:return[3,8];case 8:return[2]}}))}))},_={},n){case"1.0":return[3,3];case"2.0":return[3,13];case"3.0":return[3,17]}return[3,19];case 3:if("dataRecived"!==s.deviceReply)throw{code:"BUSINESS_INVALID_RESPONSE",detail:s};return[4,t(1e4)];case 4:return I.sent(),this.onProgress({code:WifiConfStepCode.SOFTAP_GET_DEVICE_SIGNATURE_START}),[4,o.send({cmdType:0,timestamp:parseInt(String(Date.now()/1e3),10)})];case 5:if(a=I.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 6:return I.sent(),[4,reconnectWifi(this.options.targetWifiInfo,{onProgress:function(e){C.onProgress.call(C,e)}})];case 7:return I.sent(),[4,t()];case 8:I.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}}}),I.label=9;case 9:return I.trys.push([9,11,,12]),[4,tryRequest((function(){return C.sdk.requestApi("AppSigBindDeviceInFamily",{Signature:l.signature,DeviceTimestamp:l.timestamp,ProductId:l.productId,DeviceName:l.deviceName,ConnId:l.connId,FamilyId:C.options.familyId},{isTokenApi:!0})}),{reporter:this.sdk.reporter})];case 10:return I.sent(),[3,12];case 11:throw f=I.sent(),tslib_1.__assign(tslib_1.__assign({},f),{code:"BUSINESS_ADD_DEVICE_FAIL"});case 12:return _={productId:l.productId,deviceName:l.deviceName},[3,20];case 13:return o.destroy(),[4,d({useTargetWifi:!1})];case 14:return I.sent(),[4,t()];case 15:return I.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){C.onProgress.call(C,e)},sdk:this.sdk,newTokenVersion:this.options.newTokenVersion})];case 16:return v=I.sent(),S=v.productId,h=v.deviceName,_={productId:S,deviceName:h},[3,20];case 17:return[4,c()];case 18:return I.sent(),[3,20];case 19:throw{code:"SOFTAP_MODULE_VERSION_ERROR"};case 20:return console.log("come to return,outDeviceInfo:",_),[2,{productId:_.productId,deviceName:_.deviceName}]}}))}))},c.label=1;case 1:return c.trys.push([1,3,4,5]),[4,Promise.race([r(),t.promise,i.promise])];case 2:return n=c.sent(),[3,5];case 3:throw s=c.sent(),console.log(s),o.destroy(),s;case 4:return console.log("come udp server destroy"),o.destroy(),[7];case 5:return 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,checkIsTargetWifi=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.utils.checkIsTargetWifi,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,t,i=void 0===e?{}:e,r=i.doNotRetry,n=void 0!==r&&r,s=i.isUdpRetry,d=void 0!==s&&s;return tslib_1.__awaiter(this,void 0,void 0,(function(){var e,i,r,s=this;return tslib_1.__generator(this,(function(c){switch(c.label){case 0:d||(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),c.label=1;case 1:return c.trys.push([1,5,,8]),this.options.softAPInfo?[4,connectWifi(this.options.softAPInfo,{onProgress:function(e){s.onProgress.call(s,e)}})]:[3,3];case 2:c.sent(),c.label=3;case 3:return[4,this.doBusiness()];case 4:return i=c.sent(),this.onProgress({code:WifiConfStepCode.WIFI_CONF_SUCCESS,detail:tslib_1.__assign({timeCost:Date.now()-e},i)}),this.onComplete(i),[3,8];case 5:return r=c.sent(),console.error(r),r&&r.code in WifiConfErrorMsg&&(r.uiMsg=WifiConfErrorMsg[r.code]),(null===(o=null==r?void 0:r.detail)||void 0===o?void 0:o.code)===WifiConfStepCode.QUERY_TOKEN_RESULT_ERROR&&(r.uiMsg=null===(t=null==r?void 0:r.detail)||void 0===t?void 0:t.msg),n||!this.options.autoRetry?[3,7]:[4,qcloud_iotexplorer_appdev_plugin_wificonf_core_1.issueHandler({error:r,targetWifiInfo:this.options.targetWifiInfo,softAPInfo:this.options.softAPInfo,wifiConfType:this.options.wifiConfType,onProgress:function(e){s.onProgress.call(s,e)}})];case 6:if(c.sent())return this.onProgress({code:WifiConfStepCode.WIFI_CONF_AUTO_RETRY}),[2,this.start({doNotRetry:!0,isUdpRetry:!0})];c.label=7;case 7:return this.connectAborted=!0,this.onProgress({code:WifiConfStepCode.WIFI_CONF_FAIL,detail:{error:r},reportEvents:["配网"]}),this.onError({code:"WIFI_CONF_FAIL",detail:{error:r}}),[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,d=this;return tslib_1.__generator(this,(function(c){switch(c.label){case 0: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(tslib_1.__assign(tslib_1.__assign({},e),{code:"UDP_ERROR"}))})),o.onProgressError((function(e){return i.reject({code:"BUSINESS_DEVICE_ERROR",message:e})})),r=function(){return tslib_1.__awaiter(d,void 0,void 0,(function(){var t,i,r,n,s,d,c,_,a,u,p,l,f,v,S,h,C=this;return tslib_1.__generator(this,(function(g){switch(g.label){case 0:return t=function(e){return void 0===e&&(e=1e3),tslib_1.__awaiter(C,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]}}))}))},[4,t()];case 1:return g.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(),[4,o.send({cmdType:1,ssid:this.options.targetWifiInfo.SSID,password:this.options.targetWifiInfo.password,token:this.options.wifiConfToken})];case 2:switch(r=g.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(C,void 0,void 0,(function(){var e,o=this;return tslib_1.__generator(this,(function(r){switch(r.label){case 0:return[4,reconnectWifi(this.options.targetWifiInfo,{onProgress:function(e){o.onProgress.call(o,e)},ignoreError:!0,useTargetWifi:t,waitSystemNetworkChangeTime:null===(e=this.options.reconnectFamilyWifiOptions)||void 0===e?void 0:e.waitSystemNetworkChangeTime})];case 1:return r.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(C,void 0,void 0,(function(){var e,t,i,r,n=this;return tslib_1.__generator(this,(function(c){switch(c.label){case 0:return[4,d({useTargetWifi:!0})];case 1:c.sent(),e=!1,t=function(){return tslib_1.__awaiter(n,void 0,void 0,(function(){var t,i,r,n=this;return tslib_1.__generator(this,(function(s){switch(s.label){case 0:return[4,checkIsTargetWifi(null===(t=this.options)||void 0===t?void 0:t.targetWifiInfo)];case 1:return s.sent()&&(null===(r=null===(i=null==this?void 0:this.sdk)||void 0===i?void 0:i.reporter)||void 0===r||r.info("Start_Check_Device_Connect_Target_Wifi_By_UDP"),o.onMessage((function(t){return tslib_1.__awaiter(n,void 0,void 0,(function(){var i,r;return tslib_1.__generator(this,(function(n){return 7===t.cmdType&&(e=!0,null===(r=null===(i=null==this?void 0:this.sdk)||void 0===i?void 0:i.reporter)||void 0===r||r.info("Device_Connect_Target_Wifi_Success"),o.destroy()),[2]}))}))}))),[2]}}))}))},i=function(){return tslib_1.__awaiter(n,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]}}))}))},t(),c.label=2;case 2:return c.trys.push([2,4,,8]),[4,i()];case 3:return c.sent(),[3,8];case 4:return(r=c.sent())&&"BUSINESS_QUERY_BIND_TOKEN_TIMEOUT"===r.code&&!0===e?(e=!1,[4,i()]):[3,6];case 5:return c.sent(),[3,7];case 6:throw r;case 7:return[3,8];case 8:return[2]}}))}))},_={},n){case"1.0":return[3,3];case"2.0":return[3,13];case"3.0":return[3,17]}return[3,19];case 3:if("dataRecived"!==s.deviceReply)throw{code:"BUSINESS_INVALID_RESPONSE",detail:s};return[4,t(1e4)];case 4:return g.sent(),this.onProgress({code:WifiConfStepCode.SOFTAP_GET_DEVICE_SIGNATURE_START}),[4,o.send({cmdType:0,timestamp:parseInt(String(Date.now()/1e3),10)})];case 5:if(a=g.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 6:return g.sent(),[4,reconnectWifi(this.options.targetWifiInfo,{onProgress:function(e){C.onProgress.call(C,e)}})];case 7:return g.sent(),[4,t()];case 8:g.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}}}),g.label=9;case 9:return g.trys.push([9,11,,12]),[4,tryRequest((function(){return C.sdk.requestApi("AppSigBindDeviceInFamily",{Signature:l.signature,DeviceTimestamp:l.timestamp,ProductId:l.productId,DeviceName:l.deviceName,ConnId:l.connId,FamilyId:C.options.familyId},{isTokenApi:!0})}),{reporter:this.sdk.reporter})];case 10:return g.sent(),[3,12];case 11:throw f=g.sent(),tslib_1.__assign(tslib_1.__assign({},f),{code:"BUSINESS_ADD_DEVICE_FAIL"});case 12:return _={productId:l.productId,deviceName:l.deviceName},[3,20];case 13:return o.destroy(),[4,d({useTargetWifi:!1})];case 14:return g.sent(),[4,t()];case 15:return g.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){C.onProgress.call(C,e)},sdk:this.sdk,newTokenVersion:this.options.newTokenVersion})];case 16:return v=g.sent(),S=v.productId,h=v.deviceName,_={productId:S,deviceName:h},[3,20];case 17:return[4,c()];case 18:return g.sent(),[3,20];case 19:throw{code:"SOFTAP_MODULE_VERSION_ERROR"};case 20:return console.log("come to return,outDeviceInfo:",_),[2,{productId:_.productId,deviceName:_.deviceName}]}}))}))},c.label=1;case 1:return c.trys.push([1,3,4,5]),[4,Promise.race([r(),t.promise,i.promise])];case 2:return n=c.sent(),[3,5];case 3:throw s=c.sent(),console.log(s),o.destroy(),s;case 4:return console.log("come udp server destroy"),o.destroy(),[7];case 5:return 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": "2.3.23",
"version": "2.3.24",
"description": "",

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

"dependencies": {
"qcloud-iotexplorer-appdev-plugin-wificonf-core": "^2.3.22",
"qcloud-iotexplorer-appdev-plugin-wificonf-core": "^2.3.23",
"qcloud-iotexplorer-appdev-sdk": "^2.3.16",

@@ -25,3 +25,3 @@ "tslib": "^2.0.1"

},
"gitHead": "32b3879aa17d7a469abb90c35a2a410eb6326445"
"gitHead": "c9df97fac805dcf849583007aea6adc1099944f1"
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc