1 /* 2 * Copyright (c) 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 DEVICEDEBUG_BASE_H 17 #define DEVICEDEBUG_BASE_H 18 19 #include "hilog/log.h" 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 #undef LOG_TAG 26 #define LOG_TAG "APPSPAWN_DEVICEDEBUG" 27 #undef LOG_DOMAIN 28 #define LOG_DOMAIN (0xD002C00 + 0x11) 29 30 #ifndef APPSPAWN_TEST 31 #define APPSPAWN_STATIC static 32 #else 33 #define APPSPAWN_STATIC 34 #endif 35 36 /* 数字索引 */ 37 enum { 38 DEVICEDEBUG_NUM_0 = 0, 39 DEVICEDEBUG_NUM_1, 40 DEVICEDEBUG_NUM_2, 41 DEVICEDEBUG_NUM_3, 42 DEVICEDEBUG_NUM_4, 43 DEVICEDEBUG_NUM_5, 44 DEVICEDEBUG_NUM_6, 45 DEVICEDEBUG_NUM_7 46 }; 47 48 // 0x11 操作类型非法 49 #define DEVICEDEBUG_ERRNO_OPERATOR_TYPE_INVALID 0x11 50 // 0x12 参数缺失 51 #define DEVICEDEBUG_ERRNO_OPERATOR_ARGV_MISS 0x12 52 // 0x13 非开发者模式 53 #define DEVICEDEBUG_ERRNO_NOT_IN_DEVELOPER_MODE 0x13 54 // 0x14 创建json对象失败 55 #define DEVICEDEBUG_ERRNO_JSON_CREATED_FAILED 0x14 56 // 0x16 参数错误 57 #define DEVICEDEBUG_ERRNO_PARAM_INVALID 0x16 58 59 #define DEVICEDEBUG_LOGI(args, ...) \ 60 HILOG_INFO(LOG_CORE, "[%{public}s:%{public}d]" args, (__FILE_NAME__), (__LINE__), ##__VA_ARGS__) 61 62 #define DEVICEDEBUG_LOGE(args, ...) \ 63 HILOG_ERROR(LOG_CORE, "[%{public}s:%{public}d]" args, (__FILE_NAME__), (__LINE__), ##__VA_ARGS__) 64 65 #ifdef __cplusplus 66 } 67 #endif 68 69 #endif