diff --git a/en/device-dev/subsystems/subsys-dfx-hisysevent-listening.md b/en/device-dev/subsystems/subsys-dfx-hisysevent-listening.md
index b7106bf6f4ea8d0b0dab99470c598d42edfd9970..5df286d2676a52bb60d097feb926e00b2f2525b2 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:
- **listener**: callback object for system events.
- **rules**: rules for event listening.
Return value:- **0**: Repeated registration is successful.
- **1**: Initial registration is successful.
- Other values: Registration has failed.
|
-|bool HiSysEventManager::RemoveListener(std::shared_ptr<HiSysEventSubscribeCallBackBase> listener)|Removes the listener for system events.
Input argument: - **listener**: callback object for system events.
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: - **listener**: callback object for system events.
- **rules**: rules for event listening.
Return value:- **0**: Repeated registration is successful.
- **1**: Initial registration is successful.
- Other values: Registration has failed.
|
+|bool HiSysEventManager::RemoveListener(std::shared_ptr<HiSysEventSubscribeCallBack> listener)|Removes the listener for system events.
Input arguments: - **listener**: callback object for system events.
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:- **tag**: indicates the event tag for the **ListenerRule** object. The value is a string of 1 to 16 characters, including uppercase letters, lowercase letters, and digits.
- **ruleType**: indicates the type of the **ListenerRule** object. The value is an enum defined by **RuleType**.
|
-|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: - **domain**: indicates the event domain for the **ListenerRule** object. The value is a string of 1 to 16 characters, including uppercase letters, digits, and underscores (_).
- **eventName**: indicates the event name for the **ListenerRule** object. The value is a string of 1 to 32 characters, including uppercase letters, digits, and underscores (_).
- **ruleType**: indicates the type of the **ListenerRule** object. The value is an enum defined by **RuleType**.
|
-|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:- **tag**: indicates the event tag for the **ListenerRule** object. The value is a string of 1 to 16 characters, including uppercase letters, lowercase letters, and digits.
- **domain**: indicates the event domain for the **ListenerRule** object. The value is a string of 1 to 16 characters, including uppercase letters, digits, and underscores (_).
- **eventName**: indicates the event name for the **ListenerRule** object. The value is a string of 1 to 32 characters, including uppercase letters, digits, and underscores (_).
- **ruleType**: indicates the type of the **ListenerRule** object. The value is an enum defined by **RuleType**.
|
+|ListenerRule(const std::string& tag, RuleType ruleType = RuleType::WHOLE_WORD)|Constructor used to create a **ListenerRule** object based on the event tag.
Input arguments:- **tag**: indicates the event tag for the **ListenerRule** object. The value is a string of 1 to 16 characters, including uppercase letters, lowercase letters, and digits.
- **ruleType**: indicates the type of the **ListenerRule** object. The value is an enum defined by **RuleType**.
|
+|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: - **domain**: indicates the event domain for the **ListenerRule** object. The value is a string of 1 to 16 characters, including uppercase letters, digits, and underscores (_).
- **eventName**: indicates the event name for the **ListenerRule** object. The value is a string of 1 to 32 characters, including uppercase letters, digits, and underscores (_).
- **ruleType**: indicates the type of the **ListenerRule** object. The value is an enum defined by **RuleType**.
|
+|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:- **tag**: indicates the event tag for the **ListenerRule** object. The value is a string of 1 to 16 characters, including uppercase letters, lowercase letters, and digits.
- **domain**: indicates the event domain for the **ListenerRule** object. The value is a string of 1 to 16 characters, including uppercase letters, digits, and underscores (_).
- **eventName**: indicates the event name for the **ListenerRule** object. The value is a string of 1 to 32 characters, including uppercase letters, digits, and underscores (_).
- **ruleType**: indicates the type of the **ListenerRule** object. The value is an enum defined by **RuleType**.
|
**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: - **domain**: indicates the domain to which the event belongs.
- **eventName**: indicates the event name.
- **eventType**: indicates the event type.
- **eventDetail**: indicates the event information, in JSON format.
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: - **domain**: indicates the domain to which the event belongs.
- **eventName**: indicates the event name.
- **eventType**: indicates the event type.
- **eventDetail**: indicates the event information, in JSON format.
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 03660c682780e822f41b93dd8394d480ddfa3994..8401862dae6b3bcdf4824334889bb9f6d28a37b6 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\)
```