1 /* 2 * Copyright (C) 2021 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 TELEPHONY_ERRORS_H 17 #define TELEPHONY_ERRORS_H 18 19 #include <errors.h> 20 21 namespace OHOS { 22 namespace Telephony { 23 const int TELEPHONY_PERMISSION_ERROR = -2; 24 const int TELEPHONY_ERROR = -1; 25 const int TELEPHONY_SUCCESS = 0; 26 27 enum { 28 TELEPHONY_COMMON = 0x00, 29 TELEPHONY_CALL_MANAGER = 0x01, 30 TELEPHONY_CELLULAR_CALL = 0x02, 31 TELEPHONY_CELLULAR_DATA = 0x03, 32 TELEPHONY_SMS_MMS = 0x04, 33 TELEPHONY_STATE_REGISTRY = 0x05, 34 TELEPHONY_NET_MANAGER = 0x06, 35 TELEPHONY_CORE_SERVICE_SIM = 0x07, 36 TELEPHONY_CORE_SERVICE_NETWORK_SEARCH = 0x08, 37 TELEPHONY_CORE_SERVICE_CORE = 0x09, 38 TELEPHONY_DATA_STORAGE = 0x10, 39 }; 40 41 // Error code for common 42 constexpr ErrCode COMMON_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_COMMON); 43 44 enum { 45 TELEPHONY_ERR_SUCCESS = 0, 46 TELEPHONY_ERR_FAIL = COMMON_ERR_OFFSET, 47 TELEPHONY_ERR_ARGUMENT_MISMATCH, 48 TELEPHONY_ERR_ARGUMENT_INVALID, 49 TELEPHONY_ERR_ARGUMENT_NULL, 50 TELEPHONY_ERR_MEMCPY_FAIL, 51 TELEPHONY_ERR_MEMSET_FAIL, 52 TELEPHONY_ERR_STRCPY_FAIL, 53 TELEPHONY_ERR_LOCAL_PTR_NULL, 54 TELEPHONY_ERR_PERMISSION_ERR, 55 TELEPHONY_ERR_DESCRIPTOR_MISMATCH, 56 TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL, 57 TELEPHONY_ERR_WRITE_DATA_FAIL, 58 TELEPHONY_ERR_WRITE_REPLY_FAIL, 59 TELEPHONY_ERR_READ_DATA_FAIL, 60 TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL, 61 TELEPHONY_ERR_ADD_DEATH_RECIPIENT_FAIL, 62 TELEPHONY_ERR_REGISTER_CALLBACK_FAIL, 63 TELEPHONY_ERR_UNINIT, 64 TELEPHONY_ERR_UNREGISTER_CALLBACK_FAIL, 65 TELEPHONY_ERR_SLOTID_INVALID, 66 TELEPHONY_ERR_SUBSCRIBE_BROADCAST_FAIL, 67 TELEPHONY_ERR_PUBLISH_BROADCAST_FAIL, 68 TELEPHONY_ERR_STRTOINT_FAIL, 69 TELEPHONY_ERR_NO_SIM_CARD, 70 TELEPHONY_ERR_DATABASE_WRITE_FAIL, 71 TELEPHONY_ERR_DATABASE_READ_FAIL, 72 TELEPHONY_ERR_RIL_CMD_FAIL, 73 TELEPHONY_ERR_UNKNOWN_NETWORK_TYPE, 74 TELEPHONY_ERR_ILLEGAL_USE_OF_SYSTEM_API, 75 }; 76 77 // Error code for telephony call manager 78 constexpr ErrCode CALL_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_CALL_MANAGER); 79 80 // Error code for telephony cellular call 81 constexpr ErrCode PROTOCOL_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_CELLULAR_CALL); 82 83 // Error code for telephony cellular data 84 constexpr ErrCode CELLULAR_DATA_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_CELLULAR_DATA); 85 86 // Error code for telephony sms mms 87 constexpr ErrCode SMS_MMS_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_SMS_MMS); 88 89 // Error code for telephony state registry 90 constexpr ErrCode STATE_REGISTRY_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_STATE_REGISTRY); 91 92 // Error code for telephony ner work 93 constexpr ErrCode NET_MANAGER_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_NET_MANAGER); 94 95 // Error code for telephony sim of core service 96 constexpr ErrCode CORE_SERVICE_SIM_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_CORE_SERVICE_SIM); 97 98 // Error code for telephony network search of core service 99 constexpr ErrCode CORE_SERVICE_NETWORK_SEARCH_ERR_OFFSET = 100 ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_CORE_SERVICE_NETWORK_SEARCH); 101 102 // Error code for telephony core of core service 103 constexpr ErrCode CORE_SERVICE_CORE_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_CORE_SERVICE_CORE); 104 105 // Error code for telephony data storage 106 constexpr ErrCode CORE_DATA_STORAGE_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_DATA_STORAGE); 107 } // namespace Telephony 108 } // namespace OHOS 109 #endif // TELEPHONY_ERRORS_H 110