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 OHOS_TEL_RIL_CALL_PARCEL_H
17 #define OHOS_TEL_RIL_CALL_PARCEL_H
18 
19 #include "tel_ril_base_parcel.h"
20 #include "tel_ril_enum.h"
21 
22 namespace OHOS {
23 namespace Telephony {
24 /**
25  * @brief Defines the dial information in 3GPP TS 27.007 V4.3.0 (2001-12) 7.7,
26  * AT + ATD
27  */
28 struct DialInfo {
29     /** Request serial number. */
30     int32_t serial = 0;
31 
32     /**
33      * Type of address octet in integer format (refer TS 24.008 [8]
34      * subclauses 10.5.4.7); default 145 when dialling string includes
35      * international access code character "+", otherwise 129.
36      */
37     std::string address = "";
38 
39     /**
40      * Calling Line Identification Restriction. From TS 27.007 V3.4.0
41      * (2000-03).
42      */
43     int32_t clir = 0;
44 };
45 
46 /**
47  * @brief Defines the call status information in 3GPP TS 27.007 V4.3.0
48  * (2001-12) AT+CGDCONT.
49  */
50 struct CallInfo {
51     /**
52      * Call identification number as described in 3GPP TS 22.030 [19]
53      * sub-clause 6.5.5.1. This number can be used in +CHLD command operations.
54      */
55     int32_t index = 0;
56 
57     /** Call direction. The value 0 indicates the calling party, and the value
58      * 1 indicates the called party. */
59     int32_t dir = 0;
60 
61     /**
62      * Indicates the call state:
63      * 0: activated state
64      * 1: call hold state
65      * 2: calling party, dialing state
66      * 3: calling party, ringback tone state
67      * 4: called party, incoming call state
68      * 5: called party, call waiting state
69      * 6: disconnected state
70      * 7: disconnecting state
71      * 8: idle state
72      */
73     int32_t state = 0;
74 
75     /**
76      * Indicates the call mode:
77      * 0: voice call
78      * 1: data call
79      * 2: fax
80      */
81     int32_t mode = 0;
82 
83     /**
84      * Indicates the Multi-party call status:
85      * 0: not a multi-party(conference) call
86      * 1: a multi-party(conference) call
87      */
88     int32_t mpty = 0;
89 
90     /**
91      * Indicates the call domain of the voice call:
92      * 0: CS domain
93      * 1: IP multimedia system (IMS) domain
94      */
95     int32_t voiceDomain = 0;
96 
97     /**
98      * Indicates the call type:
99      * 0: Voice call
100      * 1: Video call: send one-way video, two-way voice
101      * 2: Video call: one-way receiving video, two-way voice
102      * 3: Video call: two-way video, two-way voice
103      */
104     int32_t callType = 0;
105 
106     /** phone number in format specified by <type> */
107     std::string number = "";
108 
109     /**
110      * Type of address octet in integer format (refer TS 24.008 [8]
111      * subclauses 10.5.4.7); default 145 when dialling string includes
112      * international access code character "+", otherwise 129. See 3GPP
113      * TS 27.007 V4.3.0 (2001-12) 6.1.
114      */
115     int32_t type = 0;
116 
117     /**
118      * Alphanumeric representation of <number> corresponding to the entry found
119      * in phonebook; used character set should be the one selected with command
120      * select TE character set +CSCS.
121      */
122     std::string alpha = "";
123 };
124 
125 /**
126  * @brief Defines the call status information list.
127  */
128 struct CallInfoList {
129     /** The size of CallInfoList. */
130     int32_t callSize = 0;
131 
132     /** The ID of the call status information list. */
133     int32_t flag = 0;
134 
135     /** Call status information list. */
136     std::vector<CallInfo> calls {};
137 };
138 
139 /**
140  * @brief Defines the emergency information.
141  */
142 struct EmergencyInfo {
143     /** Number index. */
144     int32_t index = 0;
145 
146     /** Total number of numbers. */
147     int32_t total = 0;
148 
149     /** Emergency call number in string format. */
150     std::string eccNum = "";
151 
152     /**
153      * Emergency call type:
154      * 0: Interface message of initiating an emergency call
155      * 1: Bandit police
156      * 2: Rescue
157      * 4: Fire alarm
158      * 8: Marine Police
159      * 16: Alpine rescue
160      */
161     int32_t category = 0;
162 
163     /**
164      * Whether the number is valid with or without a card:
165      * 0: valid without card
166      * 1: Valid with card
167      */
168     int32_t simpresent = 0;
169 
170     /** Mobile country code. */
171     std::string mcc = "";
172 
173     /**
174      * Distinguishes CS domain abnormal service status:
175      * 0: all States are valid
176      * 1: the CS domain is not in normal service
177      */
178     int32_t abnormalService = 0;
179 };
180 
181 /**
182  * @brief Defines the emergency info list.
183  */
184 struct EmergencyInfoList {
185     /** The size of the emergency info list. */
186     int32_t callSize = 0;
187 
188     /** The ID of emergency info list. */
189     int32_t flag = 0;
190 
191     /** Emergency info list. */
192     std::vector<EmergencyInfo> calls {};
193 };
194 
195 /**
196  * @brief Defines the call forwarding information.
197  */
198 struct CallForwardSetInfo {
199     /** Request serial number. */
200     int32_t serial = 0;
201 
202     /**
203      * Call forwarding type:
204      * 0: call forwarding unconditional
205      * 1: call forwarding on busy
206      * 2: call forwarding on no reply
207      * 3: call forwarding not reachable (no network service, or power-off)
208      * 4: any call forwarding
209      * 5: any call forwarding conditional
210      */
211     int32_t reason = 0;
212 
213     /**
214      * Call forwarding operation mode:
215      * 0: deactivation
216      * 1: activation
217      * 2: status query
218      * 3: registration
219      * 4: deletion
220      */
221     int32_t mode = 0;
222 
223     /** Phone number. */
224     std::string number = "";
225 
226     /** Service class. For details, see 3GPP TS 27.007. */
227     int32_t classx = 0;
228 };
229 
230 /**
231  * @brief Defines the Unstructured Supplementary Data Service (USSD)
232  * information.
233  */
234 struct UssdNoticeInfo {
235     /**
236      * Integer value.
237      * 0: The network does not require a TE reply (USSD-Notify initiated by the
238      *    network or TE. The network does not need further information after
239      *    starting operation);
240      * 1: The network needs a TE reply (USSD-Request initiated by the network,
241      *    or TE sent After starting the operation, the network needs further
242      *    information);
243      * 2: The USSD session is released by the network;
244      * 3: Other local clients have responded;
245      * 4: The operation is not supported;
246      * 5: The network timed out.
247      */
248     int32_t m = 0;
249     /** USSD string, the maximum length is 160 characters. */
250     std::string str = "";
251 };
252 
253 /**
254  * @brief Defines the supplementary service information.
255  */
256 struct SsNoticeInfo {
257     /**
258      * Service type:
259      * 0: call forwarding unconditional
260      * 1: call forwarding on busy
261      * 2: call forwarding on no reply
262      * 3: call forwarding not reachable (no network service, or power-off)
263      */
264     int32_t serviceType = 0;
265 
266     /**
267      * Request type:
268      * 0: deactivation
269      * 1: activated
270      * 2: status query
271      * 3: registration
272      * 4: deletion
273      */
274     int32_t requestType = 0;
275 
276     /** Service class. For details, see 3GPP TS 27.007. */
277     int32_t serviceClass = 0;
278 
279     /** Query result. For details, see {@link RilErrType}. */
280     int32_t result = 0;
281 };
282 
283 /**
284  * @brief Active reporting of SRVCC status is controlled by the +CIREP command.
285  *
286  * This command complies with the 3GPP TS 27.007 protocol.
287  */
288 struct SrvccStatus {
289     /**
290      * SRVCC status.
291      * 1: SRVCC starts;
292      * 2: SRVCC is successful;
293      * 3: SRVCC is cancelled;
294      * 4: SRVCC failed.
295      */
296     int32_t status = 1;
297 };
298 
299 /**
300  * @brief ringback voice event reported by the modem during dialing.
301  *
302  * Modem private commands, not a reported field specified by the 3gpp
303  * protocol.
304  */
305 struct RingbackVoice {
306     /** 0 network alerting; 1 local alerting */
307     int32_t status = 0;
308 };
309 } // namespace Telephony
310 } // namespace OHOS
311 #endif // OHOS_TEL_RIL_CALL_PARCEL_H
312