提交 c5ff2c96 编写于 作者: lizhongyi_'s avatar lizhongyi_

fix : uni-wifi iOS相关接口错误信息统一调整

上级 5539c89d
...@@ -14,7 +14,7 @@ type WifiOption = { ...@@ -14,7 +14,7 @@ type WifiOption = {
}; };
/** /**
* Wifi 链接参数封装 * Wifi 链接参数封装
*/ */
type WifiConnectOption = { type WifiConnectOption = {
SSID: string; SSID: string;
...@@ -149,19 +149,30 @@ function fetchConnectedWifiWithLocationPromise(option: GetConnectedWifiOptions) ...@@ -149,19 +149,30 @@ function fetchConnectedWifiWithLocationPromise(option: GetConnectedWifiOptions)
if (wifiInfo.BSSID.length > 0 && wifiInfo.SSID.length > 0) { if (wifiInfo.BSSID.length > 0 && wifiInfo.SSID.length > 0) {
let res = { let res = {
errSubject: "uni-getConnectedWifi",
errCode: 0, errCode: 0,
errMsg: "getConnectedWifi:success", errMsg: "getConnectedWifi:ok",
wifi: wifiInfo, wifi: wifiInfo,
} }
option.success?.(res) option.success?.(res)
option.complete?.(res) option.complete?.(res)
}else { }else {
option.fail?.({errCode: 12000, errMsg: "current wifi is null"}) const res = {
option.complete?.({errCode: 12000, errMsg: "current wifi is null"}) errSubject: "uni-getConnectedWifi",
errCode: 12010,
errMsg: "getConnectedWifi:system internal error"
}
option.fail?.(res)
option.complete?.(res)
} }
}else { }else {
option.fail?.({errCode: 12000, errMsg: "current wifi is null"}) const res = {
option.complete?.({errCode: 12000, errMsg: "current wifi is null"}) errSubject: "uni-getConnectedWifi",
errCode: 12010,
errMsg: "getConnectedWifi:system internal error"
}
option.fail?.(res)
option.complete?.(res)
} }
} }
...@@ -184,8 +195,9 @@ class UniWiFiModuleGloabInfo { ...@@ -184,8 +195,9 @@ class UniWiFiModuleGloabInfo {
export function startWifi(option: WifiOption) { export function startWifi(option: WifiOption) {
UniWiFiModuleGloabInfo.alreadyStartWifi = true UniWiFiModuleGloabInfo.alreadyStartWifi = true
let res = { let res = {
errSubject: "uni-startWifi",
errCode: 0, errCode: 0,
errMsg: "startWifi: ok" errMsg: "startWifi:ok"
} }
option.success?.(res) option.success?.(res)
option.complete?.(res) option.complete?.(res)
...@@ -194,9 +206,16 @@ export function startWifi(option: WifiOption) { ...@@ -194,9 +206,16 @@ export function startWifi(option: WifiOption) {
/* /*
* 停止wifi模块 * 停止wifi模块
*/ */
export function stopWifi() { export function stopWifi(option: WifiOption) {
UniWiFiModuleGloabInfo.alreadyStartWifi = false UniWiFiModuleGloabInfo.alreadyStartWifi = false
LocationPromiseService.promiseCompletionHandler = [] LocationPromiseService.promiseCompletionHandler = []
let res = {
errSubject: "uni-stopWifi",
errCode: 0,
errMsg: "stopWifi:ok"
}
option.success?.(res)
option.complete?.(res)
} }
/* /*
...@@ -204,8 +223,9 @@ export function stopWifi() { ...@@ -204,8 +223,9 @@ export function stopWifi() {
*/ */
export function getWifiList(option: WifiOption) { export function getWifiList(option: WifiOption) {
let res = { let res = {
errSubject: "uni-getWifiList",
errCode: 12001, errCode: 12001,
errMsg: "system not support" errMsg: "getWifiList:system not support"
} }
option.fail?.(res) option.fail?.(res)
option.complete?.(res) option.complete?.(res)
...@@ -230,18 +250,11 @@ export function offGetWifiList(callback: UTSCallback) { ...@@ -230,18 +250,11 @@ export function offGetWifiList(callback: UTSCallback) {
* 获取当前连接的wifi信息 * 获取当前连接的wifi信息
*/ */
export function getConnectedWifi(option: GetConnectedWifiOptions) { export function getConnectedWifi(option: GetConnectedWifiOptions) {
let wifiInfo = new UniWifiInfo()
wifiInfo.SSID = ""
wifiInfo.BSSID = ""
wifiInfo.secure = false
wifiInfo.signalStrength = 0
wifiInfo.frequency = 0
if (UniWiFiModuleGloabInfo.alreadyStartWifi == false) { if (UniWiFiModuleGloabInfo.alreadyStartWifi == false) {
let res = { let res = {
errSubject: "uni-getConnectedWifi",
errCode: 12000, errCode: 12000,
errMsg: "getConnectedWifi: not init", errMsg: "getConnectedWifi:not init",
wifi: wifiInfo
} }
option.fail?.(res) option.fail?.(res)
option.complete?.(res) option.complete?.(res)
...@@ -252,9 +265,9 @@ export function getConnectedWifi(option: GetConnectedWifiOptions) { ...@@ -252,9 +265,9 @@ export function getConnectedWifi(option: GetConnectedWifiOptions) {
fetchConnectedWifiWithLocationPromise(option) fetchConnectedWifiWithLocationPromise(option)
}else { }else {
let res = { let res = {
errCode: 12010, errSubject: "uni-getConnectedWifi",
errMsg: "have no location promise", errCode: 12007,
wifi: wifiInfo errMsg: "getConnectedWifi:user denied",
} }
option.fail?.(res) option.fail?.(res)
option.complete?.(res) option.complete?.(res)
...@@ -271,8 +284,9 @@ export function getConnectedWifi(option: GetConnectedWifiOptions) { ...@@ -271,8 +284,9 @@ export function getConnectedWifi(option: GetConnectedWifiOptions) {
*/ */
export function connectWifi(option: WifiConnectOption) { export function connectWifi(option: WifiConnectOption) {
let res = { let res = {
errSubject: "uni-connectWifi",
errCode: 12001, errCode: 12001,
errMsg: "system not support" errMsg: "connectWifi:system not support"
} }
option.fail?.(res) option.fail?.(res)
option.complete?.(res) option.complete?.(res)
...@@ -312,8 +326,9 @@ export function onOffWifiConnectedWithPartialInfo(callback: UTSCallback | null) ...@@ -312,8 +326,9 @@ export function onOffWifiConnectedWithPartialInfo(callback: UTSCallback | null)
*/ */
export function setWifiList(option: WifiOption) { export function setWifiList(option: WifiOption) {
let res = { let res = {
errSubject: "uni-setWifiList",
errCode: 12001, errCode: 12001,
errMsg: "system not support" errMsg: "setWifiList:system not support"
} }
option.fail?.(res) option.fail?.(res)
option.complete?.(res) option.complete?.(res)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册