• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-2022 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     TELEPHONY_IMS = 0x11,
40 };
41 
42 // Error code for common
43 constexpr ErrCode COMMON_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_COMMON);
44 
45 enum {
46     TELEPHONY_ERR_SUCCESS = 0,
47     TELEPHONY_ERR_FAIL = COMMON_ERR_OFFSET,
48     TELEPHONY_ERR_ARGUMENT_MISMATCH,
49     TELEPHONY_ERR_ARGUMENT_INVALID,
50     TELEPHONY_ERR_ARGUMENT_NULL,
51     TELEPHONY_ERR_MEMCPY_FAIL,
52     TELEPHONY_ERR_MEMSET_FAIL,
53     TELEPHONY_ERR_STRCPY_FAIL,
54     TELEPHONY_ERR_LOCAL_PTR_NULL,
55     TELEPHONY_ERR_PERMISSION_ERR,
56     TELEPHONY_ERR_DESCRIPTOR_MISMATCH,
57     TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL,
58     TELEPHONY_ERR_WRITE_DATA_FAIL,
59     TELEPHONY_ERR_WRITE_REPLY_FAIL,
60     TELEPHONY_ERR_READ_DATA_FAIL,
61     TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL,
62     TELEPHONY_ERR_ADD_DEATH_RECIPIENT_FAIL,
63     TELEPHONY_ERR_REGISTER_CALLBACK_FAIL,
64     TELEPHONY_ERR_CALLBACK_ALREADY_REGISTERED,
65     TELEPHONY_ERR_UNINIT,
66     TELEPHONY_ERR_UNREGISTER_CALLBACK_FAIL,
67     TELEPHONY_ERR_SLOTID_INVALID,
68     TELEPHONY_ERR_SUBSCRIBE_BROADCAST_FAIL,
69     TELEPHONY_ERR_PUBLISH_BROADCAST_FAIL,
70     TELEPHONY_ERR_STRTOINT_FAIL,
71     TELEPHONY_ERR_NO_SIM_CARD,
72     TELEPHONY_ERR_DATABASE_WRITE_FAIL,
73     TELEPHONY_ERR_DATABASE_READ_FAIL,
74     TELEPHONY_ERR_RIL_CMD_FAIL,
75     TELEPHONY_ERR_UNKNOWN_NETWORK_TYPE,
76     TELEPHONY_ERR_ILLEGAL_USE_OF_SYSTEM_API,
77     TELEPHONY_ERR_AIRPLANE_MODE_ON,
78     TELEPHONY_ERR_NETWORK_NOT_IN_SERVICE,
79     TELEPHONY_ERR_MMS_PS_NOT_ATTACHED,
80     TELEPHONY_ERR_MMS_FAIL_APN_INVALID,
81     TELEPHONY_ERR_MMS_FAIL_HTTP_ERROR,
82     TELEPHONY_ERR_MMS_FAIL_DATA_NETWORK_ERROR,
83 };
84 
85 // Error code for telephony call manager
86 constexpr ErrCode CALL_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_CALL_MANAGER);
87 
88 // Error code for telephony cellular call
89 constexpr ErrCode PROTOCOL_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_CELLULAR_CALL);
90 
91 // Error code for telephony cellular data
92 constexpr ErrCode CELLULAR_DATA_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_CELLULAR_DATA);
93 
94 // Error code for telephony sms mms
95 constexpr ErrCode SMS_MMS_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_SMS_MMS);
96 
97 // Error code for telephony state registry
98 constexpr ErrCode STATE_REGISTRY_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_STATE_REGISTRY);
99 
100 // Error code for telephony ner work
101 constexpr ErrCode NET_MANAGER_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_NET_MANAGER);
102 
103 // Error code for telephony sim of core service
104 constexpr ErrCode CORE_SERVICE_SIM_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_CORE_SERVICE_SIM);
105 
106 // Error code for telephony network search of core service
107 constexpr ErrCode CORE_SERVICE_NETWORK_SEARCH_ERR_OFFSET =
108     ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_CORE_SERVICE_NETWORK_SEARCH);
109 
110 // Error code for telephony core of core service
111 constexpr ErrCode CORE_SERVICE_CORE_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_CORE_SERVICE_CORE);
112 
113 // Error code for telephony data storage
114 constexpr ErrCode CORE_DATA_STORAGE_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_DATA_STORAGE);
115 
116 // Error code for telephony ims
117 constexpr ErrCode IMS_ERR_OFFSET = ErrCodeOffset(SUBSYS_TELEPONY, TELEPHONY_IMS);
118 } // namespace Telephony
119 } // namespace OHOS
120 #endif // TELEPHONY_ERRORS_H
121