1 /* 2 * Copyright (c) 2021-2023 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 #include "inttypes.h" 23 24 namespace OHOS { 25 namespace DistributedSchedule { 26 static constexpr OHOS::HiviewDFX::HiLogLabel DSCHED_SERVICE_LABEL = {LOG_CORE, 0xD001800, "DSched_Service"}; 27 28 #ifdef HILOGD 29 #undef HILOGD 30 #endif 31 32 #ifdef HILOGF 33 #undef HILOGF 34 #endif 35 36 #ifdef HILOGE 37 #undef HILOGE 38 #endif 39 40 #ifdef HILOGW 41 #undef HILOGW 42 #endif 43 44 #ifdef HILOGI 45 #undef HILOGI 46 #endif 47 48 #define DMS_LOG(level, fmt, ...) HiviewDFX::HiLog::level(DSCHED_SERVICE_LABEL, \ 49 "%{public}s::%{public}s " fmt, TAG.c_str(), __FUNCTION__, ##__VA_ARGS__) 50 51 #define HILOGF(fmt, ...) DMS_LOG(Fatal, fmt, ##__VA_ARGS__) 52 #define HILOGE(fmt, ...) DMS_LOG(Error, fmt, ##__VA_ARGS__) 53 #define HILOGW(fmt, ...) DMS_LOG(Warn, fmt, ##__VA_ARGS__) 54 #define HILOGI(fmt, ...) DMS_LOG(Info, fmt, ##__VA_ARGS__) 55 #define HILOGD(fmt, ...) DMS_LOG(Debug, fmt, ##__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(16300502) for failed to get the missionInfo of the specified missionId. 70 */ 71 NO_MISSION_INFO_FOR_MISSION_ID = 16300502, 72 /** 73 * Result(16300505) for the operation device must be the device where the application to be continued 74 * is located or the target device to be continued. 75 */ 76 OPERATION_DEVICE_NOT_INITIATOR_OR_TARGET = 16300505, 77 /** 78 * Result(16300506) for the local continuation task is already in progress. 79 */ 80 CONTINUE_ALREADY_IN_PROGRESS = 16300506, 81 /** 82 * Result(29360220) for the mission for continuing is not alive, try again after restart mission. 83 */ 84 MISSION_FOR_CONTINUING_IS_NOT_ALIVE = 16300507, 85 /** 86 * Result(29360128) for invalid parameters. 87 */ 88 INVALID_PARAMETERS_ERR = DMS_SERVICE_ERR_OFFSET, 89 /** 90 * Result(29360129) for no response when RPC call. 91 */ 92 RPC_CALL_NORESPONSE_ERR = 29360129, 93 /** 94 * Result(29360130) for not find connect callback. 95 */ 96 NO_CONNECT_CALLBACK_ERR = 29360130, 97 /** 98 * Result(29360131) for remote invalid parameters. 99 */ 100 INVALID_REMOTE_PARAMETERS_ERR = 29360131, 101 /** 102 * Result(29360132) for remote device fail to bind ability. 103 */ 104 REMOTE_DEVICE_BIND_ABILITY_ERR = 29360132, 105 /** 106 * Result(29360133) for remote device fail to unbind ability. 107 */ 108 REMOTE_DEVICE_UNBIND_ABILITY_ERR = 29360133, 109 /** 110 * Result(29360134) for remote invalid parameters. 111 */ 112 REMOTE_FAIL_GET_SHELLINFO_ERR = 29360134, 113 /** 114 * Result(29360135) for remote device fail to start ability. 115 */ 116 REMOTE_DEVICE_START_ABILITY_ERR = 29360135, 117 /** 118 * Result(29360136) for remote device fail to stop ability. 119 */ 120 REMOTE_DEVICE_STOP_ABILITY_ERR = 29360136, 121 /** 122 * Result(29360137) for reg repeat ability token. 123 */ 124 REG_REPEAT_ABILITY_TOKEN_ERR = 29360137, 125 /** 126 * Result(29360138) for no ability token. 127 */ 128 NO_ABILITY_TOKEN_ERR = 29360138, 129 /** 130 * Result(29360139) for no appthread. 131 */ 132 NO_APP_THREAD_ERR = 29360139, 133 /** 134 * Result(29360140) for select device continue error. 135 */ 136 SELECT_DEVICE_CONTINUE_ERR = 29360140, 137 /** 138 * Result(29360141) for dump write file error. 139 */ 140 DMS_WRITE_FILE_FAILED_ERR = 29360141, 141 /** 142 * Result(29360142) for notify app the bind remote service's device is offline. 143 */ 144 DEVICE_OFFLINE_ERR = 29360142, 145 /** 146 * Result(29360143) for not find hitrace id. 147 */ 148 NO_HITRACE_RECORD_ERR = 29360143, 149 /** 150 * Result(29360144) for get local deviceid fail. 151 */ 152 GET_LOCAL_DEVICE_ERR = 29360144, 153 /** 154 * Result(29360145) for get local deviceid fail. 155 */ 156 GET_DATAABILITY_ERR = 29360145, 157 /** 158 * Result(29360146) for DistributedSched Service Publish Exception. 159 */ 160 DMS_PUBLISH_EXCEPTION = 29360146, 161 /** 162 * Result(29360147) for DistributedSched Storage Exception. 163 */ 164 DMS_GET_STORAGE_EXCEPTION = 29360147, 165 /** 166 * Result(29360148) for DistributedSched Service Get System Ability Manager Exception. 167 */ 168 DMS_GET_SAMGR_EXCEPTION = 29360148, 169 /** 170 * Result(29360149) for DistributedSched Service IPC call noresponse error. 171 */ 172 IPC_CALL_NORESPONSE_ERR = 29360149, 173 /** 174 * Result(29360150) for DistributedSched Service call bundle manager service error. 175 */ 176 BUNDLE_MANAGER_SERVICE_ERR = 29360150, 177 /** 178 * Result(29360151) for DistributedSched Service call distributed manager error. 179 */ 180 DISTRIBUTED_MANAGER_ERR = 29360151, 181 /** 182 * Result(29360152) for DistributedSched Service NotifyCompleteContinuation failed. 183 */ 184 NOTIFYCOMPLETECONTINUATION_FAILED = 29360152, 185 /** 186 * Result(29360153) for DistributedSched Service Continue Ability Timeout Error. 187 */ 188 CONTINUE_ABILITY_TIMEOUT_ERR = 29360153, 189 /** 190 * Result(29360154) for DistributedSched Service Notify Complete Continuation abilityToken null. 191 */ 192 ABILITYTOKEN_NULL = 29360154, 193 /** 194 * Result(29360155) for get device list fail. 195 */ 196 GET_DEVICE_LIST_ERR = 29360155, 197 /** 198 * Result(29360156) for notify ability install error. 199 */ 200 NOTIFY_ABILITY_INSTALL_ERR = 29360156, 201 /** 202 * Result(29360157) for permission denied. 203 */ 204 DMS_PERMISSION_DENIED = 29360157, 205 /** 206 * Result(29360158) for notify ability free install. 207 */ 208 NOTIFY_ABILITY_FREE_INSTALL = 29360158, 209 /** 210 * Result(29360159) for notify app invalid uid. 211 */ 212 BIND_ABILITY_UID_INVALID_ERR = 29360159, 213 /** 214 * Result(29360160) for notify app happen connect leak. 215 */ 216 BIND_ABILITY_LEAK_ERR = 29360160, 217 /** 218 * Result(29360161) for can not service registry. 219 */ 220 NOT_FIND_SERVICE_REGISTRY = 29360161, 221 /** 222 * Result(29360162) for can not get service. 223 */ 224 NOT_FIND_SERVICE_PROXY = 29360162, 225 /** 226 * Result(29360163) for IPC Send Request to DEF fail. 227 */ 228 SEND_REQUEST_DEF_FAIL = 29360163, 229 /** 230 * Result(29360164) for BMS can not find the specified ability. 231 */ 232 CAN_NOT_FOUND_ABILITY_ERR = 29360164, 233 /** 234 * Result(29360165) for DMS can not register device state callback. 235 */ 236 REGISTER_DEVICE_STATE_CALLBACK_ERR = 29360165, 237 /** 238 * Result(29360166) for DMS can not unregister device state callback. 239 */ 240 UNREGISTER_DEVICE_STATE_CALLBACK_ERR = 29360166, 241 /** 242 * Result(29360167) for DMS can not start auxiliary device FA. 243 */ 244 START_AUXILIARY_FA_ERR = 29360167, 245 /** 246 * Result(29360168) for DMS can not get dmsproxy handle. 247 */ 248 GET_DMSPROXY_HANDLE_FAIL = 29360168, 249 /** 250 * Result(29360169) for dmsproxy service exception. 251 */ 252 DMSPROXY_SERVICE_ERR = 29360169, 253 /** 254 * Result(29360170) for softbus service unavailable. 255 */ 256 SOFTBUS_SERVICE_ERR = 29360170, 257 /** 258 * Result(29360171) for softbus register callback fail. 259 */ 260 SOFTBUS_REGISTER_CALLBACK_ERR = 29360171, 261 /** 262 * Result(29360172) for get DPermission sa fail. 263 */ 264 GET_DISTRIBUTED_PERMISSION_SA_ERR = 29360172, 265 /** 266 * Result(29360173) for get BMS sa fail. 267 */ 268 GET_BUNDLE_MANAGER_ERR = 29360173, 269 /** 270 * Result(29360174) for get remote dms fail. 271 */ 272 GET_REMOTE_DMS_FAIL = 29360174, 273 /** 274 * Result(29360175) for account access permission check failed. 275 */ 276 DMS_ACCOUNT_ACCESS_PERMISSION_DENIED = 29360175, 277 /** 278 * Result(29360176) for component access permission check failed. 279 */ 280 DMS_COMPONENT_ACCESS_PERMISSION_DENIED = 29360176, 281 /** 282 * Result(29360177) for distributed communication permission check failed. 283 */ 284 DMS_DISTRIBUTED_COMMUNICATION_PERMISSION_DENIED = 29360177, 285 /** 286 * Result(29360178) for osd function not support. 287 */ 288 MISSION_OSD_NOT_SUPPORTED = 29360178, 289 /** 290 * Result(29360179) for osd switch is off. 291 */ 292 MISSION_OSD_NOT_ENABLED = 29360179, 293 /** 294 * Result(29360180) for osd switch is on. 295 */ 296 MISSION_OSD_ENABLED = 29360180, 297 /** 298 * Result(29360181) for front app check failed. 299 */ 300 CHECK_FRONT_APP_FAIL = 29360181, 301 /* 302 * Result(29360184) for notify mission change listener failed. 303 */ 304 MISSION_NOTIFY_CHANGE_LISTENER_ERR = 29360184, 305 /** 306 * Result(29360185) for subscribe data storage change failed. 307 */ 308 MISSION_SUBSCRIBE_DATA_STORAGE_ERR = 29360185, 309 /** 310 * Result(29360186) for sync snapshot failed. 311 */ 312 MISSION_SYNC_SNAPSHOT_ERR = 29360186, 313 /** 314 * Result(29360187) for sync mission info list failed. 315 */ 316 MISSION_SYNC_MISSION_INFO_LIST_ERR = 29360187, 317 /** 318 * Result(29360188) for distributed communication permission check failed. 319 */ 320 REMOTE_DISTRIBUTED_COMMUNICATION_PERMISSION_DENIED = 29360188, 321 /* 322 * Result(29360191) for blur snapshot failed. 323 */ 324 MISSION_BLUR_SNAPSHOT_ERR = 29360191, 325 /* 326 * Result(29360192) for take foreground snapshot failed. 327 */ 328 MISSION_TAKE_FOREGROUND_SNAPSHOT_ERR = 29360192, 329 /* 330 * Result(29360193) for ccm switch not support. 331 */ 332 MISSION_OSD_CCM_NOT_SUPPORTED = 29360193, 333 /* 334 * Result(29360194) for wifi switch is off. 335 */ 336 MISSION_OSD_WIFI_OFF = 29360194, 337 /* 338 * Result(29360195) for child mode is on. 339 */ 340 MISSION_OSD_CHILDMODE_ON = 29360195, 341 /* 342 * Result(29360196) for cloud switch is off. 343 */ 344 MISSION_OSD_CLOUD_SWITCH_OFF = 29360196, 345 /* 346 * Result(29360197) for continue ability rejected. 347 */ 348 CONTINUE_ABILITY_REJECTED = 29360197, 349 /* 350 * Result(29360198) for continue save data failed. 351 */ 352 CONTINUE_SAVE_DATA_FAILED = 29360198, 353 /* 354 * Result(29360199) for onContinue failed. 355 */ 356 CONTINUE_ON_CONTINUE_FAILED = 29360199, 357 /* 358 * Result(29360200) for continue get content failed. 359 */ 360 CONTINUE_GET_CONTENT_FAILED = 29360200, 361 /* 362 * Result(29360201) for call permission check failed. 363 */ 364 CALL_PERMISSION_DENIED = 29360201, 365 /* 366 * Result(29360202) for continue remote not install and support free install. 367 */ 368 CONTINUE_REMOTE_UNINSTALLED_SUPPORT_FREEINSTALL = 29360202, 369 /* 370 * Result(29360203) for continue remote not install and not support free install. 371 */ 372 CONTINUE_REMOTE_UNINSTALLED_UNSUPPORT_FREEINSTALL = 29360203, 373 /* 374 * Result(29360204) for continue remote version not match. 375 */ 376 CONTINUE_REMOTE_VERSION_MISMATCH = 29360204, 377 /* 378 * Result(29360205) for continue freeinstall failed. 379 */ 380 CONTINUE_FREE_INSTALL_FAILED = 29360205, 381 /* 382 * Result(29360206) for continue remote cannot install. 383 */ 384 CONTINUE_REMOTE_UNINSTALLED_CANNOT_FREEINSTALL = 29360206, 385 /* 386 * Result(29360207) for app registered exceed max times. 387 */ 388 REGISTER_EXCEED_MAX_TIMES = 29360207, 389 /* 390 * Result(29360208) for token has not registered. 391 */ 392 TOKEN_HAS_NOT_REGISTERED = 29360208, 393 /* 394 * Result(29360209) for callback has registered. 395 */ 396 CALLBACK_HAS_REGISTERED = 29360209, 397 /* 398 * Result(29360210) for callback has not registered. 399 */ 400 CALLBACK_HAS_NOT_REGISTERED = 29360210, 401 /* 402 * Result(29360211) for connect ability failed. 403 */ 404 CONNECT_ABILITY_FAILED = 29360211, 405 /* 406 * Result(29360212) for disconnect ability failed. 407 */ 408 DISCONNECT_ABILITY_FAILED = 29360212, 409 /* 410 * Result(29360213) for panel name not configured. 411 */ 412 PANEL_NAME_NOT_CONFIGURED = 29360213, 413 /* 414 * Result(29360214) for unknown callback type. 415 */ 416 UNKNOWN_CALLBACK_TYPE = 29360214, 417 /* 418 * Result(29360215) for invalid connect status. 419 */ 420 INVALID_CONNECT_STATUS = 29360215, 421 /* 422 * Result(29360216) for invalid continuation mode. 423 */ 424 INVALID_CONTINUATION_MODE = 29360216, 425 /** 426 * Result(29360217) for dms version is empty. 427 */ 428 DMS_VERSION_EMPTY = 29360217, 429 /** 430 * Result(29360218) for DistributedSched Service parse dms version error. 431 */ 432 DMS_VERSION_PARSE_EXCEPTION = 29360218, 433 /* 434 * Result(29360219) for background permission check failed. 435 */ 436 DMS_BACKGROUND_PERMISSION_DENIED = 29360219, 437 /* 438 * Result(29360220) for start control permission check failed. 439 */ 440 DMS_START_CONTROL_PERMISSION_DENIED = 29360220, 441 }; 442 } // namespace DistributedSchedule 443 } // namespace OHOS 444 #endif // SERVICES_DTBSCHEDMGR_INCLUDE_DTBSCHEDMGR_LOG_H_ 445