New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

qcloud-iotexplorer-appdev-plugin-wificonf-airkiss

Package Overview
Dependencies
Maintainers
2
Versions
198
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 1.0.1 to 1.0.2

README.md

3

lib/airkiss/AirKissProtocol.d.ts

@@ -20,3 +20,3 @@ export class AirKissProtocol {

mSequencesData: any[];
socket: any;
socket: WifiConfUtils.UDPSocket;
destroy(): void;

@@ -37,1 +37,2 @@ checkRandFromFeedback(response: any): boolean;

}
import { utils as WifiConfUtils } from "qcloud-iotexplorer-appdev-plugin-wificonf-core";

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AirKissProtocol=void 0;var tslib_1=require("tslib"),UDPSocket_1=require("../UDPSocket"),qcloud_iotexplorer_appdev_plugin_wificonf_core_1=require("qcloud-iotexplorer-appdev-plugin-wificonf-core"),byteUtil=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.utils.byteUtil;function arraycopy(t,e,i,r,s){i.splice.apply(i,tslib_1.__spread([r,0],t.slice(e,e+s)))}var AirKissProtocol=function(){function t(t,e){this.TARGET_ADDR="255.255.255.255",this.TARGET_PORT=10001,this.NUMBERS_OF_PRECURSOR=20,this.NUMBERS_OF_MAGICCODE=20,this.DATAS_IN_ONE_SEQUENCE=4,this.SEND_PRECURSOR_DURATION_MS=2e3,this.INTERVAL_OF_PACKET_DATA=5,this.INTERVAL_OF_PACKET_GUIDE_CODE=10,this.USE_BITS=9,this.MAGIC_CODE_FLAG=0,this.SEQUENCE_HEADER_FLAG=1<<this.USE_BITS-2,this.DATA_FLAG=1<<this.USE_BITS-1,this.mOriData=this.buildOriginalData(t,e),this.mValidPayload=this.buildValidPayload(this.mOriData),this.mMagicCodeField=this.getMagicCodeField(t,this.mOriData.length),this.mPrefixCodeField=this.getPrefixCodeField(e.length),this.mSequencesData=this.getSequencesData(this.mValidPayload),this.socket=new UDPSocket_1.UDPSocket(1e4)}return t.prototype.destroy=function(){this.socket.destroy()},t.prototype.checkRandFromFeedback=function(t){var e=new DataView(t).getUint8(0);return console.log("checkRandFromFeedback",e,255&e,this.rand,255&this.rand,(255&e)==(255&this.rand)),(255&e)==(255&this.rand)},t.prototype.randomByte=function(){return String(127-Math.round(256*Math.random()))},t.prototype.buildOriginalData=function(t,e){return this.rand=this.randomByte(),tslib_1.__spread(byteUtil.stringToByteArray(e),[Number(this.rand)],byteUtil.getBytesByString(t))},t.prototype.buildValidPayload=function(t){for(var e,i,r,s,a=Math.ceil((t.length<<3)/(this.USE_BITS-1)),o=Array(a),n=0;n<a;++n)e=n*(this.USE_BITS-1)>>3,i=n*(this.USE_BITS-1)&7,r=((255&t[e])<<i&255)>>8-this.USE_BITS+1,s=n+1===a?0:(255&t[e+1])>>8-i>>8-this.USE_BITS+1,o[n]=String(r|s);return o},t.prototype.getMagicCodeField=function(t,e){var i=Array(4),r=byteUtil.stringToUtf8ByteArray(t),s=byteUtil.crc8Bytes(r,r.length);return e<16&&(e+=128),i[0]=0|this.MAGIC_CODE_FLAG|e>>4&15,i[1]=16|this.MAGIC_CODE_FLAG|15&e,i[2]=32|this.MAGIC_CODE_FLAG|s>>4&15,i[3]=48|this.MAGIC_CODE_FLAG|15&s,i},t.prototype.getPrefixCodeField=function(t){var e=Array(4),i=byteUtil.crc8Bytes([t],1);return e[0]=64|this.MAGIC_CODE_FLAG|t>>4&15,e[1]=80|this.MAGIC_CODE_FLAG|15&t,e[2]=96|this.MAGIC_CODE_FLAG|i>>4&15,e[3]=112|this.MAGIC_CODE_FLAG|15&i,e},t.prototype.getSequencesData=function(t){for(var e=Math.ceil(1*t.length/this.DATAS_IN_ONE_SEQUENCE),i=[],r=null,s=0,a=0,o=0;o<e;o++)a=o===e-1?t.length-o*this.DATAS_IN_ONE_SEQUENCE:this.DATAS_IN_ONE_SEQUENCE,s=o*this.DATAS_IN_ONE_SEQUENCE,arraycopy(r=this.getSequenceField(o,t,s,a),0,i,s+(o<<1),r.length);return i},t.prototype.getSequenceField=function(t,e,i,r){var s=[],a=Array(r+2);s.push(t),arraycopy(e,i,s,1,r);var o=byteUtil.crc8Bytes(s,r+1);a[0]=this.SEQUENCE_HEADER_FLAG|o&255>>8-this.USE_BITS+2,a[1]=this.SEQUENCE_HEADER_FLAG|t&255>>8-this.USE_BITS+2;for(var n=0;n<r;++n)a[2+n]=this.DATA_FLAG|255&e[i+n];return a},t.prototype.startPrecursorBroadcast=function(){return tslib_1.__awaiter(this,void 0,void 0,(function(){var t,e,i,r,s,a,o,n;return tslib_1.__generator(this,(function(_){switch(_.label){case 0:t=0,e=this.mMagicCodeField,i=[1,2,3,4],r=new ArrayBuffer(1<<this.USE_BITS-1),s=Date.now(),a=s,_.label=1;case 1:if(!(a-s<this.SEND_PRECURSOR_DURATION_MS))return[3,6];n=0,_.label=2;case 2:return n<4?[4,this.socket.sendData({message:r,address:this.TARGET_ADDR,port:this.TARGET_PORT,length:i[n],timeDelay:this.INTERVAL_OF_PACKET_GUIDE_CODE})]:[3,5];case 3:_.sent(),_.label=4;case 4:return++n,[3,2];case 5:return a=Date.now(),[3,1];case 6:o=0,_.label=7;case 7:if(!(o<this.NUMBERS_OF_MAGICCODE))return[3,12];n=0,_.label=8;case 8:return n<e.length?[4,this.socket.sendData({message:r,address:this.TARGET_ADDR,port:this.TARGET_PORT,length:e[n],timeDelay:this.INTERVAL_OF_PACKET_DATA})]:[3,11];case 9:_.sent(),_.label=10;case 10:return++n,[3,8];case 11:return++o,[3,7];case 12:return[2,t]}}))}))},t.prototype.startPrecursorBroadcastUseSetTimeout=function(){var t=this;return new Promise((function(e,i){for(var r=t.mMagicCodeField,s=[1,2,3,4],a=new ArrayBuffer(1<<t.USE_BITS-1),o=[],n=0;n<t.SEND_PRECURSOR_DURATION_MS/(4*t.INTERVAL_OF_PACKET_GUIDE_CODE);n++)for(var _=0;_<4;++_)o.push(a.slice(0,s[_]));for(n=0;n<t.NUMBERS_OF_MAGICCODE;++n)for(_=0;_<r.length;++_)o.push(a.slice(0,r[_]));t.socket.sendDataSideBySide({data:o,address:t.TARGET_ADDR,port:t.TARGET_PORT,offset:0,length:o.length,timeDelay:t.INTERVAL_OF_PACKET_DATA,callback:function(){e()}})}))},t.prototype.startDataBroadcast=function(){return tslib_1.__awaiter(this,void 0,void 0,(function(){var t,e,i;return tslib_1.__generator(this,(function(r){switch(r.label){case 0:t=this.mPrefixCodeField,e=new ArrayBuffer(1<<this.USE_BITS),i=0,r.label=1;case 1:return i<t.length?[4,this.socket.sendData({message:e,address:this.TARGET_ADDR,port:this.TARGET_PORT,length:t[i],timeDelay:this.INTERVAL_OF_PACKET_DATA})]:[3,4];case 2:r.sent(),r.label=3;case 3:return++i,[3,1];case 4:i=0,r.label=5;case 5:return i<this.mSequencesData.length?[4,this.socket.sendData({message:e,address:this.TARGET_ADDR,port:this.TARGET_PORT,length:this.mSequencesData[i],timeDelay:this.INTERVAL_OF_PACKET_DATA})]:[3,8];case 6:r.sent(),r.label=7;case 7:return++i,[3,5];case 8:return[2]}}))}))},t.prototype.startDataBroadcastUseSetTimeout=function(){var t=this;return new Promise((function(e,i){for(var r=t.mPrefixCodeField,s=new ArrayBuffer(1<<t.USE_BITS),a=[],o=0;o<r.length;++o)a.push(s.slice(0,r[o]));for(o=0;o<t.mSequencesData.length;++o)a.push(s.slice(0,t.mSequencesData[o]));t.socket.sendDataSideBySide({data:a,address:t.TARGET_ADDR,port:t.TARGET_PORT,offset:0,length:a.length,timeDelay:t.INTERVAL_OF_PACKET_DATA,callback:function(){e()}})}))},t}();exports.AirKissProtocol=AirKissProtocol;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AirKissProtocol=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"),UDPSocket=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.utils.UDPSocket,byteUtil=qcloud_iotexplorer_appdev_sdk_1.AppDevSdk.utils.byteUtil;function arraycopy(t,e,i,r,s){i.splice.apply(i,tslib_1.__spread([r,0],t.slice(e,e+s)))}var AirKissProtocol=function(){function t(t,e){this.TARGET_ADDR="255.255.255.255",this.TARGET_PORT=10001,this.NUMBERS_OF_PRECURSOR=20,this.NUMBERS_OF_MAGICCODE=20,this.DATAS_IN_ONE_SEQUENCE=4,this.SEND_PRECURSOR_DURATION_MS=2e3,this.INTERVAL_OF_PACKET_DATA=5,this.INTERVAL_OF_PACKET_GUIDE_CODE=10,this.USE_BITS=9,this.MAGIC_CODE_FLAG=0,this.SEQUENCE_HEADER_FLAG=1<<this.USE_BITS-2,this.DATA_FLAG=1<<this.USE_BITS-1,this.mOriData=this.buildOriginalData(t,e),this.mValidPayload=this.buildValidPayload(this.mOriData),this.mMagicCodeField=this.getMagicCodeField(t,this.mOriData.length),this.mPrefixCodeField=this.getPrefixCodeField(e.length),this.mSequencesData=this.getSequencesData(this.mValidPayload),this.socket=new UDPSocket(1e4)}return t.prototype.destroy=function(){this.socket.destroy()},t.prototype.checkRandFromFeedback=function(t){var e=new DataView(t).getUint8(0);return console.log("checkRandFromFeedback",e,255&e,this.rand,255&this.rand,(255&e)==(255&this.rand)),(255&e)==(255&this.rand)},t.prototype.randomByte=function(){return String(127-Math.round(256*Math.random()))},t.prototype.buildOriginalData=function(t,e){return this.rand=this.randomByte(),tslib_1.__spread(byteUtil.stringToByteArray(e),[Number(this.rand)],byteUtil.getBytesByString(t))},t.prototype.buildValidPayload=function(t){for(var e,i,r,s,a=Math.ceil((t.length<<3)/(this.USE_BITS-1)),o=Array(a),n=0;n<a;++n)e=n*(this.USE_BITS-1)>>3,i=n*(this.USE_BITS-1)&7,r=((255&t[e])<<i&255)>>8-this.USE_BITS+1,s=n+1===a?0:(255&t[e+1])>>8-i>>8-this.USE_BITS+1,o[n]=String(r|s);return o},t.prototype.getMagicCodeField=function(t,e){var i=Array(4),r=byteUtil.stringToUtf8ByteArray(t),s=byteUtil.crc8Bytes(r,r.length);return e<16&&(e+=128),i[0]=0|this.MAGIC_CODE_FLAG|e>>4&15,i[1]=16|this.MAGIC_CODE_FLAG|15&e,i[2]=32|this.MAGIC_CODE_FLAG|s>>4&15,i[3]=48|this.MAGIC_CODE_FLAG|15&s,i},t.prototype.getPrefixCodeField=function(t){var e=Array(4),i=byteUtil.crc8Bytes([t],1);return e[0]=64|this.MAGIC_CODE_FLAG|t>>4&15,e[1]=80|this.MAGIC_CODE_FLAG|15&t,e[2]=96|this.MAGIC_CODE_FLAG|i>>4&15,e[3]=112|this.MAGIC_CODE_FLAG|15&i,e},t.prototype.getSequencesData=function(t){for(var e=Math.ceil(1*t.length/this.DATAS_IN_ONE_SEQUENCE),i=[],r=null,s=0,a=0,o=0;o<e;o++)a=o===e-1?t.length-o*this.DATAS_IN_ONE_SEQUENCE:this.DATAS_IN_ONE_SEQUENCE,s=o*this.DATAS_IN_ONE_SEQUENCE,arraycopy(r=this.getSequenceField(o,t,s,a),0,i,s+(o<<1),r.length);return i},t.prototype.getSequenceField=function(t,e,i,r){var s=[],a=Array(r+2);s.push(t),arraycopy(e,i,s,1,r);var o=byteUtil.crc8Bytes(s,r+1);a[0]=this.SEQUENCE_HEADER_FLAG|o&255>>8-this.USE_BITS+2,a[1]=this.SEQUENCE_HEADER_FLAG|t&255>>8-this.USE_BITS+2;for(var n=0;n<r;++n)a[2+n]=this.DATA_FLAG|255&e[i+n];return a},t.prototype.startPrecursorBroadcast=function(){return tslib_1.__awaiter(this,void 0,void 0,(function(){var t,e,i,r,s,a,o,n;return tslib_1.__generator(this,(function(_){switch(_.label){case 0:t=0,e=this.mMagicCodeField,i=[1,2,3,4],r=new ArrayBuffer(1<<this.USE_BITS-1),s=Date.now(),a=s,_.label=1;case 1:if(!(a-s<this.SEND_PRECURSOR_DURATION_MS))return[3,6];n=0,_.label=2;case 2:return n<4?[4,this.socket.sendData({message:r,address:this.TARGET_ADDR,port:this.TARGET_PORT,length:i[n],timeDelay:this.INTERVAL_OF_PACKET_GUIDE_CODE})]:[3,5];case 3:_.sent(),_.label=4;case 4:return++n,[3,2];case 5:return a=Date.now(),[3,1];case 6:o=0,_.label=7;case 7:if(!(o<this.NUMBERS_OF_MAGICCODE))return[3,12];n=0,_.label=8;case 8:return n<e.length?[4,this.socket.sendData({message:r,address:this.TARGET_ADDR,port:this.TARGET_PORT,length:e[n],timeDelay:this.INTERVAL_OF_PACKET_DATA})]:[3,11];case 9:_.sent(),_.label=10;case 10:return++n,[3,8];case 11:return++o,[3,7];case 12:return[2,t]}}))}))},t.prototype.startPrecursorBroadcastUseSetTimeout=function(){var t=this;return new Promise((function(e,i){for(var r=t.mMagicCodeField,s=[1,2,3,4],a=new ArrayBuffer(1<<t.USE_BITS-1),o=[],n=0;n<t.SEND_PRECURSOR_DURATION_MS/(4*t.INTERVAL_OF_PACKET_GUIDE_CODE);n++)for(var _=0;_<4;++_)o.push(a.slice(0,s[_]));for(n=0;n<t.NUMBERS_OF_MAGICCODE;++n)for(_=0;_<r.length;++_)o.push(a.slice(0,r[_]));t.socket.sendDataSideBySide({data:o,address:t.TARGET_ADDR,port:t.TARGET_PORT,offset:0,length:o.length,timeDelay:t.INTERVAL_OF_PACKET_DATA,callback:function(){e()}})}))},t.prototype.startDataBroadcast=function(){return tslib_1.__awaiter(this,void 0,void 0,(function(){var t,e,i;return tslib_1.__generator(this,(function(r){switch(r.label){case 0:t=this.mPrefixCodeField,e=new ArrayBuffer(1<<this.USE_BITS),i=0,r.label=1;case 1:return i<t.length?[4,this.socket.sendData({message:e,address:this.TARGET_ADDR,port:this.TARGET_PORT,length:t[i],timeDelay:this.INTERVAL_OF_PACKET_DATA})]:[3,4];case 2:r.sent(),r.label=3;case 3:return++i,[3,1];case 4:i=0,r.label=5;case 5:return i<this.mSequencesData.length?[4,this.socket.sendData({message:e,address:this.TARGET_ADDR,port:this.TARGET_PORT,length:this.mSequencesData[i],timeDelay:this.INTERVAL_OF_PACKET_DATA})]:[3,8];case 6:r.sent(),r.label=7;case 7:return++i,[3,5];case 8:return[2]}}))}))},t.prototype.startDataBroadcastUseSetTimeout=function(){var t=this;return new Promise((function(e,i){for(var r=t.mPrefixCodeField,s=new ArrayBuffer(1<<t.USE_BITS),a=[],o=0;o<r.length;++o)a.push(s.slice(0,r[o]));for(o=0;o<t.mSequencesData.length;++o)a.push(s.slice(0,t.mSequencesData[o]));t.socket.sendDataSideBySide({data:a,address:t.TARGET_ADDR,port:t.TARGET_PORT,offset:0,length:a.length,timeDelay:t.INTERVAL_OF_PACKET_DATA,callback:function(){e()}})}))},t}();exports.AirKissProtocol=AirKissProtocol;
//# sourceMappingURL=AirKissProtocol.js.map

@@ -8,3 +8,7 @@ export class AirKissTask {

airKissProcessing: boolean;
airKissPromise: any;
airKissPromise: {
resolve: Function;
reject: Function;
promise: Promise<any>;
};
sendAirKissData(): Promise<void>;

@@ -11,0 +15,0 @@ startAirKiss(): Promise<any>;

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AirKissTask=void 0;var tslib_1=require("tslib"),AirKissProtocol_1=require("./AirKissProtocol"),_utillib_1=require("@utillib"),TASK_TIMEOUT=3e4,AirKissTask=function(){function s(s,r){var i=this;this.SEND_DATA_PER_CIRCLE_TIME=3e3,this.ssid=s,this.pwd=r,this.airKissProtocol=new AirKissProtocol_1.AirKissProtocol(this.ssid,this.pwd),this.airKissProcessing=!1,this.airKissPromise=_utillib_1.genPromise(),this.airKissProtocol.socket.on("message",(function(s){try{i.airKissProtocol.checkRandFromFeedback(s.message)&&(i.airKissProcessing=!1,s.remoteInfo?i.airKissPromise.resolve(s.remoteInfo.address):i.airKissPromise.reject({code:"PROTOCOL_INVALID_RESPONSE"}))}catch(s){console.log("onMessage error",s)}})).on("error",(function(s){var r=s.errMsg;i.airKissProcessing&&i.airKissPromise.reject({code:"UDP_ERROR",errMsg:r})})).on("close",(function(){i.airKissProcessing&&i.airKissPromise.reject({code:"UDP_CLOSED"})}))}return s.prototype.sendAirKissData=function(){return tslib_1.__awaiter(this,void 0,void 0,(function(){var s,r,i,e;return tslib_1.__generator(this,(function(t){switch(t.label){case 0:r=(s={android:{precursor:"startPrecursorBroadcastUseSetTimeout",data:"startDataBroadcastUseSetTimeout"},ios:{precursor:"startPrecursorBroadcast",data:"startDataBroadcast"}})[wx.getSystemInfoSync().platform]||s.ios,t.label=1;case 1:return this.airKissProcessing?[4,this.airKissProtocol[r.precursor]()]:[3,6];case 2:t.sent(),i=Date.now(),e=Date.now(),t.label=3;case 3:return i-e<=this.SEND_DATA_PER_CIRCLE_TIME?[4,this.airKissProtocol[r.data]()]:[3,5];case 4:return t.sent(),i=Date.now(),[3,3];case 5:return[3,1];case 6:return[2]}}))}))},s.prototype.startAirKiss=function(){return tslib_1.__awaiter(this,void 0,void 0,(function(){var s,r,i=this;return tslib_1.__generator(this,(function(e){switch(e.label){case 0:if(this.airKissProcessing)return[2,Promise.reject("AirKiss当前正在执行配网流程")];e.label=1;case 1:return e.trys.push([1,3,,4]),this.airKissProcessing=!0,[4,Promise.race([new Promise((function(s,r){return tslib_1.__awaiter(i,void 0,void 0,(function(){var s;return tslib_1.__generator(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.sendAirKissData()];case 1:return i.sent(),[3,3];case 2:return s=i.sent(),this.airKissProcessing&&r({code:"PROTOCOL_FAIL",error:s}),[3,3];case 3:return[2]}}))}))})),this.airKissPromise.promise,new Promise((function(s,r){setTimeout((function(){r({code:"PROTOCOL_TIMEOUT"})}),TASK_TIMEOUT)}))])];case 2:return s=e.sent(),this.airKissProcessing=!1,this.airKissProtocol.destroy(),[2,s];case 3:return r=e.sent(),this.airKissProcessing=!1,this.destroy(),[2,Promise.reject(r)];case 4:return[2]}}))}))},s.prototype.destroy=function(){this.airKissProcessing=!1,this.airKissProtocol.destroy()},s}();exports.AirKissTask=AirKissTask;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.AirKissTask=void 0;var tslib_1=require("tslib"),qcloud_iotexplorer_appdev_sdk_1=require("qcloud-iotexplorer-appdev-sdk"),AirKissProtocol_1=require("./AirKissProtocol"),TASK_TIMEOUT=3e4,AirKissTask=function(){function s(s,r){var i=this;this.SEND_DATA_PER_CIRCLE_TIME=3e3,this.ssid=s,this.pwd=r,this.airKissProtocol=new AirKissProtocol_1.AirKissProtocol(this.ssid,this.pwd),this.airKissProcessing=!1,this.airKissPromise=qcloud_iotexplorer_appdev_sdk_1.AppDevSdk.utils.genPromise(),this.airKissProtocol.socket.on("message",(function(s){try{i.airKissProtocol.checkRandFromFeedback(s.message)&&(i.airKissProcessing=!1,s.remoteInfo?i.airKissPromise.resolve(s.remoteInfo.address):i.airKissPromise.reject({code:"PROTOCOL_INVALID_RESPONSE"}))}catch(s){console.log("onMessage error",s)}})).on("error",(function(s){var r=s.errMsg;i.airKissProcessing&&i.airKissPromise.reject({code:"UDP_ERROR",errMsg:r})})).on("close",(function(){i.airKissProcessing&&i.airKissPromise.reject({code:"UDP_CLOSED"})}))}return s.prototype.sendAirKissData=function(){return tslib_1.__awaiter(this,void 0,void 0,(function(){var s,r,i,e;return tslib_1.__generator(this,(function(t){switch(t.label){case 0:r=(s={android:{precursor:"startPrecursorBroadcastUseSetTimeout",data:"startDataBroadcastUseSetTimeout"},ios:{precursor:"startPrecursorBroadcast",data:"startDataBroadcast"}})[wx.getSystemInfoSync().platform]||s.ios,t.label=1;case 1:return this.airKissProcessing?[4,this.airKissProtocol[r.precursor]()]:[3,6];case 2:t.sent(),i=Date.now(),e=Date.now(),t.label=3;case 3:return i-e<=this.SEND_DATA_PER_CIRCLE_TIME?[4,this.airKissProtocol[r.data]()]:[3,5];case 4:return t.sent(),i=Date.now(),[3,3];case 5:return[3,1];case 6:return[2]}}))}))},s.prototype.startAirKiss=function(){return tslib_1.__awaiter(this,void 0,void 0,(function(){var s,r,i=this;return tslib_1.__generator(this,(function(e){switch(e.label){case 0:if(this.airKissProcessing)return[2,Promise.reject("AirKiss当前正在执行配网流程")];e.label=1;case 1:return e.trys.push([1,3,,4]),this.airKissProcessing=!0,[4,Promise.race([new Promise((function(s,r){return tslib_1.__awaiter(i,void 0,void 0,(function(){var s;return tslib_1.__generator(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.sendAirKissData()];case 1:return i.sent(),[3,3];case 2:return s=i.sent(),this.airKissProcessing&&r({code:"PROTOCOL_FAIL",error:s}),[3,3];case 3:return[2]}}))}))})),this.airKissPromise.promise,new Promise((function(s,r){setTimeout((function(){r({code:"PROTOCOL_TIMEOUT"})}),TASK_TIMEOUT)}))])];case 2:return s=e.sent(),this.airKissProcessing=!1,this.airKissProtocol.destroy(),[2,s];case 3:return r=e.sent(),this.airKissProcessing=!1,this.destroy(),[2,Promise.reject(r)];case 4:return[2]}}))}))},s.prototype.destroy=function(){this.airKissProcessing=!1,this.airKissProtocol.destroy()},s}();exports.AirKissTask=AirKissTask;
//# sourceMappingURL=AirKissTask.js.map

@@ -1,4 +0,4 @@

import { AppDevPlugin } from 'qcloud-iotexplorer-appdev-sdk';
import { AppDevPlugin, AppDevSdk } from 'qcloud-iotexplorer-appdev-sdk';
export default class Plugin implements AppDevPlugin {
static install(sdk: any): void;
static install(sdk: AppDevSdk): void;
}

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib_1=require("tslib"),qcloud_iotexplorer_appdev_plugin_wificonf_core_1=require("qcloud-iotexplorer-appdev-plugin-wificonf-core"),AirKissTask_1=require("./airkiss/AirKissTask"),WifiConfStepCode=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.constants.WifiConfStepCode,WifiConfStepDesp=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.constants.WifiConfStepDesp,AirKissWifiConf=function(i){function e(){return null!==i&&i.apply(this,arguments)||this}return tslib_1.__extends(e,i),e.prototype.doProtocol=function(i){return tslib_1.__awaiter(this,void 0,void 0,(function(){var e;return tslib_1.__generator(this,(function(o){switch(o.label){case 0:return e=this,[4,new AirKissTask_1.AirKissTask({apSsid:i.SSID,apBssid:i.BSSID,apPassword:i.password,logger:{info:function(i,o){void 0===o&&(o={}),e.sdk.reporter.info(WifiConfStepCode.PROTOCOL_DETAIL,{message:WifiConfStepCode.PROTOCOL_DETAIL+"("+WifiConfStepDesp[WifiConfStepCode.PROTOCOL_DETAIL]+": "+i+")",data:o})},error:function(i){void 0===i&&(i={}),e.sdk.reporter.error("PROTOCOL_FAIL",{error:i})}}}).startAirKiss()];case 1:return[2,{address:o.sent()}]}}))}))},e}(qcloud_iotexplorer_appdev_plugin_wificonf_core_1.WifiConfProtocolBase),Plugin=function(){function i(){}return i.install=function(i){i.plugins.wifiConfAirKiss={start:function(i,e){return new AirKissWifiConf(i,tslib_1.__assign({wifiConfType:"AirKiss"},e)).start()}}},i}();exports.default=Plugin;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib_1=require("tslib"),qcloud_iotexplorer_appdev_plugin_wificonf_core_1=require("qcloud-iotexplorer-appdev-plugin-wificonf-core"),AirKissTask_1=require("./airkiss/AirKissTask"),WifiConfStepCode=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.constants.WifiConfStepCode,WifiConfStepDesp=qcloud_iotexplorer_appdev_plugin_wificonf_core_1.constants.WifiConfStepDesp,AirKissWifiConf=function(i){function e(){return null!==i&&i.apply(this,arguments)||this}return tslib_1.__extends(e,i),e.prototype.doProtocol=function(i){return tslib_1.__awaiter(this,void 0,void 0,(function(){return tslib_1.__generator(this,(function(e){switch(e.label){case 0:return this,[4,new AirKissTask_1.AirKissTask(i.SSID,i.password).startAirKiss()];case 1:return[2,{address:e.sent()}]}}))}))},e}(qcloud_iotexplorer_appdev_plugin_wificonf_core_1.WifiConfProtocolBase),Plugin=function(){function i(){}return i.install=function(i){i.plugins.wifiConfAirKiss={start:function(e){return new AirKissWifiConf(i,tslib_1.__assign({wifiConfType:"AirKiss"},e)).start()}}},i}();exports.default=Plugin;
//# sourceMappingURL=index.js.map
{
"name": "qcloud-iotexplorer-appdev-plugin-wificonf-airkiss",
"version": "1.0.1",
"version": "1.0.2",
"description": "",

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

"dependencies": {
"event-emitter-for-miniprogram": "^0.0.4",
"qcloud-iotexplorer-appdev-plugin-wificonf-core": "^1.0.1",
"qcloud-iotexplorer-appdev-sdk": "^1.0.12"
"qcloud-iotexplorer-appdev-plugin-wificonf-core": "^1.0.3",
"qcloud-iotexplorer-appdev-sdk": "^1.0.13"
},

@@ -21,0 +20,0 @@ "devDependencies": {

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