From 6599a8187dd9d7339f8d72a11de686a76dfebcf1 Mon Sep 17 00:00:00 2001 From: shawn_he Date: Wed, 9 Mar 2022 14:46:57 +0800 Subject: [PATCH] update docs Signed-off-by: shawn_he --- .../subsys-dfx-hisysevent-listening.md | 36 +++++++++---------- .../subsystems/subsys-dfx-hisysevent-query.md | 26 +++++++------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/en/device-dev/subsystems/subsys-dfx-hisysevent-listening.md b/en/device-dev/subsystems/subsys-dfx-hisysevent-listening.md index b7106bf6f4..5df286d267 100644 --- a/en/device-dev/subsystems/subsys-dfx-hisysevent-listening.md +++ b/en/device-dev/subsystems/subsys-dfx-hisysevent-listening.md @@ -21,34 +21,34 @@ Before subscribing to system events, you need to configure HiSysEvent logging. F ### Available APIs -**Table 1** EventListener APIs +**Table 1** Description of EventListener APIs -| API| Description| +| Name| Description | | -------- | --------- | -|bool HiSysEventManager::AddEventListener(std::shared_ptr<HiSysEventSubscribeCallBackBase> listener, std::vector<ListenerRule>& rules)|Registers a listener for system events. You can listen for certain events by specifying rules.

Input arguments: Return value:| -|bool HiSysEventManager::RemoveListener(std::shared_ptr<HiSysEventSubscribeCallBackBase> listener)|Removes the listener for system events.

Input argument: Return value:
  None.| +|bool HiSysEventManager::AddEventListener(std::shared_ptr<HiSysEventSubscribeCallBack> listener, std::vector<ListenerRule>& rules)|Registers a listener for system events. You can listen for certain events by specifying rules.

Input arguments: Return value:| +|bool HiSysEventManager::RemoveListener(std::shared_ptr<HiSysEventSubscribeCallBack> listener)|Removes the listener for system events.

Input arguments: Return value:
None.| **Table 2** Description of ListenerRule -| API| Description| +| API| Description | | -------- | --------- | -|ListenerRule(const std::string& tag, RuleType ruleType = RuleType::WHOLE_WORD)|Constructor used to create a **ListenerRule** object based on the event tag.

Input arguments:| -|ListenerRule(const std::string& domain, const std::string& eventName, RuleType ruleType = RuleType::WHOLE_WORD)|Constructor used to create a **ListenerRule** object based on the event domain and event name.

Input arguments: | -|ListenerRule(const std::string& domain, const std::string& eventName, const std::string& tag, RuleType ruleType = RuleType::WHOLE_WORD)|Constructor used to create a **ListenerRule** object based on the event domain, event name, and event tag.

Input arguments:| +|ListenerRule(const std::string& tag, RuleType ruleType = RuleType::WHOLE_WORD)|Constructor used to create a **ListenerRule** object based on the event tag.

Input arguments:| +|ListenerRule(const std::string& domain, const std::string& eventName, RuleType ruleType = RuleType::WHOLE_WORD)|Constructor used to create a **ListenerRule** object based on the event domain and event name.

Input arguments: | +|ListenerRule(const std::string& domain, const std::string& eventName, const std::string& tag, RuleType ruleType = RuleType::WHOLE_WORD)|Constructor used to create a **ListenerRule** object based on the event domain, event name, and event tag.

Input arguments:| **Table 3** Description of RuleType -| Enum| Description| +| Value | Description | | ------------ | ------------- | -| WHOLE_WORD | Whole word matching| -| PREFIX | Prefix matching| -| REGULAR | Regular expression matching| +| WHOLE_WORD | Whole word matching | +| PREFIX | Prefix matching | +| REGULAR | Regular expression matching | -**Table 4** Description of HiSysEventSubscribeCallBackBase +**Table 4** Description of HiSysEventSubscribeCallBack -| API| Description| +| API| Description | | -------- | --------- | -|void HiSysEventSubscribeCallBackBase::OnHandle(const std::string& domain, const std::string& eventName, const int eventType, const std::string& eventDetail)|Provides the callback of system events.

Input arguments: Return value:
  None.| +|void HiSysEventSubscribeCallBack::OnHandle(const std::string& domain, const std::string& eventName, const int eventType, const std::string& eventDetail)|Provides the callback of system events.

Input arguments: Return value:
None.| ### Development Example @@ -66,16 +66,16 @@ C++ #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() {} void OnServiceDied(); }; - #endif DEMO_LISTENER_H + #endif // DEMO_LISTENER_H ``` Create the **DemoListener.cpp** file, and add the implementation logic of the custom event callback API in the **DemoListener** class. diff --git a/en/device-dev/subsystems/subsys-dfx-hisysevent-query.md b/en/device-dev/subsystems/subsys-dfx-hisysevent-query.md index 03660c6827..8401862dae 100644 --- a/en/device-dev/subsystems/subsys-dfx-hisysevent-query.md +++ b/en/device-dev/subsystems/subsys-dfx-hisysevent-query.md @@ -13,16 +13,16 @@ HiSysEvent provides an API for you to query system events. You can query concern ### Available APIs -**Table 1** HiSysEvent query API +**Table 1** Description of the HiSysEvent query API -| API| Description| +| Name| Description | | -------- | --------- | -| bool HiSysEventManager::QueryHiSysEvent(struct QueryArg& queryArg, std::vector<QueryRule>& queryRules, std::shared_ptr<HiSysEventQueryCallBackBase> queryCallBack) | Queries system events by specifying search criteria such as the time segment, event domain, and event name.

Input arguments:
  • **queryArg**: event query parameter.
  • **queryRules**: event filtering rules.
  • **queryCallBack**: callback object for query results.
Return value:
  • **true**: The query is successful.
  • **false**: The query has failed.
| +| bool HiSysEventManager::QueryHiSysEvent(struct QueryArg& queryArg, std::vector<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:
  • **queryArg**: event query parameter.
  • **queryRules**: event filtering rules.
  • **queryRules**: callback object for query results.
Return value:
  • **true**: The query is successful.
  • **false**: The query has failed.
| **Table 2** Description of QueryArg -| Attribute| Description| +| Attribute| Description | | -------- | --------- | | beginTime | Start time, in the **long long int** format.| | endTime | End time, in the **long long int** format.| @@ -30,16 +30,16 @@ HiSysEvent provides an API for you to query system events. You can query concern **Table 3** Description of QueryRule -| API| Description| +| API| Description | | -------- | --------- | -| QueryRule(const std::string& domain, const std::vector<std::string>& eventList) | Constructor used to create a **QueryRule** object based on domain and event name list.

Input arguments:
  • **domain**:domain to which the event belongs, in the **string** format. By default, an empty string indicates that the domain is successfully matched.
  • **eventList**:event name list, in the std::vector<std::string> format. By default, an empty string indicates that the event names on the list are successfully matched.
| +| QueryRule(const std::string& domain, const std::vector<std::string>& eventList) | Constructor used to create a **QueryRule** object.

Input arguments:
  • **domain: domain to which the event of the **QueryRule** object belongs, in the **string** format. By default, an empty string indicates that the domain is successfully matched.
  • **eventList**: event name list, in the **std::vector<std::string>** format. By default, an empty string indicates that the event names on the list are successfully matched.
| -**Table 4** Description of HiSysEventQueryCallBackBase +**Table 4** Description of HiSysEventQueryCallBack -| API| Description| +| API| Description | | -------- | --------- | -| void HiSysEventQueryCallBackBase::OnQuery(const ::std::vector<std::string>& sysEvent, const ::std::vector<int64_t>& seq) | Callback object for event query.

Input arguments:
  • **sysEvent**: event set.
  • **seq**: event sequence set.
Return value:
  None.| -| void HiSysEventQueryCallBackBase::OnComplete(int32_t reason, int32_t total) | Callback object for completion of event query.

Input arguments:
  • **reason**: reason for completion of event query. The default value is **0**.
  • **total**: total number of events returned in this query.
Return value:
  None.| +| void HiSysEventQueryCallBack::OnQuery(const ::std::vector<std::string>& sysEvent, const ::std::vector<int64_t>& seq) | Callback object for event query.

Input arguments:
  • **sysEvent**: event set.
  • **seq**: event sequence set.
Return value:
None.| +| void HiSysEventQueryCallBack::OnComplete(int32_t reason, int32_t total) | Callback object for completion of event query.

Input arguments:
  • **reason**: reason for completion of event query. The default value is **0**.
  • **total**: total number of events returned in this query.
Return value:
None.| ### Development Example @@ -53,13 +53,13 @@ C++ - Implement the callback API. - void HiSysEventQueryCallBackBase::OnQuery\(const ::std::vector& sysEvent, const ::std::vector& seq\) + void HiSysEventQueryCallBack::OnQuery\(const ::std::vector<std::string>& 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\) ``` -- GitLab