1 /* 2 * Copyright (c) 2021-2025 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.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 "DSched_Service" 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 58 #define CHECK_POINTER_RETURN(object, log) \ 59 do { \ 60 if ((object) == nullptr) { \ 61 HILOGE("%{public}s nullptr", (log)); \ 62 return; \ 63 } \ 64 } while (0) 65 66 #define CHECK_POINTER_RETURN_VALUE(object, value, log) \ 67 do { \ 68 if ((object) == nullptr) { \ 69 HILOGE("%{public}s nullptr", (log)); \ 70 return (value); \ 71 } \ 72 } while (0) 73 74 enum { 75 /** 76 * Module type: Distributed schedule Service side 77 */ 78 DMS_MODULE_TYPE_SERVICE = 0, 79 }; 80 81 // offset of dms error, only be used in this file. 82 constexpr ErrCode DMS_SERVICE_ERR_OFFSET = ErrCodeOffset(SUBSYS_DISTRIBUTEDSCHEDULE, DMS_MODULE_TYPE_SERVICE); 83 84 enum DmsInterfaceSdkErr { 85 /** 86 * Result(16300501) for the distributed sched work abnormally. 87 */ 88 ERR_DMS_WORK_ABNORMALLY = 16300501, 89 /** 90 * Result(16300503) throw to js for the application is not installed on the remote end and installation-free is 91 * not supported. 92 */ 93 ERR_REMOTE_UNINSTALLED_AND_UNFREEINSTALL = 16300503, 94 /** 95 * Result(16300504) throw to js for the application is not installed on the remote end but installation-free is 96 * supported, try again with freeInstall flag. 97 */ 98 ERR_CONTINUE_WITHOUT_FREEINSTALL_FLAG = 16300504, 99 /** 100 * Result(16300506) throw to js for the local continuation task is already in progress. 101 */ 102 ERR_CONTINUE_ALREADY_IN_PROGRESS = 16300506, 103 /** 104 * Result(16300507) throw to js for Failed to get the missionInfo of the specified bundle name. 105 */ 106 ERR_GET_MISSION_INFO_OF_BUNDLE_NAME = 16300507, 107 /** 108 * Result(16300508) throw to js for bind error due to the remote device hotspot enable, try again after disable 109 * the remote device hotspot. 110 */ 111 ERR_BIND_REMOTE_HOTSPOT_ENABLE_STATE = 16300508, 112 /** 113 * Result(16300509) throw to js for the remote device has been linked with other devices, try again when 114 * the remote device is idle. 115 */ 116 ERR_BIND_REMOTE_IN_BUSY_LINK = 16300509, 117 }; 118 119 enum { 120 /** 121 * Result(29360128) for invalid parameters. 122 */ 123 INVALID_PARAMETERS_ERR = DMS_SERVICE_ERR_OFFSET, 124 /** 125 * Result(29360129) for no response when RPC call. 126 */ 127 RPC_CALL_NORESPONSE_ERR = 29360129, 128 /** 129 * Result(29360130) for not find connect callback. 130 */ 131 NO_CONNECT_CALLBACK_ERR = 29360130, 132 /** 133 * Result(29360131) for remote invalid parameters. 134 */ 135 INVALID_REMOTE_PARAMETERS_ERR = 29360131, 136 /** 137 * Result(29360132) for remote device fail to bind ability. 138 */ 139 REMOTE_DEVICE_BIND_ABILITY_ERR = 29360132, 140 /** 141 * Result(29360133) for remote device fail to unbind ability. 142 */ 143 REMOTE_DEVICE_UNBIND_ABILITY_ERR = 29360133, 144 /** 145 * Result(29360134) for remote invalid parameters. 146 */ 147 REMOTE_FAIL_GET_SHELLINFO_ERR = 29360134, 148 /** 149 * Result(29360135) for remote device fail to start ability. 150 */ 151 REMOTE_DEVICE_START_ABILITY_ERR = 29360135, 152 /** 153 * Result(29360136) for remote device fail to stop ability. 154 */ 155 REMOTE_DEVICE_STOP_ABILITY_ERR = 29360136, 156 /** 157 * Result(29360137) for reg repeat ability token. 158 */ 159 REG_REPEAT_ABILITY_TOKEN_ERR = 29360137, 160 /** 161 * Result(29360138) for no ability token. 162 */ 163 NO_ABILITY_TOKEN_ERR = 29360138, 164 /** 165 * Result(29360139) for no appthread. 166 */ 167 NO_APP_THREAD_ERR = 29360139, 168 /** 169 * Result(29360140) for select device continue error. 170 */ 171 SELECT_DEVICE_CONTINUE_ERR = 29360140, 172 /** 173 * Result(29360141) for dump write file error. 174 */ 175 DMS_WRITE_FILE_FAILED_ERR = 29360141, 176 /** 177 * Result(29360142) for notify app the bind remote service's device is offline. 178 */ 179 DEVICE_OFFLINE_ERR = 29360142, 180 /** 181 * Result(29360143) for not find hitrace id. 182 */ 183 NO_HITRACE_RECORD_ERR = 29360143, 184 /** 185 * Result(29360144) for get local deviceid fail. 186 */ 187 GET_LOCAL_DEVICE_ERR = 29360144, 188 /** 189 * Result(29360145) for get local deviceid fail. 190 */ 191 GET_DATAABILITY_ERR = 29360145, 192 /** 193 * Result(29360146) for DistributedSched Service Publish Exception. 194 */ 195 DMS_PUBLISH_EXCEPTION = 29360146, 196 /** 197 * Result(29360147) for DistributedSched Storage Exception. 198 */ 199 DMS_GET_STORAGE_EXCEPTION = 29360147, 200 /** 201 * Result(29360148) for DistributedSched Service Get System Ability Manager Exception. 202 */ 203 DMS_GET_SAMGR_EXCEPTION = 29360148, 204 /** 205 * Result(29360149) for DistributedSched Service IPC call noresponse error. 206 */ 207 IPC_CALL_NORESPONSE_ERR = 29360149, 208 /** 209 * Result(29360150) for DistributedSched Service call bundle manager service error. 210 */ 211 BUNDLE_MANAGER_SERVICE_ERR = 29360150, 212 /** 213 * Result(29360151) for DistributedSched Service call distributed manager error. 214 */ 215 DISTRIBUTED_MANAGER_ERR = 29360151, 216 /** 217 * Result(29360152) for DistributedSched Service NotifyCompleteContinuation failed. 218 */ 219 NOTIFYCOMPLETECONTINUATION_FAILED = 29360152, 220 /** 221 * Result(29360153) for DistributedSched Service Continue Ability Timeout Error. 222 */ 223 CONTINUE_ABILITY_TIMEOUT_ERR = 29360153, 224 /** 225 * Result(29360154) for DistributedSched Service Notify Complete Continuation abilityToken null. 226 */ 227 ABILITYTOKEN_NULL = 29360154, 228 /** 229 * Result(29360155) for get device list fail. 230 */ 231 GET_DEVICE_LIST_ERR = 29360155, 232 /** 233 * Result(29360156) for notify ability install error. 234 */ 235 NOTIFY_ABILITY_INSTALL_ERR = 29360156, 236 /** 237 * Result(29360157) for permission denied. 238 */ 239 DMS_PERMISSION_DENIED = 29360157, 240 /** 241 * Result(29360158) for notify ability free install. 242 */ 243 NOTIFY_ABILITY_FREE_INSTALL = 29360158, 244 /** 245 * Result(29360159) for notify app invalid uid. 246 */ 247 BIND_ABILITY_UID_INVALID_ERR = 29360159, 248 /** 249 * Result(29360160) for notify app happen connect leak. 250 */ 251 BIND_ABILITY_LEAK_ERR = 29360160, 252 /** 253 * Result(29360161) for can not service registry. 254 */ 255 NOT_FIND_SERVICE_REGISTRY = 29360161, 256 /** 257 * Result(29360162) for can not get service. 258 */ 259 NOT_FIND_SERVICE_PROXY = 29360162, 260 /** 261 * Result(29360163) for IPC Send Request to DEF fail. 262 */ 263 SEND_REQUEST_DEF_FAIL = 29360163, 264 /** 265 * Result(29360164) for BMS can not find the specified ability. 266 */ 267 CAN_NOT_FOUND_ABILITY_ERR = 29360164, 268 /** 269 * Result(29360165) for DMS can not register device state callback. 270 */ 271 REGISTER_DEVICE_STATE_CALLBACK_ERR = 29360165, 272 /** 273 * Result(29360166) for DMS can not unregister device state callback. 274 */ 275 UNREGISTER_DEVICE_STATE_CALLBACK_ERR = 29360166, 276 /** 277 * Result(29360167) for DMS can not start auxiliary device FA. 278 */ 279 START_AUXILIARY_FA_ERR = 29360167, 280 /** 281 * Result(29360168) for DMS can not get dmsproxy handle. 282 */ 283 GET_DMSPROXY_HANDLE_FAIL = 29360168, 284 /** 285 * Result(29360169) for dmsproxy service exception. 286 */ 287 DMSPROXY_SERVICE_ERR = 29360169, 288 /** 289 * Result(29360170) for softbus service unavailable. 290 */ 291 SOFTBUS_SERVICE_ERR = 29360170, 292 /** 293 * Result(29360171) for softbus register callback fail. 294 */ 295 SOFTBUS_REGISTER_CALLBACK_ERR = 29360171, 296 /** 297 * Result(29360172) for get DPermission sa fail. 298 */ 299 GET_DISTRIBUTED_PERMISSION_SA_ERR = 29360172, 300 /** 301 * Result(29360173) for get BMS sa fail. 302 */ 303 GET_BUNDLE_MANAGER_ERR = 29360173, 304 /** 305 * Result(29360174) for get remote dms fail. 306 */ 307 GET_REMOTE_DMS_FAIL = 29360174, 308 /** 309 * Result(29360175) for account access permission check failed. 310 */ 311 DMS_ACCOUNT_ACCESS_PERMISSION_DENIED = 29360175, 312 /** 313 * Result(29360176) for component access permission check failed. 314 */ 315 DMS_COMPONENT_ACCESS_PERMISSION_DENIED = 29360176, 316 /** 317 * Result(29360177) for distributed communication permission check failed. 318 */ 319 DMS_DISTRIBUTED_COMMUNICATION_PERMISSION_DENIED = 29360177, 320 /** 321 * Result(29360178) for osd function not support. 322 */ 323 MISSION_OSD_NOT_SUPPORTED = 29360178, 324 /** 325 * Result(29360179) for osd switch is off. 326 */ 327 MISSION_OSD_NOT_ENABLED = 29360179, 328 /** 329 * Result(29360180) for osd switch is on. 330 */ 331 MISSION_OSD_ENABLED = 29360180, 332 /** 333 * Result(29360181) for front app check failed. 334 */ 335 CHECK_FRONT_APP_FAIL = 29360181, 336 /* 337 * Result(29360184) for notify mission change listener failed. 338 */ 339 MISSION_NOTIFY_CHANGE_LISTENER_ERR = 29360184, 340 /** 341 * Result(29360185) for subscribe data storage change failed. 342 */ 343 MISSION_SUBSCRIBE_DATA_STORAGE_ERR = 29360185, 344 /** 345 * Result(29360186) for sync snapshot failed. 346 */ 347 MISSION_SYNC_SNAPSHOT_ERR = 29360186, 348 /** 349 * Result(29360187) for sync mission info list failed. 350 */ 351 MISSION_SYNC_MISSION_INFO_LIST_ERR = 29360187, 352 /** 353 * Result(29360188) for distributed communication permission check failed. 354 */ 355 REMOTE_DISTRIBUTED_COMMUNICATION_PERMISSION_DENIED = 29360188, 356 /* 357 * Result(29360191) for blur snapshot failed. 358 */ 359 MISSION_BLUR_SNAPSHOT_ERR = 29360191, 360 /* 361 * Result(29360192) for take foreground snapshot failed. 362 */ 363 MISSION_TAKE_FOREGROUND_SNAPSHOT_ERR = 29360192, 364 /* 365 * Result(29360193) for ccm switch not support. 366 */ 367 MISSION_OSD_CCM_NOT_SUPPORTED = 29360193, 368 /* 369 * Result(29360194) for wifi switch is off. 370 */ 371 MISSION_OSD_WIFI_OFF = 29360194, 372 /* 373 * Result(29360195) for child mode is on. 374 */ 375 MISSION_OSD_CHILDMODE_ON = 29360195, 376 /* 377 * Result(29360196) for cloud switch is off. 378 */ 379 MISSION_OSD_CLOUD_SWITCH_OFF = 29360196, 380 /* 381 * Result(29360197) for continue ability rejected. 382 */ 383 CONTINUE_ABILITY_REJECTED = 29360197, 384 /* 385 * Result(29360198) for continue save data failed. 386 */ 387 CONTINUE_SAVE_DATA_FAILED = 29360198, 388 /* 389 * Result(29360199) for onContinue failed. 390 */ 391 CONTINUE_ON_CONTINUE_FAILED = 29360199, 392 /* 393 * Result(29360200) for continue get content failed. 394 */ 395 CONTINUE_GET_CONTENT_FAILED = 29360200, 396 /* 397 * Result(29360201) for call permission check failed. 398 */ 399 CALL_PERMISSION_DENIED = 29360201, 400 /* 401 * Result(29360202) for continue remote not install and support free install. 402 */ 403 CONTINUE_REMOTE_UNINSTALLED_SUPPORT_FREEINSTALL = 29360202, 404 /* 405 * Result(29360203) for continue remote not install and not support free install. 406 */ 407 CONTINUE_REMOTE_UNINSTALLED_UNSUPPORT_FREEINSTALL = 29360203, 408 /* 409 * Result(29360204) for continue remote version not match. 410 */ 411 CONTINUE_REMOTE_VERSION_MISMATCH = 29360204, 412 /* 413 * Result(29360205) for continue freeinstall failed. 414 */ 415 CONTINUE_FREE_INSTALL_FAILED = 29360205, 416 /* 417 * Result(29360206) for continue remote cannot install. 418 */ 419 CONTINUE_REMOTE_UNINSTALLED_CANNOT_FREEINSTALL = 29360206, 420 /* 421 * Result(29360207) for app registered exceed max times. 422 */ 423 REGISTER_EXCEED_MAX_TIMES = 29360207, 424 /* 425 * Result(29360208) for token has not registered. 426 */ 427 TOKEN_HAS_NOT_REGISTERED = 29360208, 428 /* 429 * Result(29360209) for callback has registered. 430 */ 431 CALLBACK_HAS_REGISTERED = 29360209, 432 /* 433 * Result(29360210) for callback has not registered. 434 */ 435 CALLBACK_HAS_NOT_REGISTERED = 29360210, 436 /* 437 * Result(29360211) for connect ability failed. 438 */ 439 CONNECT_ABILITY_FAILED = 29360211, 440 /* 441 * Result(29360212) for disconnect ability failed. 442 */ 443 DISCONNECT_ABILITY_FAILED = 29360212, 444 /* 445 * Result(29360213) for panel name not configured. 446 */ 447 PANEL_NAME_NOT_CONFIGURED = 29360213, 448 /* 449 * Result(29360214) for unknown callback type. 450 */ 451 UNKNOWN_CALLBACK_TYPE = 29360214, 452 /* 453 * Result(29360215) for invalid connect status. 454 */ 455 INVALID_CONNECT_STATUS = 29360215, 456 /* 457 * Result(29360216) for invalid continuation mode. 458 */ 459 INVALID_CONTINUATION_MODE = 29360216, 460 /** 461 * Result(29360217) for dms version is empty. 462 */ 463 DMS_VERSION_EMPTY = 29360217, 464 /** 465 * Result(29360218) for DistributedSched Service parse dms version error. 466 */ 467 DMS_VERSION_PARSE_EXCEPTION = 29360218, 468 /* 469 * Result(29360219) for background permission check failed. 470 */ 471 DMS_BACKGROUND_PERMISSION_DENIED = 29360219, 472 /* 473 * Result(29360220) for start control permission check failed. 474 */ 475 DMS_START_CONTROL_PERMISSION_DENIED = 29360220, 476 /** 477 * Result(29360221) for failed to get the missionInfo of the specified missionId. 478 */ 479 NO_MISSION_INFO_FOR_MISSION_ID = 29360221, 480 /** 481 * Result(29360222) for the operation device must be the device where the application to be continued 482 * is located or the target device to be continued. 483 */ 484 OPERATION_DEVICE_NOT_INITIATOR_OR_TARGET = 29360222, 485 /** 486 * Result(29360223) for the local continuation task is already in progress. 487 */ 488 CONTINUE_ALREADY_IN_PROGRESS = 29360223, 489 /** 490 * Result(29360224) for the mission for continuing is not alive, try again after restart mission. 491 */ 492 MISSION_FOR_CONTINUING_IS_NOT_ALIVE = 29360224, 493 /** 494 * Result(29360225) for sending event failed during continuation. 495 */ 496 CONTINUE_SEND_EVENT_FAILED = 29360225, 497 /** 498 * Result(29360226) for state machine receving invalid state code. 499 */ 500 CONTINUE_STATE_MACHINE_INVALID_STATE = 29360226, 501 /** 502 * Result(29360227) for session shutdown during continuation. 503 */ 504 CONTINUE_SESSION_SHUTDOWN = 29360227, 505 /** 506 * Result(29360228) for calling ContinueAbility failed during continuation. 507 */ 508 CONTINUE_CALL_CONTINUE_ABILITY_FAILED = 29360228, 509 /** 510 * Result(29360229) for calling StartAbility failed during continuation. 511 */ 512 CONTINUE_CALL_START_ABILITY_FAILED = 29360229, 513 /** 514 * Result(29360230) for sink Ability abnormal termination during continuation. 515 */ 516 CONTINUE_SINK_ABILITY_TERMINATED = 29360230, 517 /** 518 * Result(29360231) for all connect manager reject connect apply. 519 */ 520 DMS_CONNECT_APPLY_REJECT_FAILED = 29360231, 521 /** 522 * Result(29360232) for all connect manager deal connect apply timeout. 523 */ 524 DMS_CONNECT_APPLY_TIMEOUT_FAILED = 29360232, 525 /** 526 * Result(29360233) for mission continue state is not active. 527 */ 528 MISSION_NOT_CONTINUE_ACTIVE = 29360233, 529 /** 530 * Result(29360234) for mission is not focused. 531 */ 532 MISSION_NOT_FOCUSED = 29360234, 533 /** 534 * Result(29360235) for bundle is not continuable. 535 */ 536 BUNDLE_NOT_CONTINUABLE = 29360235, 537 /** 538 * Result(29360236) for user is not foreground. 539 */ 540 DMS_NOT_FOREGROUND_USER = 29360236, 541 /** 542 * Result(29360237) for not get mgr. 543 */ 544 DMS_NOT_GET_MANAGER = 29360237, 545 /** 546 * Result(29360238) for get window failed from scb. 547 */ 548 DMS_GET_WINDOW_FAILED_FROM_SCB = 29360238, 549 /** 550 * Result(29360239) for BMS can not find the specified module. 551 */ 552 CAN_NOT_FOUND_MODULE_ERR = 29360239, 553 /** 554 * Result(29360330) for sending event failed during collaboration. 555 */ 556 COLLAB_SEND_EVENT_FAILED = 29360330, 557 /** 558 * Result(29360331) for the local collaboration task is already in progress. 559 */ 560 COLLAB_ALREADY_IN_PROGRESS = 29360331, 561 /** 562 * Result(29360332) for the remote deviceId is not found. 563 */ 564 FIND_REMOTE_DEVICEID_ERR = 29360332, 565 /** 566 * Result(29360333) for session shutdown during continuation. 567 */ 568 COLLAB_SESSION_SHUTDOWN = 29360333, 569 /** 570 * Result(29360334) for get local deviceId failed. 571 */ 572 FIND_LOCAL_DEVICEID_ERR = 29360334, 573 /** 574 * Result(29360335) for get caller appId fromBmslocal failed. 575 */ 576 GET_APPID_ERR = 29360335, 577 /** 578 * Result(29360336) for get bundleNameList failed. 579 */ 580 GET_BUNDLENAMELIST_ERR = 29360336, 581 /** 582 * Result(29360337) for get accountInfo failed. 583 */ 584 GET_ACCOUNT_INFO_ERR = 29360337, 585 /** 586 * Result(29360338) for get userId from active Os AccountIds fail. 587 */ 588 GET_USERID_INFO_ERR = 29360338, 589 /** 590 * Result(29360339) for state machine receving invalid state code. 591 */ 592 COLLAB_STATE_MACHINE_INVALID_STATE = 29360339, 593 /** 594 * Result(29360340) for DistributedSched Service Collab Ability Timeout Error. 595 */ 596 COLLAB_ABILITY_TIMEOUT_ERR = 29360340, 597 /** 598 * Result(29360341) for DistributedSched Service Collab Ability Reject Error. 599 */ 600 COLLAB_ABILITY_REJECT_ERR = 29360341, 601 /** 602 * Result(29360342) for SoftBus Query Valid Qos failed. 603 */ 604 SOFTBUS_QUERY_VALID_QOS_ERR = 29360342, 605 /** 606 * Result(29360343) for SoftBus Query Valid Qos success but no usable qos. 607 */ 608 SOFTBUS_NO_USEFUL_QOS_ERR = 29360343, 609 }; 610 } // namespace DistributedSchedule 611 } // namespace OHOS 612 #endif // SERVICES_DTBSCHEDMGR_INCLUDE_DTBSCHEDMGR_LOG_H_ 613