1 /*
2  * Copyright (c) 2023-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 CONTINUATION_MANAGER_LOG_H_
17 #define CONTINUATION_MANAGER_LOG_H_
18 
19 #include "errors.h"
20 #include "hilog/log.h"
21 #include "inttypes.h"
22 
23 namespace OHOS {
24 namespace DistributedSchedule {
25 #undef LOG_DOMAIN
26 #define LOG_DOMAIN 0xD004170
27 
28 #undef LOG_TAG
29 #define LOG_TAG "ContinuationMgrService"
30 
31 #ifdef HILOGD
32 #undef HILOGD
33 #endif
34 
35 #ifdef HILOGF
36 #undef HILOGF
37 #endif
38 
39 #ifdef HILOGE
40 #undef HILOGE
41 #endif
42 
43 #ifdef HILOGW
44 #undef HILOGW
45 #endif
46 
47 #ifdef HILOGI
48 #undef HILOGI
49 #endif
50 
51 #define HILOGF(fmt, ...) HILOG_FATAL(LOG_CORE, "%{public}s::%{public}s " fmt, TAG.c_str(), __FUNCTION__, ##__VA_ARGS__)
52 #define HILOGE(fmt, ...) HILOG_ERROR(LOG_CORE, "%{public}s::%{public}s " fmt, TAG.c_str(), __FUNCTION__, ##__VA_ARGS__)
53 #define HILOGW(fmt, ...) HILOG_WARN(LOG_CORE, "%{public}s::%{public}s " fmt, TAG.c_str(), __FUNCTION__, ##__VA_ARGS__)
54 #define HILOGI(fmt, ...) HILOG_INFO(LOG_CORE, "%{public}s::%{public}s " fmt, TAG.c_str(), __FUNCTION__, ##__VA_ARGS__)
55 #define HILOGD(fmt, ...) HILOG_DEBUG(LOG_CORE, "%{public}s::%{public}s " fmt, TAG.c_str(), __FUNCTION__, ##__VA_ARGS__)
56 
57 enum {
58     /**
59      * Module type: Distributed schedule Service side
60      */
61     DMS_MODULE_TYPE_SERVICE = 0,
62 };
63 
64 // offset of dms error, only be used in this file.
65 constexpr ErrCode DMS_SERVICE_ERR_OFFSET = ErrCodeOffset(SUBSYS_DISTRIBUTEDSCHEDULE, DMS_MODULE_TYPE_SERVICE);
66 
67 enum {
68     /**
69      * Result(29360128) for invalid parameters.
70      */
71     INVALID_PARAMETERS_ERR = DMS_SERVICE_ERR_OFFSET,
72     /**
73      * Result(29360141) for dump write file error.
74      */
75     DMS_WRITE_FILE_FAILED_ERR = 29360141,
76     /**
77      * Result(29360157) for permission denied.
78      */
79     DMS_PERMISSION_DENIED = 29360157,
80     /*
81      * Result(29360207) for app registered exceed max times.
82      */
83     REGISTER_EXCEED_MAX_TIMES = 29360207,
84     /*
85      * Result(29360208) for token has not registered.
86      */
87     TOKEN_HAS_NOT_REGISTERED = 29360208,
88     /*
89      * Result(29360209) for callback has registered.
90      */
91     CALLBACK_HAS_REGISTERED = 29360209,
92     /*
93      * Result(29360210) for callback has not registered.
94      */
95     CALLBACK_HAS_NOT_REGISTERED = 29360210,
96     /*
97      * Result(29360211) for connect ability failed.
98      */
99     CONNECT_ABILITY_FAILED = 29360211,
100     /*
101      * Result(29360212) for disconnect ability failed.
102      */
103     DISCONNECT_ABILITY_FAILED = 29360212,
104     /*
105      * Result(29360214) for unknown callback type.
106      */
107     UNKNOWN_CALLBACK_TYPE = 29360214,
108     /*
109      * Result(29360215) for invalid connect status.
110      */
111     INVALID_CONNECT_STATUS = 29360215,
112     /*
113      * Result(29360216) for invalid continuation mode.
114      */
115     INVALID_CONTINUATION_MODE = 29360216,
116 };
117 } // namespace DistributedSchedule
118 } // namespace OHOS
119 #endif // CONTINUATION_MANAGER_LOG_H_
120