mirror of
https://github.com/openharmony/third_party_jsframework.git
synced 2026-07-18 12:35:31 -04:00
!424 update wifi and wifiext mock file
Merge pull request !424 from Zhangfeng/master
This commit is contained in:
@@ -71,6 +71,7 @@ import { mockInputDevice } from './ohos_multimodalInput_inputDevice'
|
||||
import { mockVibrator } from './ohos_vibrator'
|
||||
import { mockSensor } from './ohos_sensor'
|
||||
import { mockWifi } from './ohos_wifi'
|
||||
import { mockWifiExt } from './ohos_wifiext'
|
||||
import { mockUsb } from './ohos_usb'
|
||||
import { mockBundle } from './ohos_bundle'
|
||||
import { mockInnerBundle } from './ohos_bundle_innerBundleManager'
|
||||
@@ -390,6 +391,8 @@ export function mockRequireNapiFun() {
|
||||
return mockSensor();
|
||||
case "wifi":
|
||||
return mockWifi();
|
||||
case "wifiext":
|
||||
return mockWifiExt();
|
||||
case "usb":
|
||||
return mockUsb();
|
||||
case "bundle":
|
||||
|
||||
@@ -16,7 +16,88 @@
|
||||
import { paramMock } from "../utils"
|
||||
|
||||
export function mockWifi() {
|
||||
const linkedInfoMock = {
|
||||
const EapMethod = {
|
||||
EAP_NONE : 0,
|
||||
EAP_PEAP : 1,
|
||||
EAP_TLS : 2,
|
||||
EAP_TTLS : 3,
|
||||
EAP_PWD : 4,
|
||||
EAP_SIM : 5,
|
||||
EAP_AKA : 6,
|
||||
EAP_AKA_PRIME : 7,
|
||||
EAP_UNAUTH_TLS : 8,
|
||||
}
|
||||
|
||||
const Phase2Method = {
|
||||
PHASE2_NONE : 0,
|
||||
PHASE2_PAP : 1,
|
||||
PHASE2_MSCHAP : 2,
|
||||
PHASE2_MSCHAPV2 : 3,
|
||||
PHASE2_GTC : 4,
|
||||
PHASE2_SIM : 5,
|
||||
PHASE2_AKA : 6,
|
||||
PHASE2_AKA_PRIME : 7,
|
||||
}
|
||||
|
||||
const WifiSecurityType = {
|
||||
WIFI_SEC_TYPE_INVALID : 0,
|
||||
WIFI_SEC_TYPE_OPEN : 1,
|
||||
WIFI_SEC_TYPE_WEP : 2,
|
||||
WIFI_SEC_TYPE_PSK : 3,
|
||||
WIFI_SEC_TYPE_SAE : 4,
|
||||
WIFI_SEC_TYPE_EAP : 5,
|
||||
WIFI_SEC_TYPE_EAP_SUITE_B : 6,
|
||||
WIFI_SEC_TYPE_OWE : 7,
|
||||
WIFI_SEC_TYPE_WAPI_CERT : 8,
|
||||
WIFI_SEC_TYPE_WAPI_PSK : 9,
|
||||
}
|
||||
|
||||
const IpType = {
|
||||
STATIC : 0,
|
||||
DHCP : 1,
|
||||
UNKNOWN : 2,
|
||||
}
|
||||
|
||||
const SuppState = {
|
||||
DISCONNECTED : 0,
|
||||
INTERFACE_DISABLED : 1,
|
||||
INACTIVE : 2,
|
||||
SCANNING : 3,
|
||||
AUTHENTICATING : 4,
|
||||
ASSOCIATING : 5,
|
||||
ASSOCIATED : 6,
|
||||
FOUR_WAY_HANDSHAKE : 7,
|
||||
GROUP_HANDSHAKE : 8,
|
||||
COMPLETED : 9,
|
||||
UNINITIALIZED : 10,
|
||||
INVALID : 11,
|
||||
}
|
||||
|
||||
const ConnState = {
|
||||
SCANNING : 0,
|
||||
CONNECTING : 1,
|
||||
AUTHENTICATING : 2,
|
||||
OBTAINING_IPADDR : 3,
|
||||
CONNECTED : 4,
|
||||
DISCONNECTING : 5,
|
||||
DISCONNECTED : 6,
|
||||
UNKNOWN : 7,
|
||||
}
|
||||
|
||||
const P2pConnectState = {
|
||||
DISCONNECTED : 0,
|
||||
CONNECTED : 1,
|
||||
}
|
||||
|
||||
const P2pDeviceStatus = {
|
||||
CONNECTED : 0,
|
||||
INVITED : 1,
|
||||
FAILED : 2,
|
||||
AVAILABLE : 3,
|
||||
UNAVAILABLE : 4,
|
||||
}
|
||||
|
||||
const WifiLinkedInfo = {
|
||||
ssid: '[PC preview] unknow ssid',
|
||||
bssid: '[PC preview] unknow bssid',
|
||||
networkId: '[PC preview] unknow networkId',
|
||||
@@ -28,77 +109,119 @@ export function mockWifi() {
|
||||
isRestricted: '[PC preview] unknow isRestricted',
|
||||
chload: '[PC preview] unknow chload',
|
||||
snr: '[PC preview] unknow snr',
|
||||
macType: '[PC preview] unknow macType',
|
||||
macAddress: '[PC preview] unknow macAddress',
|
||||
ipAddress: '[PC preview] unknow ipAddress',
|
||||
suppState: '[PC preview] unknow suppState',
|
||||
connState: '[PC preview] unknow connState'
|
||||
suppState: SuppState.INVALID,
|
||||
connState: ConnState.DISCONNECTED,
|
||||
}
|
||||
|
||||
const ipInfoMock = {
|
||||
const IpInfo = {
|
||||
ipAddress: '[PC preview] unknow ipAddress',
|
||||
gateway: '[PC preview] unknow gateway',
|
||||
netmask: '[PC preview] unknow netmask',
|
||||
primaryDns: '[PC preview] unknow primaryDns',
|
||||
secondDns: '[PC preview] unknow secondDns',
|
||||
serverIp: '[PC preview] unknow serverIp',
|
||||
leaseDuration: '[PC preview] unknow leaseDuration'
|
||||
leaseDuration: '[PC preview] unknow leaseDuration',
|
||||
}
|
||||
|
||||
const wifiScanInfoMock = {
|
||||
const WifiInfoElem = {
|
||||
eid: '[PC preview] unknow eid',
|
||||
content: '[PC preview] unknow content',
|
||||
}
|
||||
|
||||
const WifiScanInfo = {
|
||||
ssid: '[PC preview] unknow ssid',
|
||||
bssid: '[PC preview] unknow bssid',
|
||||
securityType: '[PC preview] unknow securityType',
|
||||
capabilities: '[PC preview] unknow capabilities',
|
||||
securityType: WifiSecurityType.WIFI_SEC_TYPE_OPEN,
|
||||
rssi: '[PC preview] unknow rssi',
|
||||
band: '[PC preview] unknow band',
|
||||
frequency: '[PC preview] unknow frequency',
|
||||
channelWidth: '[PC preview] unknow channelWidth',
|
||||
centerFrequency0: '[PC preview] unknow centerFrequency0',
|
||||
centerFrequency1: '[PC preview] unknow centerFrequency1',
|
||||
infoElems: [WifiInfoElem],
|
||||
timestamp: '[PC preview] unknow timestamp',
|
||||
}
|
||||
|
||||
const wifiDeviceConfigMock = {
|
||||
const IpConfig = {
|
||||
ipAddress: '[PC preview] unknow ipAddress',
|
||||
gateway: '[PC preview] unknow gateway',
|
||||
dnsServers: [paramMock.paramNumberMock],
|
||||
domains: [paramMock.paramStringMock],
|
||||
}
|
||||
|
||||
const WifiEapConfig = {
|
||||
eapMethod: EapMethod.EAP_NONE,
|
||||
phase2Method: Phase2Method.PHASE2_NONE,
|
||||
identity: '[PC preview] unknow identity',
|
||||
anonymousIdentity: '[PC preview] unknow anonymousIdentity',
|
||||
password: '[PC preview] unknow password',
|
||||
caCertAliases: '[PC preview] unknow caCertAliases',
|
||||
caPath: '[PC preview] unknow caPath',
|
||||
clientCertAliases: '[PC preview] unknow clientCertAliases',
|
||||
altSubjectMatch: '[PC preview] unknow altSubjectMatch',
|
||||
domainSuffixMatch: '[PC preview] unknow domainSuffixMatch',
|
||||
realm: '[PC preview] unknow realm',
|
||||
plmn: '[PC preview] unknow plmn',
|
||||
eapSubId: '[PC preview] unknow eapSubId',
|
||||
}
|
||||
|
||||
const WifiDeviceConfig = {
|
||||
ssid: '[PC preview] unknow ssid',
|
||||
bssid: '[PC preview] unknow bssid',
|
||||
preSharedKey: '[PC preview] unknow preSharedKey',
|
||||
isHiddenSsid: '[PC preview] unknow isHiddenSsid',
|
||||
securityType: '[PC preview] unknow securityType',
|
||||
securityType: WifiSecurityType.WIFI_SEC_TYPE_OPEN,
|
||||
creatorUid: '[PC preview] unknow creatorUid',
|
||||
disableReason: '[PC preview] unknow disableReason',
|
||||
netId: '[PC preview] unknow netId',
|
||||
randomMacType: '[PC preview] unknow randomMacType',
|
||||
randomMacAddr: '[PC preview] unknow randomMacAddr',
|
||||
ipType: IpType.DHCP,
|
||||
staticIp: IpConfig,
|
||||
eapConfig: WifiEapConfig,
|
||||
}
|
||||
|
||||
const wifiHotspotConfigMock = {
|
||||
const WifiHotspotConfig = {
|
||||
ssid: '[PC preview] unknow ssid',
|
||||
securityType: '[PC preview] unknow securityType',
|
||||
securityType: WifiSecurityType.WIFI_SEC_TYPE_OPEN,
|
||||
band: '[PC preview] unknow band',
|
||||
preSharedKey: '[PC preview] unknow preSharedKey',
|
||||
maxConn: '[PC preview] unknow maxConn',
|
||||
}
|
||||
|
||||
const wifiStationInfoMock = {
|
||||
const WifiStationInfo = {
|
||||
name: '[PC preview] unknow name',
|
||||
macAddress: '[PC preview] unknow macAddress',
|
||||
ipAddress: '[PC preview] unknow ipAddress',
|
||||
}
|
||||
|
||||
const p2pLinkedInfoMock = {
|
||||
connectState: '[PC preview] unknow connectState',
|
||||
const P2pLinkedInfo = {
|
||||
connectState: P2pConnectState.DISCONNECTED,
|
||||
isGroupOwner: '[PC preview] unknow isGroupOwner',
|
||||
groupOwnerAddr: '[PC preview] unknow groupOwnerAddr',
|
||||
}
|
||||
|
||||
const WifiP2pDeviceMock = {
|
||||
const WifiP2pDevice = {
|
||||
deviceName: '[PC preview] unknow deviceName',
|
||||
deviceAddress: '[PC preview] unknow deviceAddress',
|
||||
primaryDeviceType: '[PC preview] unknow primaryDeviceType',
|
||||
deviceStatus: '[PC preview] unknow deviceStatus',
|
||||
deviceStatus: P2pDeviceStatus.UNAVAILABLE,
|
||||
groupCapabilitys: '[PC preview] unknow groupCapabilitys',
|
||||
}
|
||||
|
||||
const p2pGroupInfoMock = {
|
||||
const P2pGroupInfo = {
|
||||
isP2pGo: '[PC preview] unknow connectState',
|
||||
ownerInfo: WifiP2pDeviceMock,
|
||||
ownerInfo: WifiP2pDevice,
|
||||
passphrase: '[PC preview] unknow passphrase',
|
||||
interface: '[PC preview] unknow interface',
|
||||
groupName: '[PC preview] unknow groupName',
|
||||
networkId: '[PC preview] unknow networkId',
|
||||
frequency: '[PC preview] unknow frequency',
|
||||
clientDevices: [WifiP2pDeviceMock],
|
||||
clientDevices: [WifiP2pDevice],
|
||||
goIpAddress: '[PC preview] unknow goIpAddress',
|
||||
}
|
||||
|
||||
@@ -132,14 +255,20 @@ export function mockWifi() {
|
||||
" may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, [wifiScanInfoMock])
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, [WifiScanInfo])
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve([wifiScanInfoMock])
|
||||
resolve([WifiScanInfo])
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getScanInfosSync: function (...args) {
|
||||
console.warn("wifi.getScanInfosSync interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return [WifiScanInfo];
|
||||
},
|
||||
|
||||
addDeviceConfig: function (...args) {
|
||||
console.warn("wifi.addDeviceConfig interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
@@ -153,6 +282,70 @@ export function mockWifi() {
|
||||
}
|
||||
},
|
||||
|
||||
addUntrustedConfig: function (...args) {
|
||||
console.warn("wifi.addUntrustedConfig interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramBooleanMock)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
removeUntrustedConfig: function (...args) {
|
||||
console.warn("wifi.removeUntrustedConfig interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramBooleanMock)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
addCandidateConfig: function (...args) {
|
||||
console.warn("wifi.addCandidateConfig interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(paramMock.paramNumberMock)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
removeCandidateConfig: function (...args) {
|
||||
console.warn("wifi.removeCandidateConfig interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getCandidateConfigs: function (...args) {
|
||||
console.warn("wifi.getCandidateConfigs interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return [WifiDeviceConfig];
|
||||
},
|
||||
|
||||
connectToCandidateConfig: function (...args) {
|
||||
console.warn("wifi.connectToCandidateConfig interface mocked in the Previewer. " +
|
||||
"How this interface works on the Previewer may be different from that on a real device.")
|
||||
return;
|
||||
},
|
||||
|
||||
connectToNetwork: function (...args) {
|
||||
console.warn("wifi.connectToNetwork interface mocked in the Previewer. " +
|
||||
"How this interface works on the Previewer may be different from that on a real device.")
|
||||
@@ -182,10 +375,10 @@ export function mockWifi() {
|
||||
" may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, linkedInfoMock)
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, WifiLinkedInfo)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(linkedInfoMock)
|
||||
resolve(WifiLinkedInfo)
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -217,7 +410,7 @@ export function mockWifi() {
|
||||
getIpInfo: function (...args) {
|
||||
console.warn("wifi.getIpInfo interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return ipInfoMock;
|
||||
return IpInfo;
|
||||
},
|
||||
|
||||
getCountryCode: function (...args) {
|
||||
@@ -241,7 +434,7 @@ export function mockWifi() {
|
||||
getDeviceConfigs: function (...args) {
|
||||
console.warn("wifi.getDeviceConfigs interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return [wifiDeviceConfigMock];
|
||||
return [WifiDeviceConfig];
|
||||
},
|
||||
|
||||
updateNetwork: function (...args) {
|
||||
@@ -280,6 +473,12 @@ export function mockWifi() {
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
|
||||
isHotspotDualBandSupported: function (...args) {
|
||||
console.warn("wifi.isHotspotDualBandSupported interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
|
||||
isHotspotActive: function (...args) {
|
||||
console.warn("wifi.isHotspotActive interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
@@ -295,13 +494,13 @@ export function mockWifi() {
|
||||
getHotspotConfig: function (...args) {
|
||||
console.warn("wifi.getHotspotConfig interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return wifiHotspotConfigMock;
|
||||
return WifiHotspotConfig;
|
||||
},
|
||||
|
||||
getStations: function (...args) {
|
||||
console.warn("wifi.getStations interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return [wifiStationInfoMock];
|
||||
return [WifiStationInfo];
|
||||
},
|
||||
|
||||
on: function (...args) {
|
||||
@@ -319,10 +518,10 @@ export function mockWifi() {
|
||||
"How this interface works on the Previewer may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, p2pLinkedInfoMock)
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, P2pLinkedInfo)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(p2pLinkedInfoMock)
|
||||
resolve(P2pLinkedInfo)
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -332,23 +531,36 @@ export function mockWifi() {
|
||||
" may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, p2pGroupInfoMock)
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, P2pGroupInfo)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(p2pGroupInfoMock)
|
||||
resolve(P2pGroupInfo)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getP2pDevices: function (...args) {
|
||||
console.warn("wifi.getP2pDevices interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
getP2pPeerDevices: function (...args) {
|
||||
console.warn("wifi.getP2pPeerDevices interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, [WifiP2pDeviceMock])
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, [WifiP2pDevice])
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve([WifiP2pDeviceMock])
|
||||
resolve([WifiP2pDevice])
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getP2pLocalDevice: function (...args) {
|
||||
console.warn("wifi.getP2pLocalDevice interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, WifiP2pDevice)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(WifiP2pDevice)
|
||||
})
|
||||
}
|
||||
},
|
||||
@@ -395,6 +607,19 @@ export function mockWifi() {
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
|
||||
getP2pGroups: function (...args) {
|
||||
console.warn("wifi.getP2pGroups interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, [P2pGroupInfo])
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve([P2pGroupInfo])
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
setDeviceName: function (...args) {
|
||||
console.warn("wifi.setDeviceName interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { paramMock } from "../utils"
|
||||
|
||||
export function mockWifiExt() {
|
||||
const PowerModel = {
|
||||
SLEEPING : 0,
|
||||
GENERAL : 1,
|
||||
THROUGH_WALL : 2,
|
||||
}
|
||||
|
||||
const wifiext = {
|
||||
enableHotspot: function (...args) {
|
||||
console.warn("wifiext.enableHotspot interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
|
||||
disableHotspot: function (...args) {
|
||||
console.warn("wifiext.disableHotspot interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
|
||||
getSupportedPowerModel: function (...args) {
|
||||
console.warn("wifiext.getSupportedPowerModel interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, [PowerModel.GENERAL])
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve([PowerModel.GENERAL])
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
getPowerModel: function (...args) {
|
||||
console.warn("wifiext.getPowerModel interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, PowerModel.GENERAL)
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve(PowerModel.GENERAL)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
setPowerModel: function (...args) {
|
||||
console.warn("wifiext.setPowerModel interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramBooleanMock;
|
||||
},
|
||||
}
|
||||
return wifiext;
|
||||
}
|
||||
Reference in New Issue
Block a user