1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef UDMF_RADAR_REPORTER_H
17 #define UDMF_RADAR_REPORTER_H
18 
19 #include "hisysevent_c.h"
20 #include "visibility.h"
21 #include <string>
22 
23 namespace OHOS {
24 namespace UDMF {
25 namespace RadarReporter {
26 enum BizScene : int32_t {
27     SET_DATA = 1,
28     SYNC_DATA = 2,
29     GET_DATA = 3,
30     UTD_REGISTER = 4
31 };
32 
33 enum SetDataStage : int32_t {
34     SET_DATA_BEGIN = 1,
35     VERIFY_SHARE_PERMISSIONS = 2,
36     GERERATE_DFS_URI = 3,
37     SET_DATA_END = 4
38 };
39 
40 enum SyncDataStage : int32_t {
41     SYNC_BEGIN = 1,
42     SYNC_END = 2
43 };
44 
45 enum GetDataStage : int32_t {
46     GET_DATA_BEGIN = 1,
47     VERIFY_PRIVILEGE = 2,
48     GRANT_URI_PERMISSION = 3,
49     GET_DATA_END = 4
50 };
51 
52 enum UtdRegisterStage : int32_t {
53     UTD_REGISTER_BEGIN = 1,
54     UTD_REGISTER_END = 2,
55 };
56 
57 enum StageRes : int32_t {
58     IDLE = 0,
59     SUCCESS = 1,
60     FAILED = 2,
61     CANCELLED = 3
62 };
63 
64 enum BizState : int32_t {
65     DFX_BEGIN = 0,
66     DFX_NORMAL_END = 1,
67     DFX_ABNORMAL_END = 2
68 };
69 const constexpr char DOMAIN[] = "DISTDATAMGR";
70 const constexpr char EVENT_NAME[] = "DISTRIBUTED_UDMF_BEHAVIOR";
71 const constexpr char ORG_PKG[] = "distributeddata";
72 } // namespace RadarReporter
73 
74 class API_EXPORT RadarReporterAdapter {
75 public:
76     static  void ReportNormal(const std::string &func, int32_t scene, int32_t stage, int32_t stageRes, int32_t state);
77     static  void ReportFail(
78         const std::string &func, int32_t scene, int32_t stage, int32_t stageRes, int32_t errorCode, int32_t state);
79     static  void ReportFail(const std::string &func, int32_t scene, int32_t stage, int32_t stageRes, int32_t errorCode);
80 };
81 } // namespace UDMF
82 } // namespace OHOS
83 #endif // UDMF_RADAR_REPORTER_H