Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
d9219f2f
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d9219f2f
编写于
5月 25, 2023
作者:
X
xujie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改mdns工具检测报错
Signed-off-by:
N
xujie
<
xujie223@huawei.com
>
上级
e367fdf6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
2 addition
and
74 deletion
+2
-74
zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md
zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md
+2
-74
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md
浏览文件 @
d9219f2f
...
@@ -53,8 +53,7 @@ ethernet.setIfaceConfig("eth0", {
...
@@ -53,8 +53,7 @@ ethernet.setIfaceConfig("eth0", {
route
:
"
192.168.xx.xxx
"
,
route
:
"
192.168.xx.xxx
"
,
gateway
:
"
192.168.xx.xxx
"
,
gateway
:
"
192.168.xx.xxx
"
,
netMask
:
"
255.255.255.0
"
,
netMask
:
"
255.255.255.0
"
,
dnsServers
:
"
1.1.1.1
"
,
dnsServers
:
"
1.1.1.1
"
domain
:
"
2.2.2.2
"
},
(
error
)
=>
{
},
(
error
)
=>
{
if
(
error
)
{
if
(
error
)
{
console
.
log
(
"
setIfaceConfig callback error =
"
+
JSON
.
stringify
(
error
));
console
.
log
(
"
setIfaceConfig callback error =
"
+
JSON
.
stringify
(
error
));
...
@@ -111,8 +110,7 @@ ethernet.setIfaceConfig("eth0", {
...
@@ -111,8 +110,7 @@ ethernet.setIfaceConfig("eth0", {
route
:
"
192.168.xx.xxx
"
,
route
:
"
192.168.xx.xxx
"
,
gateway
:
"
192.168.xx.xxx
"
,
gateway
:
"
192.168.xx.xxx
"
,
netMask
:
"
255.255.255.0
"
,
netMask
:
"
255.255.255.0
"
,
dnsServers
:
"
1.1.1.1
"
,
dnsServers
:
"
1.1.1.1
"
domain
:
"
2.2.2.2
"
}).
then
(()
=>
{
}).
then
(()
=>
{
console
.
log
(
"
setIfaceConfig promise ok
"
);
console
.
log
(
"
setIfaceConfig promise ok
"
);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
...
@@ -163,7 +161,6 @@ ethernet.getIfaceConfig("eth0", (error, value) => {
...
@@ -163,7 +161,6 @@ ethernet.getIfaceConfig("eth0", (error, value) => {
console
.
log
(
"
getIfaceConfig callback gateway =
"
+
JSON
.
stringify
(
value
.
gateway
));
console
.
log
(
"
getIfaceConfig callback gateway =
"
+
JSON
.
stringify
(
value
.
gateway
));
console
.
log
(
"
getIfaceConfig callback netMask =
"
+
JSON
.
stringify
(
value
.
netMask
));
console
.
log
(
"
getIfaceConfig callback netMask =
"
+
JSON
.
stringify
(
value
.
netMask
));
console
.
log
(
"
getIfaceConfig callback dnsServers =
"
+
JSON
.
stringify
(
value
.
dnsServers
));
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) => {
...
@@ -213,7 +210,6 @@ ethernet.getIfaceConfig("eth0").then((data) => {
console
.
log
(
"
getIfaceConfig promise gateway =
"
+
JSON
.
stringify
(
data
.
gateway
));
console
.
log
(
"
getIfaceConfig promise gateway =
"
+
JSON
.
stringify
(
data
.
gateway
));
console
.
log
(
"
getIfaceConfig promise netMask =
"
+
JSON
.
stringify
(
data
.
netMask
));
console
.
log
(
"
getIfaceConfig promise netMask =
"
+
JSON
.
stringify
(
data
.
netMask
));
console
.
log
(
"
getIfaceConfig promise dnsServers =
"
+
JSON
.
stringify
(
data
.
dnsServers
));
console
.
log
(
"
getIfaceConfig promise dnsServers =
"
+
JSON
.
stringify
(
data
.
dnsServers
));
console
.
log
(
"
getIfaceConfig promise domain =
"
+
JSON
.
stringify
(
data
.
domain
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
log
(
"
getIfaceConfig promise error =
"
+
JSON
.
stringify
(
error
));
console
.
log
(
"
getIfaceConfig promise error =
"
+
JSON
.
stringify
(
error
));
});
});
...
@@ -386,74 +382,6 @@ ethernet.getAllActiveIfaces().then((data) => {
...
@@ -386,74 +382,6 @@ ethernet.getAllActiveIfaces().then((data) => {
});
});
```
```
## ethernet.on('interfaceStateChange')<sup>10+</sup>
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 }
\>
| 是 | 回调函数。
<br>
iface:网卡名称。
<br>
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')<sup>10+</sup>
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 }> | 否 | 回调函数。
<br>
iface:网卡名称。
<br>
active:是否处于激活状态(true:激活;false:未激活) |
**错误码:**
| 错误码ID | 错误信息 |
| ------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Applicable only to system applications. |
| 401 | Parameter error. |
**示例:**
```
js
ethernet
.
off
(
'
interfaceStateChange
'
);
```
## InterfaceConfiguration
## InterfaceConfiguration
以太网连接配置网络信息。
以太网连接配置网络信息。
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录