1 /* 2 * Copyright (c) 2021-2022 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 SERVICES_DTBSCHEDMGR_INCLUDE_DTBSCHEDMGR_LOG_H_ 17 #define SERVICES_DTBSCHEDMGR_INCLUDE_DTBSCHEDMGR_LOG_H_ 18 19 #include "errors.h" 20 #include "hilog/log_c.h" 21 #include "hilog/log_cpp.h" 22 23 namespace OHOS { 24 namespace DistributedSchedule { 25 static constexpr OHOS::HiviewDFX::HiLogLabel DSCHED_SERVICE_LABEL = {LOG_CORE, 0xD001800, "DSched_Service"}; 26 27 #ifdef HILOGD 28 #undef HILOGD 29 #endif 30 31 #ifdef HILOGF 32 #undef HILOGF 33 #endif 34 35 #ifdef HILOGE 36 #undef HILOGE 37 #endif 38 39 #ifdef HILOGW 40 #undef HILOGW 41 #endif 42 43 #ifdef HILOGI 44 #undef HILOGI 45 #endif 46 47 #define DMS_LOG(level, fmt, ...) HiviewDFX::HiLog::level(DSCHED_SERVICE_LABEL, \ 48 "%{public}s::%{public}s " fmt, TAG.c_str(), __FUNCTION__, ##__VA_ARGS__) 49 50 #define HILOGF(fmt, ...) DMS_LOG(Fatal, fmt, ##__VA_ARGS__) 51 #define HILOGE(fmt, ...) DMS_LOG(Error, fmt, ##__VA_ARGS__) 52 #define HILOGW(fmt, ...) DMS_LOG(Warn, fmt, ##__VA_ARGS__) 53 #define HILOGI(fmt, ...) DMS_LOG(Info, fmt, ##__VA_ARGS__) 54 #define HILOGD(fmt, ...) DMS_LOG(Debug, fmt, ##__VA_ARGS__) 55 56 enum { 57 /** 58 * Module type: Distributed schedule Service side 59 */ 60 DMS_MODULE_TYPE_SERVICE = 0, 61 }; 62 63 // offset of dms error, only be used in this file. 64 constexpr ErrCode DMS_SERVICE_ERR_OFFSET = ErrCodeOffset(SUBSYS_DISTRIBUTEDSCHEDULE, DMS_MODULE_TYPE_SERVICE); 65 66 enum { 67 /** 68 * Result(29360128) for invalid parameters. 69 */ 70 INVALID_PARAMETERS_ERR = DMS_SERVICE_ERR_OFFSET, 71 /** 72 * Result(29360129) for no response when RPC call. 73 */ 74 RPC_CALL_NORESPONSE_ERR = 29360129, 75 /** 76 * Result(29360130) for not find connect callback. 77 */ 78 NO_CONNECT_CALLBACK_ERR = 29360130, 79 /** 80 * Result(29360131) for remote invalid parameters. 81 */ 82 INVALID_REMOTE_PARAMETERS_ERR = 29360131, 83 /** 84 * Result(29360132) for remote device fail to bind ability. 85 */ 86 REMOTE_DEVICE_BIND_ABILITY_ERR = 29360132, 87 /** 88 * Result(29360133) for remote device fail to unbind ability. 89 */ 90 REMOTE_DEVICE_UNBIND_ABILITY_ERR = 29360133, 91 /** 92 * Result(29360134) for remote invalid parameters. 93 */ 94 REMOTE_FAIL_GET_SHELLINFO_ERR = 29360134, 95 /** 96 * Result(29360135) for remote device fail to start ability. 97 */ 98 REMOTE_DEVICE_START_ABILITY_ERR = 29360135, 99 /** 100 * Result(29360136) for remote device fail to stop ability. 101 */ 102 REMOTE_DEVICE_STOP_ABILITY_ERR = 29360136, 103 /** 104 * Result(29360137) for reg repeat ability token. 105 */ 106 REG_REPEAT_ABILITY_TOKEN_ERR = 29360137, 107 /** 108 * Result(29360138) for no ability token. 109 */ 110 NO_ABILITY_TOKEN_ERR = 29360138, 111 /** 112 * Result(29360139) for no appthread. 113 */ 114 NO_APP_THREAD_ERR = 29360139, 115 /** 116 * Result(29360140) for select device continue error. 117 */ 118 SELECT_DEVICE_CONTINUE_ERR = 29360140, 119 /** 120 * Result(29360141) for dump write file error. 121 */ 122 DMS_WRITE_FILE_FAILED_ERR = 29360141, 123 /** 124 * Result(29360142) for notify app the bind remote service's device is offline. 125 */ 126 DEVICE_OFFLINE_ERR = 29360142, 127 /** 128 * Result(29360143) for not find hitrace id. 129 */ 130 NO_HITRACE_RECORD_ERR = 29360143, 131 /** 132 * Result(29360144) for get local deviceid fail. 133 */ 134 GET_LOCAL_DEVICE_ERR = 29360144, 135 /** 136 * Result(29360145) for get local deviceid fail. 137 */ 138 GET_DATAABILITY_ERR = 29360145, 139 /** 140 * Result(29360146) for DistributedSched Service Publish Exception. 141 */ 142 DMS_PUBLISH_EXCEPTION = 29360146, 143 /** 144 * Result(29360147) for DistributedSched Storage Exception. 145 */ 146 DMS_GET_STORAGE_EXCEPTION = 29360147, 147 /** 148 * Result(29360148) for DistributedSched Service Get System Ability Manager Exception. 149 */ 150 DMS_GET_SAMGR_EXCEPTION = 29360148, 151 /** 152 * Result(29360149) for DistributedSched Service IPC call noresponse error. 153 */ 154 IPC_CALL_NORESPONSE_ERR = 29360149, 155 /** 156 * Result(29360150) for DistributedSched Service call bundle manager service error. 157 */ 158 BUNDLE_MANAGER_SERVICE_ERR = 29360150, 159 /** 160 * Result(29360151) for DistributedSched Service call distributed manager error. 161 */ 162 DISTRIBUTED_MANAGER_ERR = 29360151, 163 /** 164 * Result(29360152) for DistributedSched Service NotifyCompleteContinuation failed. 165 */ 166 NOTIFYCOMPLETECONTINUATION_FAILED = 29360152, 167 /** 168 * Result(29360153) for DistributedSched Service Continue Ability Timeout Error. 169 */ 170 CONTINUE_ABILITY_TIMEOUT_ERR = 29360153, 171 /** 172 * Result(29360154) for DistributedSched Service Notify Complete Continuation abilityToken null. 173 */ 174 ABILITYTOKEN_NULL = 29360154, 175 /** 176 * Result(29360155) for get device list fail. 177 */ 178 GET_DEVICE_LIST_ERR = 29360155, 179 /** 180 * Result(29360156) for notify ability install error. 181 */ 182 NOTIFY_ABILITY_INSTALL_ERR = 29360156, 183 /** 184 * Result(29360157) for permission denied. 185 */ 186 DMS_PERMISSION_DENIED = 29360157, 187 /** 188 * Result(29360158) for notify ability free install. 189 */ 190 NOTIFY_ABILITY_FREE_INSTALL = 29360158, 191 /** 192 * Result(29360159) for notify app invalid uid. 193 */ 194 BIND_ABILITY_UID_INVALID_ERR = 29360159, 195 /** 196 * Result(29360160) for notify app happen connect leak. 197 */ 198 BIND_ABILITY_LEAK_ERR = 29360160, 199 /** 200 * Result(29360161) for can not service registry. 201 */ 202 NOT_FIND_SERVICE_REGISTRY = 29360161, 203 /** 204 * Result(29360162) for can not get service. 205 */ 206 NOT_FIND_SERVICE_PROXY = 29360162, 207 /** 208 * Result(29360163) for IPC Send Request to DEF fail. 209 */ 210 SEND_REQUEST_DEF_FAIL = 29360163, 211 /** 212 * Result(29360164) for BMS can not find the specified ability. 213 */ 214 CAN_NOT_FOUND_ABILITY_ERR = 29360164, 215 /** 216 * Result(29360165) for DMS can not register device state callback. 217 */ 218 REGISTER_DEVICE_STATE_CALLBACK_ERR = 29360165, 219 /** 220 * Result(29360166) for DMS can not unregister device state callback. 221 */ 222 UNREGISTER_DEVICE_STATE_CALLBACK_ERR = 29360166, 223 /** 224 * Result(29360167) for DMS can not start auxiliary device FA. 225 */ 226 START_AUXILIARY_FA_ERR = 29360167, 227 /** 228 * Result(29360168) for DMS can not get dmsproxy handle. 229 */ 230 GET_DMSPROXY_HANDLE_FAIL = 29360168, 231 /** 232 * Result(29360169) for dmsproxy service exception. 233 */ 234 DMSPROXY_SERVICE_ERR = 29360169, 235 /** 236 * Result(29360170) for softbus service unavailable. 237 */ 238 SOFTBUS_SERVICE_ERR = 29360170, 239 /** 240 * Result(29360171) for softbus register callback fail. 241 */ 242 SOFTBUS_REGISTER_CALLBACK_ERR = 29360171, 243 /** 244 * Result(29360172) for get DPermission sa fail. 245 */ 246 GET_DISTRIBUTED_PERMISSION_SA_ERR = 29360172, 247 /** 248 * Result(29360173) for get BMS sa fail. 249 */ 250 GET_BUNDLE_MANAGER_ERR = 29360173, 251 /** 252 * Result(29360174) for get remote dms fail. 253 */ 254 GET_REMOTE_DMS_FAIL = 29360174, 255 /** 256 * Result(29360175) for account access permission check failed. 257 */ 258 DMS_ACCOUNT_ACCESS_PERMISSION_DENIED = 29360175, 259 /** 260 * Result(29360176) for component access permission check failed. 261 */ 262 DMS_COMPONENT_ACCESS_PERMISSION_DENIED = 29360176, 263 /** 264 * Result(29360177) for distributed communication permission check failed. 265 */ 266 DMS_DISTRIBUTED_COMMUNICATION_PERMISSION_DENIED = 29360177, 267 /** 268 * Result(29360178) for osd function not support. 269 */ 270 MISSION_OSD_NOT_SUPPORTED = 29360178, 271 /** 272 * Result(29360179) for osd switch is off. 273 */ 274 MISSION_OSD_NOT_ENABLED = 29360179, 275 /** 276 * Result(29360180) for osd switch is on. 277 */ 278 MISSION_OSD_ENABLED = 29360180, 279 /** 280 * Result(29360181) for front app check failed. 281 */ 282 CHECK_FRONT_APP_FAIL = 29360181, 283 /* 284 * Result(29360184) for notify mission change listener failed. 285 */ 286 MISSION_NOTIFY_CHANGE_LISTENER_ERR = 29360184, 287 /** 288 * Result(29360185) for subscribe data storage change failed. 289 */ 290 MISSION_SUBSCRIBE_DATA_STORAGE_ERR = 29360185, 291 /** 292 * Result(29360186) for sync snapshot failed. 293 */ 294 MISSION_SYNC_SNAPSHOT_ERR = 29360186, 295 /** 296 * Result(29360187) for sync mission info list failed. 297 */ 298 MISSION_SYNC_MISSION_INFO_LIST_ERR = 29360187, 299 /** 300 * Result(29360188) for distributed communication permission check failed. 301 */ 302 REMOTE_DISTRIBUTED_COMMUNICATION_PERMISSION_DENIED = 29360188, 303 /* 304 * Result(29360191) for blur snapshot failed. 305 */ 306 MISSION_BLUR_SNAPSHOT_ERR = 29360191, 307 /* 308 * Result(29360192) for take foreground snapshot failed. 309 */ 310 MISSION_TAKE_FOREGROUND_SNAPSHOT_ERR = 29360192, 311 /* 312 * Result(29360193) for ccm switch not support. 313 */ 314 MISSION_OSD_CCM_NOT_SUPPORTED = 29360193, 315 /* 316 * Result(29360194) for wifi switch is off. 317 */ 318 MISSION_OSD_WIFI_OFF = 29360194, 319 /* 320 * Result(29360195) for child mode is on. 321 */ 322 MISSION_OSD_CHILDMODE_ON = 29360195, 323 /* 324 * Result(29360196) for cloud switch is off. 325 */ 326 MISSION_OSD_CLOUD_SWITCH_OFF = 29360196, 327 /* 328 * Result(29360197) for continue ability rejected. 329 */ 330 CONTINUE_ABILITY_REJECTED = 29360197, 331 /* 332 * Result(29360198) for continue save data failed. 333 */ 334 CONTINUE_SAVE_DATA_FAILED = 29360198, 335 /* 336 * Result(29360199) for onContinue failed. 337 */ 338 CONTINUE_ON_CONTINUE_FAILED = 29360199, 339 /* 340 * Result(29360200) for continue get content failed. 341 */ 342 CONTINUE_GET_CONTENT_FAILED = 29360200, 343 /* 344 * Result(29360201) for continue get content failed. 345 */ 346 CALL_PERMISSION_DENIED = 29360201, 347 }; 348 } // namespace DistributedSchedule 349 } // namespace OHOS 350 #endif // SERVICES_DTBSCHEDMGR_INCLUDE_DTBSCHEDMGR_LOG_H_ 351