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 UPDATE_SERVICE_CALL_RESULT_H 17 #define UPDATE_SERVICE_CALL_RESULT_H 18 19 #include "update_define.h" 20 21 namespace OHOS::UpdateEngine { 22 constexpr int CALL_RESULT_OFFSET = 2000; 23 24 enum class CallResult { 25 // 通用错误码 26 APP_NOT_GRANTED = 201, 27 NOT_SYSTEM_APP = 202, 28 PARAM_ERR = 401, 29 UN_SUPPORT = 801, 30 31 // 模块内错误码 32 SUCCESS = 0, 33 FAIL = 100, 34 DEV_UPG_INFO_ERR = 102, 35 FORBIDDEN = 103, 36 IPC_ERR = 104, 37 TIME_OUT = 402, 38 DB_ERROR = 501, 39 IO_ERROR = 502, 40 NET_ERROR = 503 41 }; 42 43 constexpr int32_t INT_CALL_SUCCESS = CAST_INT(CallResult::SUCCESS); 44 constexpr int32_t INT_CALL_FAIL = CAST_INT(CallResult::FAIL); 45 constexpr int32_t INT_UN_SUPPORT = CAST_INT(CallResult::UN_SUPPORT); 46 constexpr int32_t INT_FORBIDDEN = CAST_INT(CallResult::FORBIDDEN); 47 constexpr int32_t INT_CALL_IPC_ERR = CAST_INT(CallResult::IPC_ERR); 48 constexpr int32_t INT_APP_NOT_GRANTED = CAST_INT(CallResult::APP_NOT_GRANTED); 49 constexpr int32_t INT_NOT_SYSTEM_APP = CAST_INT(CallResult::NOT_SYSTEM_APP); 50 constexpr int32_t INT_PARAM_ERR = CAST_INT(CallResult::PARAM_ERR); 51 constexpr int32_t INT_DEV_UPG_INFO_ERR = CAST_INT(CallResult::DEV_UPG_INFO_ERR); 52 constexpr int32_t INT_TIME_OUT = CAST_INT(CallResult::TIME_OUT); 53 constexpr int32_t INT_DB_ERROR = CAST_INT(CallResult::DB_ERROR); 54 constexpr int32_t INT_IO_ERROR = CAST_INT(CallResult::IO_ERROR); 55 constexpr int32_t INT_NET_ERROR = CAST_INT(CallResult::NET_ERROR); 56 constexpr std::string_view NOT_SYSTEM_APP_INFO = 57 ": Permission verification failed. A non-system application calls a system API."; 58 } // namespace OHOS::UpdateEngine 59 #endif // UPDATE_SERVICE_CALL_RESULT_H 60