From 296e6b5ab18e7871b1061ab9fc8a5cb09442fdaa Mon Sep 17 00:00:00 2001 From: helloworld_win <811132355@qq.com> Date: Sun, 4 Feb 2024 11:07:20 +0800 Subject: [PATCH 01/20] add the data Signed-off-by: helloworld_win <811132355@qq.com> --- .../include/hiappevent/hiappevent.h | 1 + .../include/hiappevent/hiappevent_type.h | 85 +++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h index 2b3d36311..bc9064a1f 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h @@ -80,6 +80,7 @@ #include "hiappevent_cfg.h" #include "hiappevent_event.h" #include "hiappevent_param.h" +#include "hiappevent_type.h" #ifdef __cplusplus extern "C" { diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h new file mode 100644 index 000000000..f47972e8d --- /dev/null +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef HIVIEWDFX_HIAPPEVENT_PARAM_H +#define HIVIEWDFX_HIAPPEVENT_PARAM_H + +/** + * @addtogroup HiAppEvent + * @{ + * + * @brief Provides application event logging functions. + * + * Provides the event logging function for applications to log the fault, statistical, security, and user behavior + * events reported during running. Based on event information, you will be able to analyze the running status of + * applications. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @since 8 + * @version 1.0 + */ + +/** + * @file hiappevent_param.h + * + * @brief Defines the param names of all predefined events. + * + * In addition to custom events associated with specific apps, you can also use predefined events for logging. + * + * Sample code: + *
+ * ParamList list = OH_HiAppEvent_CreateParamList(); + * OH_HiAppEvent_AddInt32Param(list, PARAM_USER_ID, 123); + * int res = OH_HiAppEvent_Write("user_domain", EVENT_USER_LOGIN, BEHAVIOR, list); + * OH_HiAppEvent_DestroyParamList(list); + *+ * + * @since 8 + * @version 1.0 + */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Preset param name, user id param. + * + * @since 8 + * @version 1.0 + */ +#define PARAM_USER_ID "user_id" + +/** + * @brief Preset param name, distributed service name param. + * + * @since 8 + * @version 1.0 + */ +#define PARAM_DISTRIBUTED_SERVICE_NAME "ds_name" + +/** + * @brief Preset param name, distributed service instance id param. + * + * @since 8 + * @version 1.0 + */ +#define PARAM_DISTRIBUTED_SERVICE_INSTANCE_ID "ds_instance_id" + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif // HIVIEWDFX_HIAPPEVENT_PARAM_H \ No newline at end of file -- Gitee From a8042ccf396100b7f50b94e5d60e5ef87064ff4b Mon Sep 17 00:00:00 2001 From: hello_win <811132355@qq.com> Date: Sun, 4 Feb 2024 03:10:51 +0000 Subject: [PATCH 02/20] update hiviewdfx/hiappevent/include/hiappevent/hiappevent.h. Signed-off-by: hello_win <811132355@qq.com> --- .../include/hiappevent/hiappevent.h | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h index bc9064a1f..2f474d630 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h @@ -368,6 +368,90 @@ int OH_HiAppEvent_Write(const char* domain, const char* name, enum EventType typ */ bool OH_HiAppEvent_Configure(const char* name, const char* value); +/** + * @brief Add processor to report the event. + * + * @param processor The instance which report the event. + * @return Processor unique ID. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_AddProcessor(struct OH_HiAppEvent_Processor *processor); + +/** + * @brief Remove the processor. + * + * @param id The int64_t value of the processor unique ID. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_RemoveProcessor(int id); + +/** + * @brief Remove the processor. + * + * @param id The int64_t value of the processor unique ID. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_SetUserProperty(const char* name, const char* value); + +/** + * @brief Remove the processor. + * + * @param id The int64_t value of the processor unique ID. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_GetUserProperty(const char* name, char* value); + +/** + * @brief Remove the processor. + * + * @param id The int64_t value of the processor unique ID. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_SetUserId(const char* name, char* value); + +/** + * @brief Remove the processor. + * + * @param id The int64_t value of the processor unique ID. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_GetUserId(const char* name, char* value); + +/** + * @brief Add processor to report the event. + * + * @param processor The instance which report the event. + * @return Processor unique ID. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_AddWatcher(struct OH_HiAppEvent_Watcher* watcher); + +/** + * @brief Add processor to report the event. + * + * @param processor The instance which report the event. + * @return Processor unique ID. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_RemoveWatcher(struct OH_HiAppEvent_Watcher *watcher); + +/** + * @brief Add processor to report the event. + * + * @param processor The instance which report the event. + * @return Processor unique ID. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_TakeWatcherData(const char* name, char* appEventInfos[], uint32_t appEventInfoArraySize); #ifdef __cplusplus } #endif -- Gitee From a221a25d42ea63031c4998c9ba2373304aa31afd Mon Sep 17 00:00:00 2001 From: hello_win <811132355@qq.com> Date: Sun, 4 Feb 2024 03:11:24 +0000 Subject: [PATCH 03/20] update hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h. Signed-off-by: hello_win <811132355@qq.com> --- .../include/hiappevent/hiappevent_type.h | 162 ++++++++++++++---- 1 file changed, 129 insertions(+), 33 deletions(-) diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h index f47972e8d..ba6732b8a 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,41 +13,26 @@ * limitations under the License. */ -#ifndef HIVIEWDFX_HIAPPEVENT_PARAM_H -#define HIVIEWDFX_HIAPPEVENT_PARAM_H +#ifndef HIVIEWDFX_HIAPPEVENT_TYPE_H +#define HIVIEWDFX_HIAPPEVENT_TYPE_H /** * @addtogroup HiAppEvent * @{ * - * @brief Provides application event logging functions. - * - * Provides the event logging function for applications to log the fault, statistical, security, and user behavior - * events reported during running. Based on event information, you will be able to analyze the running status of - * applications. + * @brief Defines the structure used by hiappevent APIs. * * @syscap SystemCapability.HiviewDFX.HiAppEvent - * - * @since 8 + * @since 12 * @version 1.0 */ /** - * @file hiappevent_param.h - * - * @brief Defines the param names of all predefined events. + * @file hiappevent_type.h * - * In addition to custom events associated with specific apps, you can also use predefined events for logging. + * @brief Defines the structures used in the hiappevent APIs. * - * Sample code: - *
- * ParamList list = OH_HiAppEvent_CreateParamList(); - * OH_HiAppEvent_AddInt32Param(list, PARAM_USER_ID, 123); - * int res = OH_HiAppEvent_Write("user_domain", EVENT_USER_LOGIN, BEHAVIOR, list); - * OH_HiAppEvent_DestroyParamList(list); - *- * - * @since 8 + * @since 12 * @version 1.0 */ #ifdef __cplusplus @@ -55,31 +40,142 @@ extern "C" { #endif /** - * @brief Preset param name, user id param. + * @brief Defines the event config to be reported by processor.. + * + * @since 12 + * @version 1.0 + */ +struct OH_HiAppEvent_AppEventReportConfig { + /** The domain of the event. */ + const char* domain; + /** The name of the event. */ + const char* name; + /** The realtime report event. */ + bool isRealTime; +}; + +/** + * @brief Defines the processor information structure. * - * @since 8 + * @since 12 * @version 1.0 */ -#define PARAM_USER_ID "user_id" +struct OH_HiAppEvent_Processor { + /** The name of the processor. */ + const char* name; + /** The processor enable the developer to debug. */ + bool debugMode; + /** The server location which used for the processor to receive the data, defined by the processor. */ + const char* routeInfo; + /** The app ID is provided by the processor. */ + const char* appId; + /** The processor report the event when start. */ + bool onStartReport; + /** The processor report the event when the application onBackground. */ + bool onBackgroundReport; + /** The processor report the event according to the period. */ + uint32_t periodReport; + /** The processor report the event according to the batch size. */ + uint32_t batchReport; + /** The user ID names which the processor can report. */ + const char* userIds[]; + /** The user property names which the processor can report. */ + const char* userProperties[]; + /** The events which the processor can report. */ + struct OH_HiAppEvent_AppEventReportConfig eventConfigs[]; + /** The processor id. */ + int id; + /** The extend value. */ + const char* extend; +}; /** - * @brief Preset param name, distributed service name param. + * @brief Definition of event filter object, which is used to filter events monitored by the watcher. * - * @since 8 + * @since 12 * @version 1.0 */ -#define PARAM_DISTRIBUTED_SERVICE_NAME "ds_name" +struct OH_HiAppEvent_AppEventFilter { + /** The name of the processor. */ + const char* domain; + /** The types of the events to be monitored by the watcher. */ + uint32_t eventType; + /** The names of the events to be monitored by the watcher. */ + const char* names[]; + /** The size of the name array. */ + uint32_t nameArraySize; +}; /** - * @brief Preset param name, distributed service instance id param. + * @brief Defines the event group. * - * @since 8 + * @since 12 * @version 1.0 */ -#define PARAM_DISTRIBUTED_SERVICE_INSTANCE_ID "ds_instance_id" +struct OH_HiAppEvent_AppEventGroup { + /** The name of the event. */ + const char* name; + /** The event array which is group by the name. */ + const char* appEventInfos[]; + /** The event array size. */ + uint32_t appEventInfoArraySize +}; + +typedef void (*OH_HiAppEvent_OnReceive)(const char* domain, struct OH_HiAppEvent_AppEventGroup* appEventGroups); +typedef void (*OH_HiAppEvent_OnTrigger)(int32_t curRow, int32_t curSize); + +/** + * @brief Defines the watcher information structure. + * + * @since 12 + * @version 1.0 + */ +struct OH_HiAppEvent_Watcher { + /** The name of the watcher. */ + const char* name; + /** The condition for triggering callback.*/ + const struct OH_HiAppEvent_TriggerCondition* triggerCondition; + /** The event filters for monitoring events. */ + const struct OH_HiAppEvent_AppEventFilter* appEventFilters; + /** The callback function of watcher.*/ + OH_HiAppEvent_OnTrigger onTrigger; + /** The callback function, when watcher receive the event.*/ + OH_HiAppEvent_OnReceive onReceive; +}; + +/** + * @brief Defines the processor information structure. + *+ + * @since 12 + * @version 1.0 + */ +struct OH_HiAppEvent_Processor { + /** The name of the processor. */ + const char* name; + /** The processor enable the developer to debug. */ + bool debugMode; + /** The server location which used for the processor to receive the data, defined by the processor. */ + const char* routeInfo; + /** The app ID is provided by the processor. */ + const char* appId; + /** The processor report the event when start. */ + bool onStartReport; + /** The processor report the event when the application onBackground. */ + bool onBackgroundReport; + /** The processor report the event according to the period. */ + uint32_t periodReport; + /** The processor report the event according to the batch size. */ + uint32_t batchReport; + /** The user ID names which the processor can report. */ + const char* userIds[]; + /** The user property names which the processor can report. */ + const char* userProperties[]; + /** The events which the processor can report. */ + struct OH_HiAppEvent_AppEventReportConfig eventConfigs[]; +}; #ifdef __cplusplus } #endif /** @} */ -#endif // HIVIEWDFX_HIAPPEVENT_PARAM_H \ No newline at end of file +#endif // HIVIEWDFX_HIAPPEVENT_TYPE_H \ No newline at end of file -- Gitee From 8fcf9b10d7ffcc49ac91f8da6acf4550afb62450 Mon Sep 17 00:00:00 2001 From: hello_win <811132355@qq.com> Date: Sun, 4 Feb 2024 03:12:38 +0000 Subject: [PATCH 04/20] update hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h. Signed-off-by: hello_win <811132355@qq.com> --- .../include/hiappevent/hiappevent_type.h | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h index ba6732b8a..c62eb33cf 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h @@ -143,37 +143,6 @@ struct OH_HiAppEvent_Watcher { /** The callback function, when watcher receive the event.*/ OH_HiAppEvent_OnReceive onReceive; }; - -/** - * @brief Defines the processor information structure. - *+ - * @since 12 - * @version 1.0 - */ -struct OH_HiAppEvent_Processor { - /** The name of the processor. */ - const char* name; - /** The processor enable the developer to debug. */ - bool debugMode; - /** The server location which used for the processor to receive the data, defined by the processor. */ - const char* routeInfo; - /** The app ID is provided by the processor. */ - const char* appId; - /** The processor report the event when start. */ - bool onStartReport; - /** The processor report the event when the application onBackground. */ - bool onBackgroundReport; - /** The processor report the event according to the period. */ - uint32_t periodReport; - /** The processor report the event according to the batch size. */ - uint32_t batchReport; - /** The user ID names which the processor can report. */ - const char* userIds[]; - /** The user property names which the processor can report. */ - const char* userProperties[]; - /** The events which the processor can report. */ - struct OH_HiAppEvent_AppEventReportConfig eventConfigs[]; -}; #ifdef __cplusplus } #endif -- Gitee From fe55470d8c4186295dd923c41ce7e5260f592c4e Mon Sep 17 00:00:00 2001 From: hello_win <811132355@qq.com> Date: Sun, 4 Feb 2024 03:26:15 +0000 Subject: [PATCH 05/20] update hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h. Signed-off-by: hello_win <811132355@qq.com> --- .../include/hiappevent/hiappevent_type.h | 98 ++++++++++--------- 1 file changed, 53 insertions(+), 45 deletions(-) diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h index c62eb33cf..48edbdbbf 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h @@ -46,11 +46,11 @@ extern "C" { * @version 1.0 */ struct OH_HiAppEvent_AppEventReportConfig { - /** The domain of the event. */ - const char* domain; - /** The name of the event. */ - const char* name; - /** The realtime report event. */ + /* The domain of the event. */ + char* domain; + /* The name of the event. */ + char* name; + /* The realtime report event. */ bool isRealTime; }; @@ -61,32 +61,38 @@ struct OH_HiAppEvent_AppEventReportConfig { * @version 1.0 */ struct OH_HiAppEvent_Processor { - /** The name of the processor. */ - const char* name; - /** The processor enable the developer to debug. */ + /* The name of the processor. */ + char* name; + /* The processor enable the developer to debug. */ bool debugMode; - /** The server location which used for the processor to receive the data, defined by the processor. */ - const char* routeInfo; - /** The app ID is provided by the processor. */ - const char* appId; - /** The processor report the event when start. */ + /* The server location which used for the processor to receive the data, defined by the processor. */ + char* routeInfo; + /* The app ID is provided by the processor. */ + char* appId; + /* The processor report the event when start. */ bool onStartReport; - /** The processor report the event when the application onBackground. */ + /* The processor report the event when the application onBackground. */ bool onBackgroundReport; - /** The processor report the event according to the period. */ + /* The processor report the event according to the period. */ uint32_t periodReport; - /** The processor report the event according to the batch size. */ + /* The processor report the event according to the batch size. */ uint32_t batchReport; - /** The user ID names which the processor can report. */ - const char* userIds[]; - /** The user property names which the processor can report. */ - const char* userProperties[]; - /** The events which the processor can report. */ - struct OH_HiAppEvent_AppEventReportConfig eventConfigs[]; - /** The processor id. */ + /* The user ID names which the processor can report. */ + char* userIds[]; + /* The user ID name array size. */ + uint32_t userIdArraySize; + /* The user property names which the processor can report. */ + char* userProperties[]; + /* The user property array size. */ + uint32_t userPropertyArraySize; + /* The events which the processor can report. */ + struct OH_HiAppEvent_AppEventReportConfig* eventConfigs; + /* The app event report config array size. */ + uint32_t reportConfigArraySize; + /* The processor id. */ int id; - /** The extend value. */ - const char* extend; + /* The extend value. */ + char* extend; }; /** @@ -96,13 +102,13 @@ struct OH_HiAppEvent_Processor { * @version 1.0 */ struct OH_HiAppEvent_AppEventFilter { - /** The name of the processor. */ - const char* domain; - /** The types of the events to be monitored by the watcher. */ + /* The name of the processor. */ + char* domain; + /* The types of the events to be monitored by the watcher. */ uint32_t eventType; - /** The names of the events to be monitored by the watcher. */ - const char* names[]; - /** The size of the name array. */ + /* The names of the events to be monitored by the watcher. */ + char* names[]; + /* The size of the name array. */ uint32_t nameArraySize; }; @@ -113,17 +119,17 @@ struct OH_HiAppEvent_AppEventFilter { * @version 1.0 */ struct OH_HiAppEvent_AppEventGroup { - /** The name of the event. */ - const char* name; - /** The event array which is group by the name. */ - const char* appEventInfos[]; - /** The event array size. */ + /* The name of the event. */ + char* name; + /* The event array which is group by the name. */ + char* appEventInfos[]; + /* The event array size. */ uint32_t appEventInfoArraySize }; typedef void (*OH_HiAppEvent_OnReceive)(const char* domain, struct OH_HiAppEvent_AppEventGroup* appEventGroups); -typedef void (*OH_HiAppEvent_OnTrigger)(int32_t curRow, int32_t curSize); +typedef void (*OH_HiAppEvent_OnTrigger)(int32_t row, int32_t size); /** * @brief Defines the watcher information structure. @@ -132,15 +138,17 @@ typedef void (*OH_HiAppEvent_OnTrigger)(int32_t curRow, int32_t curSize); * @version 1.0 */ struct OH_HiAppEvent_Watcher { - /** The name of the watcher. */ - const char* name; - /** The condition for triggering callback.*/ - const struct OH_HiAppEvent_TriggerCondition* triggerCondition; - /** The event filters for monitoring events. */ - const struct OH_HiAppEvent_AppEventFilter* appEventFilters; - /** The callback function of watcher.*/ + /* The name of the watcher. */ + char* name; + /* The condition for triggering callback.*/ + struct OH_HiAppEvent_TriggerCondition triggerCondition; + /* The event filters for monitoring events. */ + struct OH_HiAppEvent_AppEventFilter* appEventFilters; + /* The event filters array size. */ + uint32_t filterArraySize; + /* The callback function of watcher.*/ OH_HiAppEvent_OnTrigger onTrigger; - /** The callback function, when watcher receive the event.*/ + /* The callback function, when watcher receive the event.*/ OH_HiAppEvent_OnReceive onReceive; }; #ifdef __cplusplus -- Gitee From be7551ab27f9114a6024f964f972261351fcf5ab Mon Sep 17 00:00:00 2001 From: hello_win <811132355@qq.com> Date: Sun, 4 Feb 2024 03:42:51 +0000 Subject: [PATCH 06/20] update hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h. Signed-off-by: hello_win <811132355@qq.com> --- .../include/hiappevent/hiappevent_type.h | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h index 48edbdbbf..66ab1f795 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h @@ -41,7 +41,7 @@ extern "C" { /** * @brief Defines the event config to be reported by processor.. - * + * @SystemCapability.HiviewDFX.HiAppEvent * @since 12 * @version 1.0 */ @@ -56,7 +56,7 @@ struct OH_HiAppEvent_AppEventReportConfig { /** * @brief Defines the processor information structure. - * + * @SystemCapability.HiviewDFX.HiAppEvent * @since 12 * @version 1.0 */ @@ -97,7 +97,7 @@ struct OH_HiAppEvent_Processor { /** * @brief Definition of event filter object, which is used to filter events monitored by the watcher. - * + * @SystemCapability.HiviewDFX.HiAppEvent * @since 12 * @version 1.0 */ @@ -114,7 +114,7 @@ struct OH_HiAppEvent_AppEventFilter { /** * @brief Defines the event group. - * + * @syscap SystemCapability.HiviewDFX.HiAppEvent * @since 12 * @version 1.0 */ @@ -127,13 +127,29 @@ struct OH_HiAppEvent_AppEventGroup { uint32_t appEventInfoArraySize }; +/** + * @brief Called when watcher receive the event. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @param domain The domain of the event. + * @param appEventGroups The event group by the domain. + * @since 12 + * @version 1.0 + */ +typedef void (*OH_HiAppEvent_OnReceive)(const char* domain, const struct OH_HiAppEvent_AppEventGroup* appEventGroups); -typedef void (*OH_HiAppEvent_OnReceive)(const char* domain, struct OH_HiAppEvent_AppEventGroup* appEventGroups); +/** + * @brief Called when watcher receive the event meet the condition. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @param row The row of events received by watcher. + * @param size The size of events received by watcher. + * @since 12 + * @version 1.0 + */ typedef void (*OH_HiAppEvent_OnTrigger)(int32_t row, int32_t size); /** * @brief Defines the watcher information structure. - * + * @syscap SystemCapability.HiviewDFX.HiAppEvent * @since 12 * @version 1.0 */ -- Gitee From a47b9dd9585bbe90112107b139ace3da551ae843 Mon Sep 17 00:00:00 2001 From: hello_win <811132355@qq.com> Date: Sun, 4 Feb 2024 03:58:56 +0000 Subject: [PATCH 07/20] update hiviewdfx/hiappevent/include/hiappevent/hiappevent.h. Signed-off-by: hello_win <811132355@qq.com> --- .../include/hiappevent/hiappevent.h | 53 +++++++++++++------ 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h index 2f474d630..013e141f8 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h @@ -382,72 +382,91 @@ int OH_HiAppEvent_AddProcessor(struct OH_HiAppEvent_Processor *processor); * @brief Remove the processor. * * @param id The int64_t value of the processor unique ID. + * @return Returns {@code 0} if remove the processor is successful, and returns a + * negative integer if remove the processor fail. * @since 12 * @version 1.0 */ int OH_HiAppEvent_RemoveProcessor(int id); /** - * @brief Remove the processor. + * @brief Set the property. * - * @param id The int64_t value of the processor unique ID. + * @param name The name of the property. + * @param value The value of the property. + * @return Returns {@code 0} if set user property is successful, and returns a + * negative integer if set fail. * @since 12 * @version 1.0 */ int OH_HiAppEvent_SetUserProperty(const char* name, const char* value); /** - * @brief Remove the processor. + * @brief Get the property. * - * @param id The int64_t value of the processor unique ID. + * @param name The name of the property. + * @param value The value of the property. + * @return Returns {@code 0} if get user property is successful, and returns a + * negative integer if get fail. * @since 12 * @version 1.0 */ int OH_HiAppEvent_GetUserProperty(const char* name, char* value); /** - * @brief Remove the processor. + * @brief Set the user id. * - * @param id The int64_t value of the processor unique ID. + * @param name The name of the user id. + * @param value The value of the user id. + * @return Returns {@code 0} if set user id is successful, and returns a + * negative integer if set fail. * @since 12 * @version 1.0 */ int OH_HiAppEvent_SetUserId(const char* name, char* value); /** - * @brief Remove the processor. + * @brief Get the user id. * - * @param id The int64_t value of the processor unique ID. + * @param name The name of the user id. + * @param value The value of the user id. + * @return Returns {@code 0} if get user id is successful, and returns a + * negative integer if get fail. * @since 12 * @version 1.0 */ int OH_HiAppEvent_GetUserId(const char* name, char* value); /** - * @brief Add processor to report the event. + * @brief Add watcher to receive the event. * - * @param processor The instance which report the event. - * @return Processor unique ID. + * @param watcher The instance which receive the event. + * @return Returns {@code 0} if add watcher is successful, and returns a + * negative integer if add fail. * @since 12 * @version 1.0 */ int OH_HiAppEvent_AddWatcher(struct OH_HiAppEvent_Watcher* watcher); /** - * @brief Add processor to report the event. + * @brief Remove watcher. * - * @param processor The instance which report the event. - * @return Processor unique ID. + * @param watcher The instance which report the event. + * @return Returns {@code 0} if remove watcher is successful, and returns a + * negative integer if remove fail. * @since 12 * @version 1.0 */ int OH_HiAppEvent_RemoveWatcher(struct OH_HiAppEvent_Watcher *watcher); /** - * @brief Add processor to report the event. + * @brief Take the watcher received event data. * - * @param processor The instance which report the event. - * @return Processor unique ID. + * @param name The name of the watcher which receive the event. + * @param appEventInfos The events which the watcher receive. + * @param appEventInfoArraySize The events array size. + * @return Returns {@code 0} if the watcher has data to take, and returns a + * negative integer if the watcher has no data left. * @since 12 * @version 1.0 */ -- Gitee From d1cd02185556a78896891c76191f24110ff0f8ad Mon Sep 17 00:00:00 2001 From: hello_win <811132355@qq.com> Date: Mon, 5 Feb 2024 12:51:44 +0000 Subject: [PATCH 08/20] update hiviewdfx/hiappevent/include/hiappevent/hiappevent.h. Signed-off-by: hello_win <811132355@qq.com> --- hiviewdfx/hiappevent/include/hiappevent/hiappevent.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h index 013e141f8..919382fe2 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h @@ -376,7 +376,7 @@ bool OH_HiAppEvent_Configure(const char* name, const char* value); * @since 12 * @version 1.0 */ -int OH_HiAppEvent_AddProcessor(struct OH_HiAppEvent_Processor *processor); +int OH_HiAppEvent_AddProcessor(struct OH_HiAppEvent_Processor* processor); /** * @brief Remove the processor. @@ -463,14 +463,14 @@ int OH_HiAppEvent_RemoveWatcher(struct OH_HiAppEvent_Watcher *watcher); * @brief Take the watcher received event data. * * @param name The name of the watcher which receive the event. - * @param appEventInfos The events which the watcher receive. - * @param appEventInfoArraySize The events array size. + * @param size The buffer size to cache the event. + * @param buffer The buffer to cache the event. * @return Returns {@code 0} if the watcher has data to take, and returns a * negative integer if the watcher has no data left. * @since 12 * @version 1.0 */ -int OH_HiAppEvent_TakeWatcherData(const char* name, char* appEventInfos[], uint32_t appEventInfoArraySize); +int OH_HiAppEvent_TakeWatcherData(const char* name, uint32_t size, char* buffer); #ifdef __cplusplus } #endif -- Gitee From 49d917848e19ca1169d4bf8dc0aa4e378c07cf70 Mon Sep 17 00:00:00 2001 From: hello_win <811132355@qq.com> Date: Mon, 5 Feb 2024 12:59:11 +0000 Subject: [PATCH 09/20] update hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h. Signed-off-by: hello_win <811132355@qq.com> --- .../include/hiappevent/hiappevent_type.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h index 66ab1f795..7893a2d05 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h @@ -54,6 +54,21 @@ struct OH_HiAppEvent_AppEventReportConfig { bool isRealTime; }; +/** + * @brief Defines the event config to be reported by processor.. + * @SystemCapability.HiviewDFX.HiAppEvent + * @since 12 + * @version 1.0 + */ +struct OH_HiAppEvent_TriggerCondition { + /* The number of write events that trigger callback. */ + uint32_t row; + /* The interval for triggering callback. */ + uint32_t size; + /* The interval for triggering callback. */ + uint32_t timeOut; +}; + /** * @brief Defines the processor information structure. * @SystemCapability.HiviewDFX.HiAppEvent @@ -92,7 +107,7 @@ struct OH_HiAppEvent_Processor { /* The processor id. */ int id; /* The extend value. */ - char* extend; + char* extendConfig; }; /** @@ -135,7 +150,7 @@ struct OH_HiAppEvent_AppEventGroup { * @since 12 * @version 1.0 */ -typedef void (*OH_HiAppEvent_OnReceive)(const char* domain, const struct OH_HiAppEvent_AppEventGroup* appEventGroups); +typedef void (*OH_HiAppEvent_OnReceive)(const char* domain, const struct OH_HiAppEvent_AppEventGroup* appEventGroups, uint32_t groupSize); /** * @brief Called when watcher receive the event meet the condition. -- Gitee From 873d57c47563a8e7c056413b11a1d6d71e3af038 Mon Sep 17 00:00:00 2001 From: hello_win <811132355@qq.com> Date: Mon, 19 Feb 2024 12:35:05 +0000 Subject: [PATCH 10/20] update hiviewdfx/hiappevent/include/hiappevent/hiappevent.h. Signed-off-by: hello_win <811132355@qq.com> --- .../include/hiappevent/hiappevent.h | 77 ++----------------- 1 file changed, 8 insertions(+), 69 deletions(-) diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h index 919382fe2..4147128cc 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h @@ -368,75 +368,6 @@ int OH_HiAppEvent_Write(const char* domain, const char* name, enum EventType typ */ bool OH_HiAppEvent_Configure(const char* name, const char* value); -/** - * @brief Add processor to report the event. - * - * @param processor The instance which report the event. - * @return Processor unique ID. - * @since 12 - * @version 1.0 - */ -int OH_HiAppEvent_AddProcessor(struct OH_HiAppEvent_Processor* processor); - -/** - * @brief Remove the processor. - * - * @param id The int64_t value of the processor unique ID. - * @return Returns {@code 0} if remove the processor is successful, and returns a - * negative integer if remove the processor fail. - * @since 12 - * @version 1.0 - */ -int OH_HiAppEvent_RemoveProcessor(int id); - -/** - * @brief Set the property. - * - * @param name The name of the property. - * @param value The value of the property. - * @return Returns {@code 0} if set user property is successful, and returns a - * negative integer if set fail. - * @since 12 - * @version 1.0 - */ -int OH_HiAppEvent_SetUserProperty(const char* name, const char* value); - -/** - * @brief Get the property. - * - * @param name The name of the property. - * @param value The value of the property. - * @return Returns {@code 0} if get user property is successful, and returns a - * negative integer if get fail. - * @since 12 - * @version 1.0 - */ -int OH_HiAppEvent_GetUserProperty(const char* name, char* value); - -/** - * @brief Set the user id. - * - * @param name The name of the user id. - * @param value The value of the user id. - * @return Returns {@code 0} if set user id is successful, and returns a - * negative integer if set fail. - * @since 12 - * @version 1.0 - */ -int OH_HiAppEvent_SetUserId(const char* name, char* value); - -/** - * @brief Get the user id. - * - * @param name The name of the user id. - * @param value The value of the user id. - * @return Returns {@code 0} if get user id is successful, and returns a - * negative integer if get fail. - * @since 12 - * @version 1.0 - */ -int OH_HiAppEvent_GetUserId(const char* name, char* value); - /** * @brief Add watcher to receive the event. * @@ -471,6 +402,14 @@ int OH_HiAppEvent_RemoveWatcher(struct OH_HiAppEvent_Watcher *watcher); * @version 1.0 */ int OH_HiAppEvent_TakeWatcherData(const char* name, uint32_t size, char* buffer); + +/** + * @brief Clear all local logging data of the application. + * + * @since 12 + * @version 1.0 + */ +void OH_HiAppEvent_ClearData(); #ifdef __cplusplus } #endif -- Gitee From 2260dc80138548db9c3cbc912a4b69c90958f0ad Mon Sep 17 00:00:00 2001 From: hello_win <811132355@qq.com> Date: Mon, 19 Feb 2024 12:43:11 +0000 Subject: [PATCH 11/20] update hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h. Signed-off-by: hello_win <811132355@qq.com> --- .../include/hiappevent/hiappevent_type.h | 58 +------------------ 1 file changed, 1 insertion(+), 57 deletions(-) diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h index 7893a2d05..73d405954 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h @@ -39,21 +39,6 @@ extern "C" { #endif -/** - * @brief Defines the event config to be reported by processor.. - * @SystemCapability.HiviewDFX.HiAppEvent - * @since 12 - * @version 1.0 - */ -struct OH_HiAppEvent_AppEventReportConfig { - /* The domain of the event. */ - char* domain; - /* The name of the event. */ - char* name; - /* The realtime report event. */ - bool isRealTime; -}; - /** * @brief Defines the event config to be reported by processor.. * @SystemCapability.HiviewDFX.HiAppEvent @@ -69,47 +54,6 @@ struct OH_HiAppEvent_TriggerCondition { uint32_t timeOut; }; -/** - * @brief Defines the processor information structure. - * @SystemCapability.HiviewDFX.HiAppEvent - * @since 12 - * @version 1.0 - */ -struct OH_HiAppEvent_Processor { - /* The name of the processor. */ - char* name; - /* The processor enable the developer to debug. */ - bool debugMode; - /* The server location which used for the processor to receive the data, defined by the processor. */ - char* routeInfo; - /* The app ID is provided by the processor. */ - char* appId; - /* The processor report the event when start. */ - bool onStartReport; - /* The processor report the event when the application onBackground. */ - bool onBackgroundReport; - /* The processor report the event according to the period. */ - uint32_t periodReport; - /* The processor report the event according to the batch size. */ - uint32_t batchReport; - /* The user ID names which the processor can report. */ - char* userIds[]; - /* The user ID name array size. */ - uint32_t userIdArraySize; - /* The user property names which the processor can report. */ - char* userProperties[]; - /* The user property array size. */ - uint32_t userPropertyArraySize; - /* The events which the processor can report. */ - struct OH_HiAppEvent_AppEventReportConfig* eventConfigs; - /* The app event report config array size. */ - uint32_t reportConfigArraySize; - /* The processor id. */ - int id; - /* The extend value. */ - char* extendConfig; -}; - /** * @brief Definition of event filter object, which is used to filter events monitored by the watcher. * @SystemCapability.HiviewDFX.HiAppEvent @@ -120,7 +64,7 @@ struct OH_HiAppEvent_AppEventFilter { /* The name of the processor. */ char* domain; /* The types of the events to be monitored by the watcher. */ - uint32_t eventType; + uint32_t eventTypes; /* The names of the events to be monitored by the watcher. */ char* names[]; /* The size of the name array. */ -- Gitee From fa841b6265c0ed77ab566350f84fe3479ceff41b Mon Sep 17 00:00:00 2001 From: hello_win <811132355@qq.com> Date: Tue, 20 Feb 2024 14:27:34 +0000 Subject: [PATCH 12/20] update hiviewdfx/hiappevent/include/hiappevent/hiappevent.h. Signed-off-by: hello_win <811132355@qq.com> --- .../include/hiappevent/hiappevent.h | 177 ++++++++++++++++-- 1 file changed, 160 insertions(+), 17 deletions(-) diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h index 4147128cc..d1a7da384 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h @@ -116,6 +116,14 @@ enum EventType { */ typedef struct ParamListNode* ParamList; +/** + * @brief Watcher node. + * + * @since 12 + * @version 1.0 + */ +typedef struct Watcher Watcher; + /** * @brief Create a pointer to the ParamList. * @@ -368,48 +376,183 @@ int OH_HiAppEvent_Write(const char* domain, const char* name, enum EventType typ */ bool OH_HiAppEvent_Configure(const char* name, const char* value); +/** + * @brief Create a watcher handler pointer to set the property. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @param name The name of the watcher. + * @return Returns a pointer to the watcher instance. + * @since 12 + * @version 1.0 + */ +Watcher* OH_HiAppEvent_CreateWatcher(const char* name); + +/** + * @brief Destroy the specified Watcher handle resource. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @param watcher The pointer to the watcher instance. + * @since 12 + * @version 1.0 + */ +void OH_HiAppEvent_DestroyWatcher(Watcher* watcher); + +/** + * @brief Set the TriggerCondition to trigger the onTrigger callback. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @param watcher The pointer to the watcher instance. + * @param row The row of write events that trigger the onTrigger callback. + * @param size The size of write events that trigger the onTrigger callback. + * @param timeOut The interval for trigger the onTrigger callback. + * @return Returns {@code 0} if set TriggerCondition is successful, and returns a + * negative integer if set fail. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_SetTriggerCondition(Watcher* watcher, uint32_t row, uint32_t size, uint32_t timeOut); + +/** + * @brief Set the AppEventFilter, which is used to filter events monitored by the watcher. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @param watcher The pointer to the watcher instance. + * @param domain The name of the event domain to be monitored by the watcher.. + * @param eventTypes The types of the events to be monitored by the watcher.0x08 means BEHAVIOR,0x04 means SECURITY, 0x02 means STATISTIC,0x01 means FAULT, 0xff and 0x00 means all. + * @param names The names of the events to be monitored by the watcher. + * @param namesLen The length of names array. + * @return Returns {@code 0} if set AppEventFilter is successful, and returns a + * negative integer if set fail. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_SetAppEventFilter(Watcher* watcher, const char* domain, uint8_t eventTypes, const char * const* names, int namesLen); + +/** + * @brief Set the onTrigger callback. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @param watcher The pointer to the watcher instance. + * @param onTrigger The callback of the watcher. + * @return Returns {@code 0} if set OnTrigger is successful, and returns a + * negative integer if set fail. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_SetWatcherOnTrigger(Watcher* watcher, OH_HiAppEvent_OnTrigger onTrigger); + +/** + * @brief Set the OnReceive callback. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @param watcher The pointer to the watcher instance. + * @param onReceive The callback of the watcher. + * @return Returns {@code 0} if set OnReceive is successful, and returns a + * negative integer if set fail. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_SetWatcherOnReceive(Watcher* watcher, OH_HiAppEvent_OnReceive onReceive); + +/** + * @brief Set the AppEventFilter, which is used to filter events monitored by the watcher. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @param watcher The pointer to the watcher instance. + * @param size The the threshold size per read. + * @param onTake The callback of the watcher. + * @return Returns {@code 0} if remove watcher is successful, and returns a + * negative integer if remove fail. + * @since 12 + * @version 1.0 + */ +int OH_HiAppEvent_TakeWatcherData(Watcher* watcher, uint32_t size, OH_HiAppEvent_OnTake onTake); + /** * @brief Add watcher to receive the event. - * - * @param watcher The instance which receive the event. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @param watcher The pointer to the watcher instance which receive the event. * @return Returns {@code 0} if add watcher is successful, and returns a * negative integer if add fail. * @since 12 * @version 1.0 */ -int OH_HiAppEvent_AddWatcher(struct OH_HiAppEvent_Watcher* watcher); +int OH_HiAppEvent_AddWatcher(Watcher* watcher); /** * @brief Remove watcher. - * - * @param watcher The instance which report the event. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @param watcher The pointer to the watcher instance. * @return Returns {@code 0} if remove watcher is successful, and returns a * negative integer if remove fail. * @since 12 * @version 1.0 */ -int OH_HiAppEvent_RemoveWatcher(struct OH_HiAppEvent_Watcher *watcher); +int OH_HiAppEvent_RemoveWatcher(Watcher* watcher); /** - * @brief Take the watcher received event data. - * - * @param name The name of the watcher which receive the event. - * @param size The buffer size to cache the event. - * @param buffer The buffer to cache the event. - * @return Returns {@code 0} if the watcher has data to take, and returns a - * negative integer if the watcher has no data left. + * @brief Clear all local logging data of the application. + * @syscap SystemCapability.HiviewDFX.HiAppEvent * @since 12 * @version 1.0 */ -int OH_HiAppEvent_TakeWatcherData(const char* name, uint32_t size, char* buffer); +void OH_HiAppEvent_ClearData(); /** - * @brief Clear all local logging data of the application. - * + * @brief Definition of AppEventInfo object. + * @SystemCapability.HiviewDFX.HiAppEvent * @since 12 * @version 1.0 */ -void OH_HiAppEvent_ClearData(); +struct AppEventInfo { + /* The domain of the event. */ + const char* domain; + /* The name of the event. */ + const char* name; + /* The type of the event. */ + uint32_t type; + /* The json string of the parameter. */ + const char* paramJsonStr; +} + +/** + * @brief Defines the event group. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 12 + * @version 1.0 + */ +struct OH_HiAppEvent_AppEventGroup { + /* The name of the event. */ + const char* name; + /* The event array which is group by the name. */ + const struct AppEventInfo* appEventInfos; + /* The length of appEventInfos array. */ + uint32_t infoLen; +}; + +/** + * @brief Called when watcher receive the event. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @param domain The domain of the event. + * @param appEventGroups The event group by the domain. + * @param groupLen The length of appEventGroups array. + * @since 12 + * @version 1.0 + */ +typedef void (*OH_HiAppEvent_OnReceive)(const char* domain, const struct OH_HiAppEvent_AppEventGroup* appEventGroups, uint32_t groupLen); + +/** + * @brief Called when watcher receive the event meet the condition. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @param row The row of events received by watcher. + * @param size The size of events received by watcher. + * @since 12 + * @version 1.0 + */ +typedef void (*OH_HiAppEvent_OnTrigger)(int32_t row, int32_t size); + +/** + * @brief Called when watcher take the events. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @param events The event json string array. + * @param eventLen The length of events array. + * @since 12 + * @version 1.0 + */ +typedef void (*OH_HiAppEvent_OnTake)(const char * const * events, int32_t eventLen); #ifdef __cplusplus } #endif -- Gitee From 8943c43a34aba12506bd726667b26d9b23017a6f Mon Sep 17 00:00:00 2001 From: helloworld_win <811132355@qq.com> Date: Wed, 21 Feb 2024 09:55:35 +0800 Subject: [PATCH 13/20] add the api Signed-off-by: helloworld_win <811132355@qq.com> --- .../include/hiappevent/hiappevent_event.h | 64 +++++++++ .../include/hiappevent/hiappevent_type.h | 133 ------------------ 2 files changed, 64 insertions(+), 133 deletions(-) delete mode 100644 hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_event.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_event.h index 66aa52061..ce7e329d0 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_event.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_event.h @@ -79,6 +79,70 @@ extern "C" { */ #define EVENT_DISTRIBUTED_SERVICE_START "hiappevent.distributed_service_start" +/** + * @brief app crash event. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_APP_CRASH "hiappevent.app_crash" + +/** + * @brief app freeze event. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_APP_FREEZE "hiappevent.app_freeze" + +/** + * @brief app launch event. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_APP_LAUNCH "hiappevent.app_launch" + +/** + * @brief app scroll jank event. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_SCROLL_JANK "hiappevent.scroll_jank" + +/** + * @brief app cpu usage high event. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_CPU_USAGE_HIGH "hiappevent.cpu_usage_high" + +/** + * @brief app battery usage event. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_BATTERY_USAGE "hiappevent.battery_usage" + +/** + * @brief app resource overlimit event. + * + * @since 12 + * @version 1.0 + */ +#define EVENT_RESOURCE_OVERLIMIT "hiappevent.resource_overlimit" + +/** + * @brief OS domain. + * + * @since 12 + * @version 1.0 + */ +#define DOMAIN_OS "hiappevent.os" + #ifdef __cplusplus } #endif diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h deleted file mode 100644 index 73d405954..000000000 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_type.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2024 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef HIVIEWDFX_HIAPPEVENT_TYPE_H -#define HIVIEWDFX_HIAPPEVENT_TYPE_H - -/** - * @addtogroup HiAppEvent - * @{ - * - * @brief Defines the structure used by hiappevent APIs. - * - * @syscap SystemCapability.HiviewDFX.HiAppEvent - * @since 12 - * @version 1.0 - */ - -/** - * @file hiappevent_type.h - * - * @brief Defines the structures used in the hiappevent APIs. - * - * @since 12 - * @version 1.0 - */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Defines the event config to be reported by processor.. - * @SystemCapability.HiviewDFX.HiAppEvent - * @since 12 - * @version 1.0 - */ -struct OH_HiAppEvent_TriggerCondition { - /* The number of write events that trigger callback. */ - uint32_t row; - /* The interval for triggering callback. */ - uint32_t size; - /* The interval for triggering callback. */ - uint32_t timeOut; -}; - -/** - * @brief Definition of event filter object, which is used to filter events monitored by the watcher. - * @SystemCapability.HiviewDFX.HiAppEvent - * @since 12 - * @version 1.0 - */ -struct OH_HiAppEvent_AppEventFilter { - /* The name of the processor. */ - char* domain; - /* The types of the events to be monitored by the watcher. */ - uint32_t eventTypes; - /* The names of the events to be monitored by the watcher. */ - char* names[]; - /* The size of the name array. */ - uint32_t nameArraySize; -}; - -/** - * @brief Defines the event group. - * @syscap SystemCapability.HiviewDFX.HiAppEvent - * @since 12 - * @version 1.0 - */ -struct OH_HiAppEvent_AppEventGroup { - /* The name of the event. */ - char* name; - /* The event array which is group by the name. */ - char* appEventInfos[]; - /* The event array size. */ - uint32_t appEventInfoArraySize -}; - -/** - * @brief Called when watcher receive the event. - * @syscap SystemCapability.HiviewDFX.HiAppEvent - * @param domain The domain of the event. - * @param appEventGroups The event group by the domain. - * @since 12 - * @version 1.0 - */ -typedef void (*OH_HiAppEvent_OnReceive)(const char* domain, const struct OH_HiAppEvent_AppEventGroup* appEventGroups, uint32_t groupSize); - -/** - * @brief Called when watcher receive the event meet the condition. - * @syscap SystemCapability.HiviewDFX.HiAppEvent - * @param row The row of events received by watcher. - * @param size The size of events received by watcher. - * @since 12 - * @version 1.0 - */ -typedef void (*OH_HiAppEvent_OnTrigger)(int32_t row, int32_t size); - -/** - * @brief Defines the watcher information structure. - * @syscap SystemCapability.HiviewDFX.HiAppEvent - * @since 12 - * @version 1.0 - */ -struct OH_HiAppEvent_Watcher { - /* The name of the watcher. */ - char* name; - /* The condition for triggering callback.*/ - struct OH_HiAppEvent_TriggerCondition triggerCondition; - /* The event filters for monitoring events. */ - struct OH_HiAppEvent_AppEventFilter* appEventFilters; - /* The event filters array size. */ - uint32_t filterArraySize; - /* The callback function of watcher.*/ - OH_HiAppEvent_OnTrigger onTrigger; - /* The callback function, when watcher receive the event.*/ - OH_HiAppEvent_OnReceive onReceive; -}; -#ifdef __cplusplus -} -#endif -/** @} */ -#endif // HIVIEWDFX_HIAPPEVENT_TYPE_H \ No newline at end of file -- Gitee From 14c3e2e6ced0c5294422b826d2312d83d640f054 Mon Sep 17 00:00:00 2001 From: helloworld_win <811132355@qq.com> Date: Wed, 21 Feb 2024 09:57:24 +0800 Subject: [PATCH 14/20] add the data Signed-off-by: helloworld_win <811132355@qq.com> --- hiviewdfx/hiappevent/include/hiappevent/hiappevent.h | 1 - 1 file changed, 1 deletion(-) diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h index d1a7da384..1b93612a2 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h @@ -80,7 +80,6 @@ #include "hiappevent_cfg.h" #include "hiappevent_event.h" #include "hiappevent_param.h" -#include "hiappevent_type.h" #ifdef __cplusplus extern "C" { -- Gitee From 7236fa804277394e44986367d57733ff15a40afc Mon Sep 17 00:00:00 2001 From: helloworld_win <811132355@qq.com> Date: Wed, 21 Feb 2024 10:02:09 +0800 Subject: [PATCH 15/20] add the api Signed-off-by: helloworld_win <811132355@qq.com> --- hiviewdfx/hiappevent/include/hiappevent/hiappevent.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h index 1b93612a2..0e8d94fd7 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h @@ -502,9 +502,9 @@ struct AppEventInfo { /* The name of the event. */ const char* name; /* The type of the event. */ - uint32_t type; + enum EventType type; /* The json string of the parameter. */ - const char* paramJsonStr; + const char* params; } /** -- Gitee From 4647dcedba787dea0e2457a649eceb1a4926e447 Mon Sep 17 00:00:00 2001 From: helloworld_win <811132355@qq.com> Date: Wed, 21 Feb 2024 10:05:38 +0800 Subject: [PATCH 16/20] add the data Signed-off-by: helloworld_win <811132355@qq.com> --- .../include/hiappevent/hiappevent.h | 126 +++++++++--------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h index 0e8d94fd7..9a8b1cea2 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h @@ -107,6 +107,38 @@ enum EventType { BEHAVIOR = 4 }; +/** + * @brief Definition of AppEventInfo object. + * @SystemCapability.HiviewDFX.HiAppEvent + * @since 12 + * @version 1.0 + */ +struct AppEventInfo { + /* The domain of the event. */ + const char* domain; + /* The name of the event. */ + const char* name; + /* The type of the event. */ + enum EventType type; + /* The json string of the parameter. */ + const char* params; +} + +/** + * @brief Defines the event group. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @since 12 + * @version 1.0 + */ +struct OH_HiAppEvent_AppEventGroup { + /* The name of the event. */ + const char* name; + /* The event array which is group by the name. */ + const struct AppEventInfo* appEventInfos; + /* The length of appEventInfos array. */ + uint32_t infoLen; +}; + /** * @brief Event param list node. * @@ -123,6 +155,37 @@ typedef struct ParamListNode* ParamList; */ typedef struct Watcher Watcher; +/** + * @brief Called when watcher receive the event. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @param domain The domain of the event. + * @param appEventGroups The event group by the domain. + * @param groupLen The length of appEventGroups array. + * @since 12 + * @version 1.0 + */ +typedef void (*OH_HiAppEvent_OnReceive)(const char* domain, const struct OH_HiAppEvent_AppEventGroup* appEventGroups, uint32_t groupLen); + +/** + * @brief Called when watcher receive the event meet the condition. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @param row The row of events received by watcher. + * @param size The size of events received by watcher. + * @since 12 + * @version 1.0 + */ +typedef void (*OH_HiAppEvent_OnTrigger)(int32_t row, int32_t size); + +/** + * @brief Called when watcher take the events. + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @param events The event json string array. + * @param eventLen The length of events array. + * @since 12 + * @version 1.0 + */ +typedef void (*OH_HiAppEvent_OnTake)(const char * const * events, int32_t eventLen); + /** * @brief Create a pointer to the ParamList. * @@ -489,69 +552,6 @@ int OH_HiAppEvent_RemoveWatcher(Watcher* watcher); * @version 1.0 */ void OH_HiAppEvent_ClearData(); - -/** - * @brief Definition of AppEventInfo object. - * @SystemCapability.HiviewDFX.HiAppEvent - * @since 12 - * @version 1.0 - */ -struct AppEventInfo { - /* The domain of the event. */ - const char* domain; - /* The name of the event. */ - const char* name; - /* The type of the event. */ - enum EventType type; - /* The json string of the parameter. */ - const char* params; -} - -/** - * @brief Defines the event group. - * @syscap SystemCapability.HiviewDFX.HiAppEvent - * @since 12 - * @version 1.0 - */ -struct OH_HiAppEvent_AppEventGroup { - /* The name of the event. */ - const char* name; - /* The event array which is group by the name. */ - const struct AppEventInfo* appEventInfos; - /* The length of appEventInfos array. */ - uint32_t infoLen; -}; - -/** - * @brief Called when watcher receive the event. - * @syscap SystemCapability.HiviewDFX.HiAppEvent - * @param domain The domain of the event. - * @param appEventGroups The event group by the domain. - * @param groupLen The length of appEventGroups array. - * @since 12 - * @version 1.0 - */ -typedef void (*OH_HiAppEvent_OnReceive)(const char* domain, const struct OH_HiAppEvent_AppEventGroup* appEventGroups, uint32_t groupLen); - -/** - * @brief Called when watcher receive the event meet the condition. - * @syscap SystemCapability.HiviewDFX.HiAppEvent - * @param row The row of events received by watcher. - * @param size The size of events received by watcher. - * @since 12 - * @version 1.0 - */ -typedef void (*OH_HiAppEvent_OnTrigger)(int32_t row, int32_t size); - -/** - * @brief Called when watcher take the events. - * @syscap SystemCapability.HiviewDFX.HiAppEvent - * @param events The event json string array. - * @param eventLen The length of events array. - * @since 12 - * @version 1.0 - */ -typedef void (*OH_HiAppEvent_OnTake)(const char * const * events, int32_t eventLen); #ifdef __cplusplus } #endif -- Gitee From e541a43d58277a44537cdd5bd0d2415876d81cb4 Mon Sep 17 00:00:00 2001 From: hello_win <811132355@qq.com> Date: Wed, 21 Feb 2024 02:45:57 +0000 Subject: [PATCH 17/20] update hiviewdfx/hiappevent/include/hiappevent/hiappevent.h. Signed-off-by: hello_win <811132355@qq.com> --- hiviewdfx/hiappevent/include/hiappevent/hiappevent.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h index 9a8b1cea2..1c838f731 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h @@ -130,7 +130,7 @@ struct AppEventInfo { * @since 12 * @version 1.0 */ -struct OH_HiAppEvent_AppEventGroup { +struct AppEventGroup { /* The name of the event. */ const char* name; /* The event array which is group by the name. */ @@ -164,7 +164,7 @@ typedef struct Watcher Watcher; * @since 12 * @version 1.0 */ -typedef void (*OH_HiAppEvent_OnReceive)(const char* domain, const struct OH_HiAppEvent_AppEventGroup* appEventGroups, uint32_t groupLen); +typedef void (*OH_HiAppEvent_OnReceive)(const char* domain, const struct AppEventGroup* appEventGroups, uint32_t groupLen); /** * @brief Called when watcher receive the event meet the condition. -- Gitee From 9381c43b1e8226a94a58abb42b9709268f2a1557 Mon Sep 17 00:00:00 2001 From: hello_win <811132355@qq.com> Date: Wed, 21 Feb 2024 03:06:04 +0000 Subject: [PATCH 18/20] update hiviewdfx/hiappevent/include/hiappevent/hiappevent_event.h. Signed-off-by: hello_win <811132355@qq.com> --- .../include/hiappevent/hiappevent_event.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_event.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_event.h index ce7e329d0..bdc57665f 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent_event.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent_event.h @@ -85,7 +85,7 @@ extern "C" { * @since 12 * @version 1.0 */ -#define EVENT_APP_CRASH "hiappevent.app_crash" +#define EVENT_APP_CRASH "APP_CRASH" /** * @brief app freeze event. @@ -93,7 +93,7 @@ extern "C" { * @since 12 * @version 1.0 */ -#define EVENT_APP_FREEZE "hiappevent.app_freeze" +#define EVENT_APP_FREEZE "APP_FREEZE" /** * @brief app launch event. @@ -101,7 +101,7 @@ extern "C" { * @since 12 * @version 1.0 */ -#define EVENT_APP_LAUNCH "hiappevent.app_launch" +#define EVENT_APP_LAUNCH "APP_LAUNCH" /** * @brief app scroll jank event. @@ -109,7 +109,7 @@ extern "C" { * @since 12 * @version 1.0 */ -#define EVENT_SCROLL_JANK "hiappevent.scroll_jank" +#define EVENT_SCROLL_JANK "SCROLL_JANK" /** * @brief app cpu usage high event. @@ -117,7 +117,7 @@ extern "C" { * @since 12 * @version 1.0 */ -#define EVENT_CPU_USAGE_HIGH "hiappevent.cpu_usage_high" +#define EVENT_CPU_USAGE_HIGH "CPU_USAGE_HIGH" /** * @brief app battery usage event. @@ -125,7 +125,7 @@ extern "C" { * @since 12 * @version 1.0 */ -#define EVENT_BATTERY_USAGE "hiappevent.battery_usage" +#define EVENT_BATTERY_USAGE "BATTERY_USAGE" /** * @brief app resource overlimit event. @@ -133,7 +133,7 @@ extern "C" { * @since 12 * @version 1.0 */ -#define EVENT_RESOURCE_OVERLIMIT "hiappevent.resource_overlimit" +#define EVENT_RESOURCE_OVERLIMIT "RESOURCE_OVERLIMIT" /** * @brief OS domain. @@ -141,7 +141,7 @@ extern "C" { * @since 12 * @version 1.0 */ -#define DOMAIN_OS "hiappevent.os" +#define DOMAIN_OS "OS" #ifdef __cplusplus } -- Gitee From 55447afe393d7fa902e8c03e65dec85684ed197f Mon Sep 17 00:00:00 2001 From: hello_win <811132355@qq.com> Date: Thu, 22 Feb 2024 11:55:23 +0000 Subject: [PATCH 19/20] update hiviewdfx/hiappevent/include/hiappevent/hiappevent.h. Signed-off-by: hello_win <811132355@qq.com> --- .../include/hiappevent/hiappevent.h | 58 ++++++++++++------- 1 file changed, 37 insertions(+), 21 deletions(-) diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h index 1c838f731..636ed2af7 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h @@ -108,12 +108,13 @@ enum EventType { }; /** - * @brief Definition of AppEventInfo object. + * @brief Definition of HiAppEvent_AppEventInfo object. + * * @SystemCapability.HiviewDFX.HiAppEvent * @since 12 * @version 1.0 */ -struct AppEventInfo { +struct HiAppEvent_AppEventInfo { /* The domain of the event. */ const char* domain; /* The name of the event. */ @@ -126,15 +127,16 @@ struct AppEventInfo { /** * @brief Defines the event group. + * * @syscap SystemCapability.HiviewDFX.HiAppEvent * @since 12 * @version 1.0 */ -struct AppEventGroup { +struct HiAppEvent_AppEventGroup { /* The name of the event. */ const char* name; /* The event array which is group by the name. */ - const struct AppEventInfo* appEventInfos; + const struct HiAppEvent_AppEventInfo* appEventInfos; /* The length of appEventInfos array. */ uint32_t infoLen; }; @@ -148,27 +150,30 @@ struct AppEventGroup { typedef struct ParamListNode* ParamList; /** - * @brief Watcher node. - * + * @brief HiAppEvent_Watcher node. + * + * @syscap SystemCapability.HiviewDFX.HiAppEvent * @since 12 * @version 1.0 */ -typedef struct Watcher Watcher; +typedef struct HiAppEvent_Watcher Watcher; /** * @brief Called when watcher receive the event. - * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @SystemCapability.HiviewDFX.HiAppEvent * @param domain The domain of the event. * @param appEventGroups The event group by the domain. * @param groupLen The length of appEventGroups array. * @since 12 * @version 1.0 */ -typedef void (*OH_HiAppEvent_OnReceive)(const char* domain, const struct AppEventGroup* appEventGroups, uint32_t groupLen); +typedef void (*OH_HiAppEvent_OnReceive)(const char* domain, const struct HiAppEvent_AppEventGroup* appEventGroups, uint32_t groupLen); /** * @brief Called when watcher receive the event meet the condition. - * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @SystemCapability.HiviewDFX.HiAppEvent * @param row The row of events received by watcher. * @param size The size of events received by watcher. * @since 12 @@ -178,7 +183,8 @@ typedef void (*OH_HiAppEvent_OnTrigger)(int32_t row, int32_t size); /** * @brief Called when watcher take the events. - * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @SystemCapability.HiviewDFX.HiAppEvent * @param events The event json string array. * @param eventLen The length of events array. * @since 12 @@ -440,7 +446,8 @@ bool OH_HiAppEvent_Configure(const char* name, const char* value); /** * @brief Create a watcher handler pointer to set the property. - * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @SystemCapability.HiviewDFX.HiAppEvent * @param name The name of the watcher. * @return Returns a pointer to the watcher instance. * @since 12 @@ -450,7 +457,8 @@ Watcher* OH_HiAppEvent_CreateWatcher(const char* name); /** * @brief Destroy the specified Watcher handle resource. - * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @SystemCapability.HiviewDFX.HiAppEvent * @param watcher The pointer to the watcher instance. * @since 12 * @version 1.0 @@ -459,7 +467,8 @@ void OH_HiAppEvent_DestroyWatcher(Watcher* watcher); /** * @brief Set the TriggerCondition to trigger the onTrigger callback. - * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @SystemCapability.HiviewDFX.HiAppEvent * @param watcher The pointer to the watcher instance. * @param row The row of write events that trigger the onTrigger callback. * @param size The size of write events that trigger the onTrigger callback. @@ -473,7 +482,8 @@ int OH_HiAppEvent_SetTriggerCondition(Watcher* watcher, uint32_t row, uint32_t s /** * @brief Set the AppEventFilter, which is used to filter events monitored by the watcher. - * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @SystemCapability.HiviewDFX.HiAppEvent * @param watcher The pointer to the watcher instance. * @param domain The name of the event domain to be monitored by the watcher.. * @param eventTypes The types of the events to be monitored by the watcher.0x08 means BEHAVIOR,0x04 means SECURITY, 0x02 means STATISTIC,0x01 means FAULT, 0xff and 0x00 means all. @@ -488,7 +498,8 @@ int OH_HiAppEvent_SetAppEventFilter(Watcher* watcher, const char* domain, uint8_ /** * @brief Set the onTrigger callback. - * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @SystemCapability.HiviewDFX.HiAppEvent * @param watcher The pointer to the watcher instance. * @param onTrigger The callback of the watcher. * @return Returns {@code 0} if set OnTrigger is successful, and returns a @@ -500,7 +511,8 @@ int OH_HiAppEvent_SetWatcherOnTrigger(Watcher* watcher, OH_HiAppEvent_OnTrigger /** * @brief Set the OnReceive callback. - * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @SystemCapability.HiviewDFX.HiAppEvent * @param watcher The pointer to the watcher instance. * @param onReceive The callback of the watcher. * @return Returns {@code 0} if set OnReceive is successful, and returns a @@ -512,7 +524,8 @@ int OH_HiAppEvent_SetWatcherOnReceive(Watcher* watcher, OH_HiAppEvent_OnReceive /** * @brief Set the AppEventFilter, which is used to filter events monitored by the watcher. - * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @SystemCapability.HiviewDFX.HiAppEvent * @param watcher The pointer to the watcher instance. * @param size The the threshold size per read. * @param onTake The callback of the watcher. @@ -525,7 +538,8 @@ int OH_HiAppEvent_TakeWatcherData(Watcher* watcher, uint32_t size, OH_HiAppEvent /** * @brief Add watcher to receive the event. - * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @SystemCapability.HiviewDFX.HiAppEvent * @param watcher The pointer to the watcher instance which receive the event. * @return Returns {@code 0} if add watcher is successful, and returns a * negative integer if add fail. @@ -536,7 +550,8 @@ int OH_HiAppEvent_AddWatcher(Watcher* watcher); /** * @brief Remove watcher. - * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @SystemCapability.HiviewDFX.HiAppEvent * @param watcher The pointer to the watcher instance. * @return Returns {@code 0} if remove watcher is successful, and returns a * negative integer if remove fail. @@ -547,7 +562,8 @@ int OH_HiAppEvent_RemoveWatcher(Watcher* watcher); /** * @brief Clear all local logging data of the application. - * @syscap SystemCapability.HiviewDFX.HiAppEvent + * + * @SystemCapability.HiviewDFX.HiAppEvent * @since 12 * @version 1.0 */ -- Gitee From 4e858b7b3f2089679d92847f78e5f585580f853d Mon Sep 17 00:00:00 2001 From: hello_win <811132355@qq.com> Date: Fri, 23 Feb 2024 08:07:01 +0000 Subject: [PATCH 20/20] update hiviewdfx/hiappevent/include/hiappevent/hiappevent.h. Signed-off-by: hello_win <811132355@qq.com> --- .../include/hiappevent/hiappevent.h | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h index 636ed2af7..ca3768f6e 100644 --- a/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h +++ b/hiviewdfx/hiappevent/include/hiappevent/hiappevent.h @@ -156,7 +156,7 @@ typedef struct ParamListNode* ParamList; * @since 12 * @version 1.0 */ -typedef struct HiAppEvent_Watcher Watcher; +typedef struct HiAppEvent_Watcher HiAppEvent_Watcher; /** * @brief Called when watcher receive the event. @@ -445,31 +445,31 @@ int OH_HiAppEvent_Write(const char* domain, const char* name, enum EventType typ bool OH_HiAppEvent_Configure(const char* name, const char* value); /** - * @brief Create a watcher handler pointer to set the property. + * @brief Create a HiAppEvent_Watcher handler pointer to set the property. * * @SystemCapability.HiviewDFX.HiAppEvent * @param name The name of the watcher. - * @return Returns a pointer to the watcher instance. + * @return Returns a pointer to the HiAppEvent_Watcher instance. * @since 12 * @version 1.0 */ -Watcher* OH_HiAppEvent_CreateWatcher(const char* name); +HiAppEvent_Watcher* OH_HiAppEvent_CreateWatcher(const char* name); /** - * @brief Destroy the specified Watcher handle resource. + * @brief Destroy the specified HiAppEvent_Watcher handle resource. * * @SystemCapability.HiviewDFX.HiAppEvent - * @param watcher The pointer to the watcher instance. + * @param watcher The pointer to the HiAppEvent_Watcher instance. * @since 12 * @version 1.0 */ -void OH_HiAppEvent_DestroyWatcher(Watcher* watcher); +void OH_HiAppEvent_DestroyWatcher(HiAppEvent_Watcher* watcher); /** * @brief Set the TriggerCondition to trigger the onTrigger callback. * * @SystemCapability.HiviewDFX.HiAppEvent - * @param watcher The pointer to the watcher instance. + * @param watcher The pointer to the HiAppEvent_Watcher instance. * @param row The row of write events that trigger the onTrigger callback. * @param size The size of write events that trigger the onTrigger callback. * @param timeOut The interval for trigger the onTrigger callback. @@ -478,13 +478,13 @@ void OH_HiAppEvent_DestroyWatcher(Watcher* watcher); * @since 12 * @version 1.0 */ -int OH_HiAppEvent_SetTriggerCondition(Watcher* watcher, uint32_t row, uint32_t size, uint32_t timeOut); +int OH_HiAppEvent_SetTriggerCondition(HiAppEvent_Watcher* watcher, uint32_t row, uint32_t size, uint32_t timeOut); /** * @brief Set the AppEventFilter, which is used to filter events monitored by the watcher. * * @SystemCapability.HiviewDFX.HiAppEvent - * @param watcher The pointer to the watcher instance. + * @param watcher The pointer to the HiAppEvent_Watcher instance. * @param domain The name of the event domain to be monitored by the watcher.. * @param eventTypes The types of the events to be monitored by the watcher.0x08 means BEHAVIOR,0x04 means SECURITY, 0x02 means STATISTIC,0x01 means FAULT, 0xff and 0x00 means all. * @param names The names of the events to be monitored by the watcher. @@ -494,39 +494,39 @@ int OH_HiAppEvent_SetTriggerCondition(Watcher* watcher, uint32_t row, uint32_t s * @since 12 * @version 1.0 */ -int OH_HiAppEvent_SetAppEventFilter(Watcher* watcher, const char* domain, uint8_t eventTypes, const char * const* names, int namesLen); +int OH_HiAppEvent_SetAppEventFilter(HiAppEvent_Watcher* watcher, const char* domain, uint8_t eventTypes, const char * const* names, int namesLen); /** * @brief Set the onTrigger callback. * * @SystemCapability.HiviewDFX.HiAppEvent - * @param watcher The pointer to the watcher instance. + * @param watcher The pointer to the HiAppEvent_Watcher instance. * @param onTrigger The callback of the watcher. * @return Returns {@code 0} if set OnTrigger is successful, and returns a * negative integer if set fail. * @since 12 * @version 1.0 */ -int OH_HiAppEvent_SetWatcherOnTrigger(Watcher* watcher, OH_HiAppEvent_OnTrigger onTrigger); +int OH_HiAppEvent_SetWatcherOnTrigger(HiAppEvent_Watcher* watcher, OH_HiAppEvent_OnTrigger onTrigger); /** * @brief Set the OnReceive callback. * * @SystemCapability.HiviewDFX.HiAppEvent - * @param watcher The pointer to the watcher instance. + * @param watcher The pointer to the HiAppEvent_Watcher instance. * @param onReceive The callback of the watcher. * @return Returns {@code 0} if set OnReceive is successful, and returns a * negative integer if set fail. * @since 12 * @version 1.0 */ -int OH_HiAppEvent_SetWatcherOnReceive(Watcher* watcher, OH_HiAppEvent_OnReceive onReceive); +int OH_HiAppEvent_SetWatcherOnReceive(HiAppEvent_Watcher* watcher, OH_HiAppEvent_OnReceive onReceive); /** * @brief Set the AppEventFilter, which is used to filter events monitored by the watcher. * * @SystemCapability.HiviewDFX.HiAppEvent - * @param watcher The pointer to the watcher instance. + * @param watcher The pointer to the HiAppEvent_Watcher instance. * @param size The the threshold size per read. * @param onTake The callback of the watcher. * @return Returns {@code 0} if remove watcher is successful, and returns a @@ -534,31 +534,31 @@ int OH_HiAppEvent_SetWatcherOnReceive(Watcher* watcher, OH_HiAppEvent_OnReceive * @since 12 * @version 1.0 */ -int OH_HiAppEvent_TakeWatcherData(Watcher* watcher, uint32_t size, OH_HiAppEvent_OnTake onTake); +int OH_HiAppEvent_TakeWatcherData(HiAppEvent_Watcher* watcher, uint32_t size, OH_HiAppEvent_OnTake onTake); /** * @brief Add watcher to receive the event. * * @SystemCapability.HiviewDFX.HiAppEvent - * @param watcher The pointer to the watcher instance which receive the event. + * @param watcher The pointer to the HiAppEvent_Watcher instance which receive the event. * @return Returns {@code 0} if add watcher is successful, and returns a * negative integer if add fail. * @since 12 * @version 1.0 */ -int OH_HiAppEvent_AddWatcher(Watcher* watcher); +int OH_HiAppEvent_AddWatcher(HiAppEvent_Watcher* watcher); /** * @brief Remove watcher. * * @SystemCapability.HiviewDFX.HiAppEvent - * @param watcher The pointer to the watcher instance. + * @param watcher The pointer to the HiAppEvent_Watcher instance. * @return Returns {@code 0} if remove watcher is successful, and returns a * negative integer if remove fail. * @since 12 * @version 1.0 */ -int OH_HiAppEvent_RemoveWatcher(Watcher* watcher); +int OH_HiAppEvent_RemoveWatcher(HiAppEvent_Watcher* watcher); /** * @brief Clear all local logging data of the application. -- Gitee