/** * Wifi 函数通用入参封装 */ export type WifiOption = { success?: (res: UniWifiResult) => void; fail?: (res: UniWifiResult) => void; complete?: (res: UniWifiResult) => void; }; /** * Wifi 链接参数封装 */ export type WifiConnectOption = { SSID: string; BSSID: string; password: string; maunal: boolean; partialInfo: boolean; //ios不生效 success?: (res: UniWifiResult) => void; fail?: (res: UniWifiResult) => void; complete?: (res: UniWifiResult) => void; } /** * 获取当前链接的wifi信息 */ export type GetConnectedWifiOptions = { partialInfo?: boolean success?: (res: UniWifiResult) => void fail?: (res: UniWifiResult) => void complete?: (res: UniWifiResult) => void } /* * 对外暴露的wifi信息 */ export type UniWifiInfo = { SSID: string; BSSID: string; secure: boolean; signalStrength: number; frequency: number; } export type UniWifiResult = { errCode : number, errSubject : string, errMsg : string, wifi: UniWifiInfo | null } export type UniWifiCallback = () => void export type StartWifi = (option: WifiOption) => void export type StopWifi = (option: WifiOption) => void export type GetWifiList = (option: WifiOption) => void export type OnGetWifiList = (callback: UniWifiCallback) => void export type OffGetWifiList = (callback: UniWifiCallback) => void export type GetConnectedWifi = (option: GetConnectedWifiOptions) => void export type ConnectWifi = (option: WifiConnectOption) => void export type OnWifiConnected = (callback: UniWifiCallback) => void export type OnWifiConnectedWithPartialInfo = (callback: UniWifiCallback) => void export type OffWifiConnected = (callback: UniWifiCallback | null) => void export type OnOffWifiConnectedWithPartialInfo = (callback: UniWifiCallback | null) => void export type SetWifiList = (option: WifiOption) => void interface uni { startWifi : StartWifi, stopWifi : StopWifi, getWifiList : GetWifiList, onGetWifiList : OnGetWifiList, offGetWifiList : OffGetWifiList, getConnectedWifi : GetConnectedWifi, onWifiConnected : OnWifiConnected, onWifiConnectedWithPartialInfo : OnWifiConnectedWithPartialInfo, offWifiConnected : OffWifiConnected, onOffWifiConnectedWithPartialInfo : OnOffWifiConnectedWithPartialInfo, setWifiList : SetWifiList, }