From d9219f2fa40df8826018c354cfa64dd23a6df4a1 Mon Sep 17 00:00:00 2001 From: xujie Date: Thu, 25 May 2023 20:19:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9mdns=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xujie --- .../reference/apis/js-apis-net-ethernet.md | 76 +------------------ 1 file changed, 2 insertions(+), 74 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md b/zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md index 2aa48bc6e6..3887294917 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md +++ b/zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md @@ -53,8 +53,7 @@ ethernet.setIfaceConfig("eth0", { route: "192.168.xx.xxx", gateway: "192.168.xx.xxx", netMask: "255.255.255.0", - dnsServers: "1.1.1.1", - domain: "2.2.2.2" + dnsServers: "1.1.1.1" }, (error) => { if (error) { console.log("setIfaceConfig callback error = " + JSON.stringify(error)); @@ -111,8 +110,7 @@ ethernet.setIfaceConfig("eth0", { route: "192.168.xx.xxx", gateway: "192.168.xx.xxx", netMask: "255.255.255.0", - dnsServers: "1.1.1.1", - domain: "2.2.2.2" + dnsServers: "1.1.1.1" }).then(() => { console.log("setIfaceConfig promise ok "); }).catch(error => { @@ -163,7 +161,6 @@ ethernet.getIfaceConfig("eth0", (error, value) => { console.log("getIfaceConfig callback gateway = " + JSON.stringify(value.gateway)); console.log("getIfaceConfig callback netMask = " + JSON.stringify(value.netMask)); console.log("getIfaceConfig callback dnsServers = " + JSON.stringify(value.dnsServers)); - console.log("getIfaceConfig callback domain = " + JSON.stringify(value.domain)); } }); ``` @@ -213,7 +210,6 @@ ethernet.getIfaceConfig("eth0").then((data) => { console.log("getIfaceConfig promise gateway = " + JSON.stringify(data.gateway)); console.log("getIfaceConfig promise netMask = " + JSON.stringify(data.netMask)); console.log("getIfaceConfig promise dnsServers = " + JSON.stringify(data.dnsServers)); - console.log("getIfaceConfig promise domain = " + JSON.stringify(data.domain)); }).catch(error => { console.log("getIfaceConfig promise error = " + JSON.stringify(error)); }); @@ -386,74 +382,6 @@ ethernet.getAllActiveIfaces().then((data) => { }); ``` -## ethernet.on('interfaceStateChange')10+ - -on(type: 'interfaceStateChange', callback: Callback\<{ iface: string, active: boolean }\>): void - -注册网卡热插拔事件,使用callback方式作为异步方法。 - -**系统接口**:此接口为系统接口。 - -**需要权限**:ohos.permission.GET_NETWORK_INFO - -**系统能力**:SystemCapability.Communication.NetManager.Ethernet - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | --------------------------------------- | ---- | ---------- | -| type | string | 是 | 订阅的事件类型,'interfaceStateChange'。 | -| callback | AsyncCallback\<{ iface: string, active: boolean }\> | 是 | 回调函数。
iface:网卡名称。
active:是否处于激活状态(true:激活;false:未激活) | - -**错误码:** - -| 错误码ID | 错误信息 | -| ------- | -------------------------------------------- | -| 201 | Permission denied. | -| 202 | Applicable only to system applications. | -| 401 | Parameter error. | - -**示例:** - -```js -ethernet.on('interfaceStateChange', (data) => { - console.log('on interfaceSharingStateChange:' + JSON.stringify(data)); -}); -``` - -## ethernet.off('interfaceStateChange')10+ - -off(type: 'interfaceStateChange', callback?: Callback\<{ iface: string, active: boolean }\>): void - -注销网卡热插拔事件,使用callback方式作为异步方法。 - -**系统接口**:此接口为系统接口。 - -**需要权限**:ohos.permission.GET_NETWORK_INFO - -**系统能力**:SystemCapability.Communication.NetManager.Ethernet - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | --------------------------------------- | ---- | ---------- | -| type | string | 是 | 订阅的事件类型,'interfaceStateChange'。 | -| callback | AsyncCallback\<{ iface: string, active: boolean }> | 否 | 回调函数。
iface:网卡名称。
active:是否处于激活状态(true:激活;false:未激活) | - -**错误码:** - -| 错误码ID | 错误信息 | -| ------- | -------------------------------------------- | -| 201 | Permission denied. | -| 202 | Applicable only to system applications. | -| 401 | Parameter error. | - -**示例:** - -```js -ethernet.off('interfaceStateChange'); -``` - ## InterfaceConfiguration 以太网连接配置网络信息。 -- GitLab