Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
ef29f344
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看板
提交
ef29f344
编写于
7月 04, 2023
作者:
X
xujie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
Change-Id: If9abf89a14e0fe0dce90270a39a012d17883848c Signed-off-by:
N
xujie
<
xujie223@huawei.com
>
上级
9a6bddc0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
17 addition
and
17 deletion
+17
-17
zh-cn/application-dev/reference/apis/js-apis-net-statistics.md
.../application-dev/reference/apis/js-apis-net-statistics.md
+17
-17
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-net-statistics.md
浏览文件 @
ef29f344
...
@@ -588,7 +588,7 @@ getUidTxBytes(uid: number): Promise\<number>;
...
@@ -588,7 +588,7 @@ getUidTxBytes(uid: number): Promise\<number>;
on(type: 'netStatsChange', callback: Callback
\<
{ iface: string, uid?: number }>): void
on(type: 'netStatsChange', callback: Callback
\<
{ iface: string, uid?: number }>): void
注册
流量改变事件通知。
订阅
流量改变事件通知。
**系统接口**
:此接口为系统接口。
**系统接口**
:此接口为系统接口。
...
@@ -627,7 +627,7 @@ on(type: 'netStatsChange', callback: Callback\<{ iface: string, uid?: number }>)
...
@@ -627,7 +627,7 @@ on(type: 'netStatsChange', callback: Callback\<{ iface: string, uid?: number }>)
off(type: 'netStatsChange', callback?: Callback
\<
{ iface: string, uid?: number }>): void;
off(type: 'netStatsChange', callback?: Callback
\<
{ iface: string, uid?: number }>): void;
注销
流量改变事件通知。
取消订阅
流量改变事件通知。
**系统接口**
:此接口为系统接口。
**系统接口**
:此接口为系统接口。
...
@@ -664,7 +664,7 @@ statistics.off('netStatsChange');
...
@@ -664,7 +664,7 @@ statistics.off('netStatsChange');
getTrafficStatsByIface(ifaceInfo: IfaceInfo, callback: AsyncCallback
\<
NetStatsInfo>): void;
getTrafficStatsByIface(ifaceInfo: IfaceInfo, callback: AsyncCallback
\<
NetStatsInfo>): void;
获取网卡历史流量信息,使用callback方式作为异步方法。
获取
指定
网卡历史流量信息,使用callback方式作为异步方法。
**系统接口**
:此接口为系统接口。
**系统接口**
:此接口为系统接口。
...
@@ -705,9 +705,9 @@ getTrafficStatsByIface(ifaceInfo: IfaceInfo, callback: AsyncCallback\<NetStatsIn
...
@@ -705,9 +705,9 @@ getTrafficStatsByIface(ifaceInfo: IfaceInfo, callback: AsyncCallback\<NetStatsIn
statistics
.
getTrafficStatsByIface
(
ifaceInfo
),
(
error
,
statsInfo
)
=>
{
statistics
.
getTrafficStatsByIface
(
ifaceInfo
),
(
error
,
statsInfo
)
=>
{
console
.
log
(
JSON
.
stringify
(
error
))
console
.
log
(
JSON
.
stringify
(
error
))
console
.
log
(
"
getTrafficStatsByIface bytes of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxBytes
));
console
.
log
(
"
getTrafficStatsByIface bytes of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxBytes
));
console
.
log
(
"
getTrafficStatsByIface bytes of sen
d
=
"
+
JSON
.
stringify
(
statsInfo
.
txBytes
));
console
.
log
(
"
getTrafficStatsByIface bytes of sen
t
=
"
+
JSON
.
stringify
(
statsInfo
.
txBytes
));
console
.
log
(
"
getTrafficStatsByIface packets of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxPackets
));
console
.
log
(
"
getTrafficStatsByIface packets of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxPackets
));
console
.
log
(
"
getTrafficStatsByIface packets of sen
d
=
"
+
JSON
.
stringify
(
statsInfo
.
txPackets
));
console
.
log
(
"
getTrafficStatsByIface packets of sen
t
=
"
+
JSON
.
stringify
(
statsInfo
.
txPackets
));
});
});
```
```
...
@@ -715,7 +715,7 @@ getTrafficStatsByIface(ifaceInfo: IfaceInfo, callback: AsyncCallback\<NetStatsIn
...
@@ -715,7 +715,7 @@ getTrafficStatsByIface(ifaceInfo: IfaceInfo, callback: AsyncCallback\<NetStatsIn
getTrafficStatsByIface(ifaceInfo: IfaceInfo): Promise
\<
NetStatsInfo>;
getTrafficStatsByIface(ifaceInfo: IfaceInfo): Promise
\<
NetStatsInfo>;
获取网卡历史流量信息,使用Promise方式作为异步方法。
获取
指定
网卡历史流量信息,使用Promise方式作为异步方法。
**系统接口**
:此接口为系统接口。
**系统接口**
:此接口为系统接口。
...
@@ -757,9 +757,9 @@ getTrafficStatsByIface(ifaceInfo: IfaceInfo): Promise\<NetStatsInfo>;
...
@@ -757,9 +757,9 @@ getTrafficStatsByIface(ifaceInfo: IfaceInfo): Promise\<NetStatsInfo>;
statistics
.
getTrafficStatsByIface
().
then
(
function
(
statsInfo
)
{
statistics
.
getTrafficStatsByIface
().
then
(
function
(
statsInfo
)
{
console
.
log
(
"
getTrafficStatsByIface bytes of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxBytes
));
console
.
log
(
"
getTrafficStatsByIface bytes of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxBytes
));
console
.
log
(
"
getTrafficStatsByIface bytes of sen
d
=
"
+
JSON
.
stringify
(
statsInfo
.
txBytes
));
console
.
log
(
"
getTrafficStatsByIface bytes of sen
t
=
"
+
JSON
.
stringify
(
statsInfo
.
txBytes
));
console
.
log
(
"
getTrafficStatsByIface packets of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxPackets
));
console
.
log
(
"
getTrafficStatsByIface packets of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxPackets
));
console
.
log
(
"
getTrafficStatsByIface packets of sen
d
=
"
+
JSON
.
stringify
(
statsInfo
.
txPackets
));
console
.
log
(
"
getTrafficStatsByIface packets of sen
t
=
"
+
JSON
.
stringify
(
statsInfo
.
txPackets
));
})
})
```
```
...
@@ -767,7 +767,7 @@ getTrafficStatsByIface(ifaceInfo: IfaceInfo): Promise\<NetStatsInfo>;
...
@@ -767,7 +767,7 @@ getTrafficStatsByIface(ifaceInfo: IfaceInfo): Promise\<NetStatsInfo>;
getTrafficStatsByUid(uidInfo: UidInfo, callback: AsyncCallback
\<
NetStatsInfo>): void;
getTrafficStatsByUid(uidInfo: UidInfo, callback: AsyncCallback
\<
NetStatsInfo>): void;
获取应用历史流量信息,使用callback方式作为异步方法。
获取
指定
应用历史流量信息,使用callback方式作为异步方法。
**系统接口**
:此接口为系统接口。
**系统接口**
:此接口为系统接口。
...
@@ -779,7 +779,7 @@ getTrafficStatsByUid(uidInfo: UidInfo, callback: AsyncCallback\<NetStatsInfo>):
...
@@ -779,7 +779,7 @@ getTrafficStatsByUid(uidInfo: UidInfo, callback: AsyncCallback\<NetStatsInfo>):
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ |
| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ |
| uidInfo |
[
UidInfo
](
#uidinfo10
)
| 是 | 指定查询的应用
历史流量
信息,参见
[
UidInfo
](
#uidinfo10
)
。 |
| uidInfo |
[
UidInfo
](
#uidinfo10
)
| 是 | 指定查询的应用信息,参见
[
UidInfo
](
#uidinfo10
)
。 |
| callback | AsyncCallback
\<
[
NetStatsInfo
](
#netstatsinfo10
)
> | 是 | 回调函数。成功时statsInfo返回包含应用历史流量信息,error为undefined,否则为错误对象|
| callback | AsyncCallback
\<
[
NetStatsInfo
](
#netstatsinfo10
)
> | 是 | 回调函数。成功时statsInfo返回包含应用历史流量信息,error为undefined,否则为错误对象|
**错误码:**
**错误码:**
...
@@ -811,9 +811,9 @@ getTrafficStatsByUid(uidInfo: UidInfo, callback: AsyncCallback\<NetStatsInfo>):
...
@@ -811,9 +811,9 @@ getTrafficStatsByUid(uidInfo: UidInfo, callback: AsyncCallback\<NetStatsInfo>):
statistics
.
getTrafficStatsByUid
(
uidInfo
),
(
error
,
statsInfo
)
=>
{
statistics
.
getTrafficStatsByUid
(
uidInfo
),
(
error
,
statsInfo
)
=>
{
console
.
log
(
JSON
.
stringify
(
error
))
console
.
log
(
JSON
.
stringify
(
error
))
console
.
log
(
"
getTrafficStatsByUid bytes of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxBytes
));
console
.
log
(
"
getTrafficStatsByUid bytes of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxBytes
));
console
.
log
(
"
getTrafficStatsByUid bytes of sen
d
=
"
+
JSON
.
stringify
(
statsInfo
.
txBytes
));
console
.
log
(
"
getTrafficStatsByUid bytes of sen
t
=
"
+
JSON
.
stringify
(
statsInfo
.
txBytes
));
console
.
log
(
"
getTrafficStatsByUid packets of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxPackets
));
console
.
log
(
"
getTrafficStatsByUid packets of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxPackets
));
console
.
log
(
"
getTrafficStatsByUid packets of sen
d
=
"
+
JSON
.
stringify
(
statsInfo
.
txPackets
));
console
.
log
(
"
getTrafficStatsByUid packets of sen
t
=
"
+
JSON
.
stringify
(
statsInfo
.
txPackets
));
});
});
```
```
...
@@ -821,7 +821,7 @@ getTrafficStatsByUid(uidInfo: UidInfo, callback: AsyncCallback\<NetStatsInfo>):
...
@@ -821,7 +821,7 @@ getTrafficStatsByUid(uidInfo: UidInfo, callback: AsyncCallback\<NetStatsInfo>):
getTrafficStatsByUid(uidInfo: UidInfo): Promise
\<
NetStatsInfo>;
getTrafficStatsByUid(uidInfo: UidInfo): Promise
\<
NetStatsInfo>;
获取应用历史流量信息,使用Promise方式作为异步方法。
获取
指定
应用历史流量信息,使用Promise方式作为异步方法。
**系统接口**
:此接口为系统接口。
**系统接口**
:此接口为系统接口。
...
@@ -833,7 +833,7 @@ getTrafficStatsByUid(uidInfo: UidInfo): Promise\<NetStatsInfo>;
...
@@ -833,7 +833,7 @@ getTrafficStatsByUid(uidInfo: UidInfo): Promise\<NetStatsInfo>;
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ |
| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ |
| uidInfo |
[
UidInfo
](
#uidinfo10
)
| 是 | 指定查询的应用
历史流量
信息,参见
[
UidInfo
](
#uidinfo10
)
。 |
| uidInfo |
[
UidInfo
](
#uidinfo10
)
| 是 | 指定查询的应用信息,参见
[
UidInfo
](
#uidinfo10
)
。 |
**返回值:**
**返回值:**
...
@@ -869,9 +869,9 @@ getTrafficStatsByUid(uidInfo: UidInfo): Promise\<NetStatsInfo>;
...
@@ -869,9 +869,9 @@ getTrafficStatsByUid(uidInfo: UidInfo): Promise\<NetStatsInfo>;
statistics
.
getTrafficStatsByUid
(
uidInfo
).
then
(
function
(
statsInfo
)
{
statistics
.
getTrafficStatsByUid
(
uidInfo
).
then
(
function
(
statsInfo
)
{
console
.
log
(
"
getTrafficStatsByUid bytes of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxBytes
));
console
.
log
(
"
getTrafficStatsByUid bytes of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxBytes
));
console
.
log
(
"
getTrafficStatsByUid bytes of sen
d
=
"
+
JSON
.
stringify
(
statsInfo
.
txBytes
));
console
.
log
(
"
getTrafficStatsByUid bytes of sen
t
=
"
+
JSON
.
stringify
(
statsInfo
.
txBytes
));
console
.
log
(
"
getTrafficStatsByUid packets of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxPackets
));
console
.
log
(
"
getTrafficStatsByUid packets of received =
"
+
JSON
.
stringify
(
statsInfo
.
rxPackets
));
console
.
log
(
"
getTrafficStatsByUid packets of sen
d
=
"
+
JSON
.
stringify
(
statsInfo
.
txPackets
));
console
.
log
(
"
getTrafficStatsByUid packets of sen
t
=
"
+
JSON
.
stringify
(
statsInfo
.
txPackets
));
})
})
```
```
...
@@ -885,7 +885,7 @@ getTrafficStatsByUid(uidInfo: UidInfo): Promise\<NetStatsInfo>;
...
@@ -885,7 +885,7 @@ getTrafficStatsByUid(uidInfo: UidInfo): Promise\<NetStatsInfo>;
| 名称 | 类型 | 必填 | 说明 |
| 名称 | 类型 | 必填 | 说明 |
| --------------------- | ---------------------------------- | --- | ------------------------ |
| --------------------- | ---------------------------------- | --- | ------------------------ |
| iface | string | 是 |
需要查询我
网卡名。|
| iface | string | 是 |
查询的
网卡名。|
| startTime | number | 是 | 查询的开始时间(时间戳;单位:秒)。 |
| startTime | number | 是 | 查询的开始时间(时间戳;单位:秒)。 |
| endTime | number | 是 | 查询的结束时间(时间戳;单位:秒)。 |
| endTime | number | 是 | 查询的结束时间(时间戳;单位:秒)。 |
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录