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