"use strict";const i=require("../common/vendor.js");exports.scanWifiList=[];let t="start";const s=i=>{console.log("wifi数据变化",i.wifiList.length),exports.scanWifiList=c(i.wifiList)},e=(e,o)=>({success:o=>{console.log("操作wifi成功","start"===t),"start"===t&&(console.log("_WifiChange"),i.index.onGetWifiList(s)),e(o)},fail:i=>{console.error("操作wifi失败",i),o(new Error(i))}});function o(){i.index.offGetWifiList(s)}function n(){return t="stop",new Promise(((t,s)=>{i.index.stopWifi(e(t,s))}))}const r=()=>new Promise(((s,o)=>{t="start",i.index.startWifi(e(s,o))})),f=()=>new Promise(((t,e)=>{i.index.getWifiList({success:e=>{console.log("扫描 WIFI 成功",e),i.index.onGetWifiList(s),t(e)},fail:i=>{console.log("扫描 WIFI 失败",i),e(i)}})})),c=i=>i.map((i=>{const{signalStrength:t}=i;return i.signalStrength=parseInt(100-t/2),i.macAddress=i.BSSID,i.ssid=i.SSID,i.frequency=i.frequency,i})),a=Object.freeze(Object.defineProperty({__proto__:null,firstStartWifi:r,scanWifi:f,get scanWifiList(){return exports.scanWifiList},stoWifi:n,stopScanWifi:o},Symbol.toStringTag,{value:"Module"}));exports.firstStartWifi=r,exports.scanWifi=f,exports.stoWifi=n,exports.stopScanWifi=o,exports.wifiManager=a;
