From ec1c1b9fb885c04c84e6722e454a999f313de7a7 Mon Sep 17 00:00:00 2001 From: xuyong Date: Fri, 25 Feb 2022 15:55:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BC=80=E5=8F=91=E6=8C=87?= =?UTF-8?q?=E5=AF=BC=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xuyong --- .../subsystems/subsys-dfx-hisysevent-listening.md | 10 +++++----- ...-query.md => subsys-dfx-hisysevent-querying.md} | 12 ++++++------ en/device-dev/subsystems/subsys-dfx-hisysevent.md | 2 +- .../subsystems/subsys-dfx-hisysevent-listening.md | 12 ++++++------ .../subsystems/subsys-dfx-hisysevent-querying.md | 14 +++++++------- 5 files changed, 25 insertions(+), 25 deletions(-) rename en/device-dev/subsystems/{subsys-dfx-hisysevent-query.md => subsys-dfx-hisysevent-querying.md} (95%) diff --git a/en/device-dev/subsystems/subsys-dfx-hisysevent-listening.md b/en/device-dev/subsystems/subsys-dfx-hisysevent-listening.md index 2d2157fbd5..68e94e1f03 100644 --- a/en/device-dev/subsystems/subsys-dfx-hisysevent-listening.md +++ b/en/device-dev/subsystems/subsys-dfx-hisysevent-listening.md @@ -15,7 +15,7 @@ HiSysEvent supports listening for events across processes. You can register a li -

int HiSysEventManager::AddEventListener(std::shared_ptr<HiSysEventSubscribeCallBackBase> listener, std::vector<struct ListenerRule>& rules)

+

int HiSysEventManager::AddEventListener(std::shared_ptr<HiSysEventSubscribeCallBack> listener, std::vector<struct ListenerRule>& rules)

Registers a listener for system events. You can listen for certain events by specifying rules.

Input arguments:

@@ -24,7 +24,7 @@ HiSysEvent supports listening for events across processes. You can register a li -

void HiSysEventManager::RemoveListener(std::shared_ptr<HiSysEventSubscribeCallBackBase> listener)

+

void HiSysEventManager::RemoveListener(std::shared_ptr<HiSysEventSubscribeCallBack> listener)

Removes the listener for system events.

Input arguments:

@@ -72,7 +72,7 @@ HiSysEvent supports listening for events across processes. You can register a li -

void HiSysEventSubscribeCallBackBase::OnHandle(const std::string& domain, const std::string& eventName, const int eventType, const std::string& eventDetail)

+

void HiSysEventSubscribeCallBack::OnHandle(const std::string& domain, const std::string& eventName, const int eventType, const std::string& eventDetail)

Callback object for system events.

Input arguments:

@@ -97,11 +97,11 @@ In this example, you'll be instructed to register a listener for all system even - Implement the callback API. - HiSysEventSubscribeCallBackBase::OnHandle\(const std::string& domain, const std::string& eventName, const int eventType, const std::string& eventDetail\) + HiSysEventSubscribeCallBack::OnHandle\(const std::string& domain, const std::string& eventName, const int eventType, const std::string& eventDetail\) - Register a callback object. - HiSysEventManager::AddEventListener\(std::shared\_ptr listener, std::vector& rules\) + HiSysEventManager::AddEventListener\(std::shared\_ptr listener, std::vector& rules\) ``` diff --git a/en/device-dev/subsystems/subsys-dfx-hisysevent-query.md b/en/device-dev/subsystems/subsys-dfx-hisysevent-querying.md similarity index 95% rename from en/device-dev/subsystems/subsys-dfx-hisysevent-query.md rename to en/device-dev/subsystems/subsys-dfx-hisysevent-querying.md index cf233db0bf..ba64df110c 100644 --- a/en/device-dev/subsystems/subsys-dfx-hisysevent-query.md +++ b/en/device-dev/subsystems/subsys-dfx-hisysevent-querying.md @@ -15,7 +15,7 @@ HiSysEvent provides an API for you to query system events. You can query concern -

bool HiSysEventManager::QueryHiSysEvent(struct QueryArg& queryArg, std::vector<struct QueryRule>& queryRules, std::shared_ptr<HiSysEventQueryCallBackBase> queryCallBack)

+

bool HiSysEventManager::QueryHiSysEvent(struct QueryArg& queryArg, std::vector<struct QueryRule>& queryRules, std::shared_ptr<HiSysEventQueryCallBack> queryCallBack)

Queries system events by specifying search criteria such as the time segment, event domain, and event name.

Input arguments:

@@ -90,7 +90,7 @@ HiSysEvent provides an API for you to query system events. You can query concern -

void HiSysEventQueryCallBackBase::OnQuery(const ::std::vector<std::string>& sysEvent, const ::std::vector<int64_t>& seq)

+

void HiSysEventQueryCallBack::OnQuery(const ::std::vector<std::string>& sysEvent, const ::std::vector<int64_t>& seq)

Callback object for event query.

Input arguments:

@@ -98,7 +98,7 @@ HiSysEvent provides an API for you to query system events. You can query concern

Return value: none

-

void HiSysEventQueryCallBackBase::OnComplete(int32_t reason, int32_t total)

+

void HiSysEventQueryCallBack::OnComplete(int32_t reason, int32_t total)

Callback object for completion of event query.

Input arguments:

@@ -123,13 +123,13 @@ In this example, you'll be instructed to query all system events. - Implement the callback API. - void HiSysEventQueryCallBackBase::OnQuery\(const ::std::vector& sysEvent, const ::std::vector& seq\) + void HiSysEventQueryCallBack::OnQuery\(const ::std::vector& sysEvent, const ::std::vector& seq\) - void HiSysEventQueryCallBackBase::OnComplete\(int32\_t reason, int32\_t total\) + void HiSysEventQueryCallBack::OnComplete\(int32\_t reason, int32\_t total\) - Invoke the query API in the corresponding service logic. - HiSysEventManager::QueryHiSysEvent\(struct QueryArg& queryArg, std::vector& queryRules, std::shared\_ptr queryCallBack\) + HiSysEventManager::QueryHiSysEvent\(struct QueryArg& queryArg, std::vector& queryRules, std::shared\_ptr queryCallBack\) ``` diff --git a/en/device-dev/subsystems/subsys-dfx-hisysevent.md b/en/device-dev/subsystems/subsys-dfx-hisysevent.md index cc5a1e1651..fa61ce5e5c 100644 --- a/en/device-dev/subsystems/subsys-dfx-hisysevent.md +++ b/en/device-dev/subsystems/subsys-dfx-hisysevent.md @@ -4,7 +4,7 @@ - **[HiSysEvent Listening](subsys-dfx-hisysevent-listening.md)** -- **[HiSysEvent Query](subsys-dfx-hisysevent-query.md)** +- **[HiSysEvent Query](subsys-dfx-hisysevent-querying.md)** - **[HiSysEvent Tool Usage](subsys-dfx-hisysevent-tool.md)** diff --git a/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-listening.md b/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-listening.md index b8d97a3c40..170bb09a21 100644 --- a/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-listening.md +++ b/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-listening.md @@ -27,8 +27,8 @@ HiSysEvent提供了跨进程订阅机制,开发者可以通过注册订阅接 | 接口名称 | 描述 | | -------- | --------- | -|int HiSysEventManager::AddEventListener(std::shared_ptr<HiSysEventSubscribeCallBackBase> listener, std::vector<ListenerRule>& rules)|接口功能:注册订阅HiSysEvent系统事件侦听对象,可设置规则订阅某些事件。

输入参数:
  • listener:订阅回调对象。
  • rules:事件订阅规则。
返回值:
  • 0:订阅成功,重复订阅。
  • 1:订阅成功,初次订阅。
  • 其他值:订阅失败。
| -|void HiSysEventManager::RemoveListener(std::shared_ptr<HiSysEventSubscribeCallBackBase> listener)|接口功能:移除订阅hisysevent系统事件侦听对象。

输入参数:
  • listener:订阅回调对象。
返回值:
  无。| +|int HiSysEventManager::AddEventListener(std::shared_ptr<HiSysEventSubscribeCallBack> listener, std::vector<ListenerRule>& rules)|接口功能:注册订阅HiSysEvent系统事件侦听对象,可设置规则订阅某些事件。

输入参数:
  • listener:订阅回调对象。
  • rules:事件订阅规则。
返回值:
  • 0:订阅成功,重复订阅。
  • 1:订阅成功,初次订阅。
  • 其他值:订阅失败。
| +|void HiSysEventManager::RemoveListener(std::shared_ptr<HiSysEventSubscribeCallBack> listener)|接口功能:移除订阅hisysevent系统事件侦听对象。

输入参数:
  • listener:订阅回调对象。
返回值:
  无。| **表 2** ListenerRule订阅规则对象 @@ -46,11 +46,11 @@ HiSysEvent提供了跨进程订阅机制,开发者可以通过注册订阅接 | PREFIX | 前缀匹配类型 | | REGULAR | 正则匹配类型 | -**表 4** HiSysEventSubscribeCallBackBase订阅对象 +**表 4** HiSysEventSubscribeCallBack订阅对象 | 接口名称 | 描述 | | -------- | --------- | -|void HiSysEventSubscribeCallBackBase::OnHandle(const std::string& domain, const std::string& eventName, const int eventType, const std::string& eventDetail)|接口功能:订阅事件的回调接口。

输入参数:
  • domain:事件所属领域。
  • eventName:事件的名称。
  • eventType:事件类型。
  • eventDetail:包含事件相关信息的字符串,以json的形式体现。
返回值:
  无。| +|void HiSysEventSubscribeCallBack::OnHandle(const std::string& domain, const std::string& eventName, const int eventType, const std::string& eventDetail)|接口功能:订阅事件的回调接口。

输入参数:
  • domain:事件所属领域。
  • eventName:事件的名称。
  • eventType:事件类型。
  • eventDetail:包含事件相关信息的字符串,以json的形式体现。
返回值:
  无。| ### 开发实例 @@ -68,9 +68,9 @@ HiSysEvent提供了跨进程订阅机制,开发者可以通过注册订阅接 #include - class DemoListener : public OHOS::HiviewDFX::HiSysEventSubscribeCallBackNative { + class DemoListener : public OHOS::HiviewDFX::HiSysEventSubscribeCallBack { public: - explicit DemoListener() : HiSysEventSubscribeCallBackNative() {} + explicit DemoListener() : HiSysEventSubscribeCallBack() {} void OnHandle(const std::string& domain, const std::string& eventName, const int eventType, const std::string& eventDetail); virtual ~DemoListener() {} diff --git a/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-querying.md b/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-querying.md index 93a6fb09c6..426b611738 100644 --- a/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-querying.md +++ b/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-querying.md @@ -17,7 +17,7 @@ HiSysEvent提供了查询接口,支持开发者设置条件查询HiSysEvent事 | 接口名称 | 描述 | | -------- | --------- | -| bool HiSysEventManager::QueryHiSysEvent(struct QueryArg& queryArg, std::vector<struct QueryRule>& queryRules, std::shared_ptr<HiSysEventQueryCallBackBase> queryCallBack) | 接口功能:
  支持设置查询时间段,事件领域,事件名称等,查询满足条件的HiSysEvent事件。

输入参数:
  • queryArg:查询参数。
  • queryRules:事件过滤规则。
  • queryCallBack:查询接口回调对象。
返回值:
  • true:查询成功。
  • false:查询失败。
| +| bool HiSysEventManager::QueryHiSysEvent(struct QueryArg& queryArg, std::vector<struct QueryRule>& queryRules, std::shared_ptr<HiSysEventQueryCallBack> queryCallBack) | 接口功能:
  支持设置查询时间段,事件领域,事件名称等,查询满足条件的HiSysEvent事件。

输入参数:
  • queryArg:查询参数。
  • queryRules:事件过滤规则。
  • queryCallBack:查询接口回调对象。
返回值:
  • true:查询成功。
  • false:查询失败。
| **表 2** QueryArg查询参数对象 @@ -36,12 +36,12 @@ HiSysEvent提供了查询接口,支持开发者设置条件查询HiSysEvent事 | domain | string类型,用来标识查询规则对象的事件所属领域,如果传入的是空字符串,则默认事件领域字段匹配成功。 | | eventList | std::vector<std::string>类型,事件名称的列表,如果传入的是空字符串,则默认事件名称字段匹配成功。 | -**表 4** HiSysEventQueryCallBackBase查询回调对象 +**表 4** HiSysEventQueryCallBack查询回调对象 | 接口名称 | 描述 | | -------- | --------- | -| void HiSysEventQueryCallBackBase::OnQuery(const ::std::vector<std::string>& sysEvent, const ::std::vector<int64_t>& seq) | 接口功能:订阅事件查询中的回调。

输入参数:
  • sysEvent:返回事件集合。
  • seq:事件序列集合。
返回值:
  无。 | -| void HiSysEventQueryCallBackBase::OnComplete(int32_t reason, int32_t total) | 接口功能:订阅事件查询完成的回调。

输入参数:
  • reason:查询结束返回原因,目前默认是0。
  • total:本次查询总共返回的事件总数量。
返回值:
  无。 | +| void HiSysEventQueryCallBack::OnQuery(const ::std::vector<std::string>& sysEvent, const ::std::vector<int64_t>& seq) | 接口功能:订阅事件查询中的回调。

输入参数:
  • sysEvent:返回事件集合。
  • seq:事件序列集合。
返回值:
  无。 | +| void HiSysEventQueryCallBack::OnComplete(int32_t reason, int32_t total) | 接口功能:订阅事件查询完成的回调。

输入参数:
  • reason:查询结束返回原因,目前默认是0。
  • total:本次查询总共返回的事件总数量。
返回值:
  无。 | ### 开发实例 @@ -55,13 +55,13 @@ C++接口实例。 - 实现对应的查询回调接口: - void HiSysEventQueryCallBackBase::OnQuery\(const ::std::vector& sysEvent, const ::std::vector& seq\) + void HiSysEventQueryCallBack::OnQuery\(const ::std::vector& sysEvent, const ::std::vector& seq\) - void HiSysEventQueryCallBackBase::OnComplete\(int32\_t reason, int32\_t total\) + void HiSysEventQueryCallBack::OnComplete\(int32\_t reason, int32\_t total\) - 在相应的业务逻辑里面调用查询接口: - HiSysEventManager::QueryHiSysEvent\(struct QueryArg& queryArg, std::vector& queryRules, std::shared\_ptr queryCallBack\) + HiSysEventManager::QueryHiSysEvent\(struct QueryArg& queryArg, std::vector& queryRules, std::shared\_ptr queryCallBack\) ``` -- GitLab