1/**
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/**
18 * variables from ril.h
19 */
20
21/**
22 * RIL Error codes
23 */
24var RIL_E_SUCCESS = 0;
25var RIL_E_RADIO_NOT_AVAILABLE = 1;     /* If radio did not start or is resetting */
26var RIL_E_GENERIC_FAILURE = 2;
27var RIL_E_PASSWORD_INCORRECT = 3;      /* for PIN/PIN2 methods only! */
28var RIL_E_SIM_PIN2 = 4;                /* Operation requires SIM PIN2 to be entered */
29var RIL_E_SIM_PUK2 = 5;                /* Operation requires SIM PIN2 to be entered */
30var RIL_E_REQUEST_NOT_SUPPORTED = 6;
31var RIL_E_CANCELLED = 7;
32var RIL_E_OP_NOT_ALLOWED_DURING_VOICE_CALL = 8; /* data ops are not allowed during voice
33                                                   call on a Class C GPRS device */
34var RIL_E_OP_NOT_ALLOWED_BEFORE_REG_TO_NW = 9;  /* data ops are not allowed before device
35                                                   registers in network */
36var RIL_E_SMS_SEND_FAIL_RETRY = 10;             /* fail to send sms and need retry */
37var RIL_E_SIM_ABSENT = 11;                      /* fail to set the location where CDMA subscription
38                                                   shall be retrieved because of SIM or RUIM
39                                                   card absent */
40var RIL_E_SUBSCRIPTION_NOT_AVAILABLE = 12;      /* fail to find CDMA subscription from specified
41                                                   location */
42var RIL_E_MODE_NOT_SUPPORTED = 13;              /* HW does not support preferred network type */
43var RIL_E_FDN_CHECK_FAILURE = 14;               /* command failed because recipient is not on FDN
44                                                   list */
45var RIL_E_ILLEGAL_SIM_OR_ME = 15;               /* network selection failed due to */
46
47var CARD_MAX_APPS = 8;
48
49/**
50 * Icc card state
51 */
52var CARDSTATE_ABSENT   = 0;
53var CARDSTATE_PRESENT  = 1;
54var CARDSTATE_ERROR    = 2;
55
56/**
57 * RIL_PersoSubState
58 */
59var PERSOSUBSTATE_UNKNOWN                   = 0; /* initial state */
60var PERSOSUBSTATE_IN_PROGRESS               = 1; /* in between each lock transition */
61var PERSOSUBSTATE_READY                     = 2; /* when either SIM or RUIM Perso is finished
62                                                    since each app can only have 1 active perso
63                                                    involved */
64var PERSOSUBSTATE_SIM_NETWORK               = 3;
65var PERSOSUBSTATE_SIM_NETWORK_SUBSET        = 4;
66var PERSOSUBSTATE_SIM_CORPORATE             = 5;
67var PERSOSUBSTATE_SIM_SERVICE_PROVIDER      = 6;
68var PERSOSUBSTATE_SIM_SIM                   = 7;
69var PERSOSUBSTATE_SIM_NETWORK_PUK           = 8; /* The corresponding perso lock is blocked */
70var PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK    = 9;
71var PERSOSUBSTATE_SIM_CORPORATE_PUK         = 10;
72var PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK  = 11;
73var PERSOSUBSTATE_SIM_SIM_PUK               = 12;
74var PERSOSUBSTATE_RUIM_NETWORK1             = 13;
75var PERSOSUBSTATE_RUIM_NETWORK2             = 14;
76var PERSOSUBSTATE_RUIM_HRPD                 = 15;
77var PERSOSUBSTATE_RUIM_CORPORATE            = 16;
78var PERSOSUBSTATE_RUIM_SERVICE_PROVIDER     = 17;
79var PERSOSUBSTATE_RUIM_RUIM                 = 18;
80var PERSOSUBSTATE_RUIM_NETWORK1_PUK         = 19; /* The corresponding perso lock is blocked */
81var PERSOSUBSTATE_RUIM_NETWORK2_PUK         = 20;
82var PERSOSUBSTATE_RUIM_HRPD_PUK             = 21;
83var PERSOSUBSTATE_RUIM_CORPORATE_PUK        = 22;
84var PERSOSUBSTATE_RUIM_SERVICE_PROVIDER_PUK = 23;
85var PERSOSUBSTATE_RUIM_RUIM_PUK             = 24;
86
87/**
88 * RIL_AppState
89 */
90var APPSTATE_UNKNOWN               = 0;
91var APPSTATE_DETECTED              = 1;
92var APPSTATE_PIN                   = 2; /* If PIN1 or UPin is required */
93var APPSTATE_PUK                   = 3; /* If PUK1 or Puk for UPin is required */
94var APPSTATE_SUBSCRIPTION_PERSO    = 4; /* perso_substate should be look at
95                                           when app_state is assigned to this value */
96var APPSTATE_READY                 = 5;
97
98/**
99 * RIL_PinState
100 */
101var PINSTATE_UNKNOWN              = 0;
102var PINSTATE_ENABLED_NOT_VERIFIED = 1;
103var PINSTATE_ENABLED_VERIFIED     = 2;
104var PINSTATE_DISABLED             = 3;
105var PINSTATE_ENABLED_BLOCKED      = 4;
106var PINSTATE_ENABLED_PERM_BLOCKED = 5;
107
108/**
109 * RIL_AppType
110 */
111var APPTYPE_UNKNOWN = 0;
112var APPTYPE_SIM     = 1;
113var APPTYPE_USIM    = 2;
114var APPTYPE_RUIM    = 3;
115var APPTYPE_CSIM    = 4;
116
117/**
118 * RIL_CallState
119 */
120var CALLSTATE_ACTIVE = 0;
121var CALLSTATE_HOLDING = 1;
122var CALLSTATE_DIALING = 2;                           /* MO call only */
123var CALLSTATE_ALERTING = 3;                          /* MO call only */
124var CALLSTATE_INCOMING = 4;                          /* MT call only */
125var CALLSTATE_WAITING = 5;                           /* MT call only */
126
127/**
128 * RIL_RadioState
129 */
130var RADIOSTATE_OFF = 0;                   /* Radio explictly powered off (eg CFUN=0) */
131var RADIOSTATE_UNAVAILABLE = 1;           /* Radio unavailable (eg, resetting or not booted) */
132var RADIOSTATE_SIM_NOT_READY = 2;         /* Radio is on, but the SIM interface is not ready */
133var RADIOSTATE_SIM_LOCKED_OR_ABSENT = 3;  /* SIM PIN locked, PUK required, network
134                                              personalization locked; or SIM absent */
135var RADIOSTATE_SIM_READY = 4;             /* Radio is on and SIM interface is available */
136var RADIOSTATE_RUIM_NOT_READY = 5;        /* Radio is on, but the RUIM interface is not ready */
137var RADIOSTATE_RUIM_READY = 6;            /* Radio is on and the RUIM interface is available */
138var RADIOSTATE_RUIM_LOCKED_OR_ABSENT = 7; /* RUIM PIN locked, PUK required, network
139                                              personalization locked; or RUIM absent */
140var RADIOSTATE_NV_NOT_READY = 8;          /* Radio is on, but the NV interface is not available */
141var RADIOSTATE_NV_READY = 9;              /* Radio is on and the NV interface is available */
142
143/**
144 * Last call fail cause
145 */
146var CALL_FAIL_UNOBTAINABLE_NUMBER = 1;
147var CALL_FAIL_NORMAL = 16;
148var CALL_FAIL_BUSY = 17;
149var CALL_FAIL_CONGESTION = 34;
150var CALL_FAIL_ACM_LIMIT_EXCEEDED = 68;
151var CALL_FAIL_CALL_BARRED = 240;
152var CALL_FAIL_FDN_BLOCKED = 241;
153var CALL_FAIL_IMSI_UNKNOWN_IN_VLR = 242;
154var CALL_FAIL_IMEI_NOT_ACCEPTED = 243;
155var CALL_FAIL_CDMA_LOCKED_UNTIL_POWER_CYCLE = 1000;
156var CALL_FAIL_CDMA_DROP = 1001;
157var CALL_FAIL_CDMA_INTERCEPT = 1002;
158var CALL_FAIL_CDMA_REORDER = 1003;
159var CALL_FAIL_CDMA_SO_REJECT = 1004;
160var CALL_FAIL_CDMA_RETRY_ORDER = 1005;
161var CALL_FAIL_CDMA_ACCESS_FAILURE = 1006;
162var CALL_FAIL_CDMA_PREEMPTED = 1007;
163var CALL_FAIL_CDMA_NOT_EMERGENCY = 1008; /* For non-emergency number dialed during emergency callback mode */
164var CALL_FAIL_CDMA_ACCESS_BLOCKED = 1009; /* CDMA network access probes blocked */
165var CALL_FAIL_ERROR_UNSPECIFIED = 0xffff;
166
167/**
168 * RIL requests
169 */
170var RIL_REQUEST_GET_SIM_STATUS = 1
171var RIL_REQUEST_ENTER_SIM_PIN = 2
172var RIL_REQUEST_ENTER_SIM_PUK = 3
173var RIL_REQUEST_ENTER_SIM_PIN2 = 4
174var RIL_REQUEST_ENTER_SIM_PUK2 = 5
175var RIL_REQUEST_CHANGE_SIM_PIN = 6
176var RIL_REQUEST_CHANGE_SIM_PIN2 = 7
177var RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION = 8
178var RIL_REQUEST_GET_CURRENT_CALLS = 9
179var RIL_REQUEST_DIAL = 10
180var RIL_REQUEST_GET_IMSI = 11
181var RIL_REQUEST_HANGUP = 12
182var RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND = 13
183var RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND = 14
184var RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE = 15
185var RIL_REQUEST_SWITCH_HOLDING_AND_ACTIVE = 15
186var RIL_REQUEST_CONFERENCE = 16
187var RIL_REQUEST_UDUB = 17
188var RIL_REQUEST_LAST_CALL_FAIL_CAUSE = 18
189var RIL_REQUEST_SIGNAL_STRENGTH = 19
190var RIL_REQUEST_VOICE_REGISTRATION_STATE = 20
191var RIL_REQUEST_DATA_REGISTRATION_STATE = 21
192var RIL_REQUEST_OPERATOR = 22
193var RIL_REQUEST_RADIO_POWER = 23
194var RIL_REQUEST_DTMF = 24
195var RIL_REQUEST_SEND_SMS = 25
196var RIL_REQUEST_SEND_SMS_EXPECT_MORE = 26
197var RIL_REQUEST_SETUP_DATA_CALL = 27
198var RIL_REQUEST_SIM_IO = 28
199var RIL_REQUEST_SEND_USSD = 29
200var RIL_REQUEST_CANCEL_USSD = 30
201var RIL_REQUEST_GET_CLIR = 31
202var RIL_REQUEST_SET_CLIR = 32
203var RIL_REQUEST_QUERY_CALL_FORWARD_STATUS = 33
204var RIL_REQUEST_SET_CALL_FORWARD = 34
205var RIL_REQUEST_QUERY_CALL_WAITING = 35
206var RIL_REQUEST_SET_CALL_WAITING = 36
207var RIL_REQUEST_SMS_ACKNOWLEDGE = 37
208var RIL_REQUEST_GET_IMEI = 38
209var RIL_REQUEST_GET_IMEISV = 39
210var RIL_REQUEST_ANSWER = 40
211var RIL_REQUEST_DEACTIVATE_DATA_CALL = 41
212var RIL_REQUEST_QUERY_FACILITY_LOCK = 42
213var RIL_REQUEST_SET_FACILITY_LOCK = 43
214var RIL_REQUEST_CHANGE_BARRING_PASSWORD = 44
215var RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE = 45
216var RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC = 46
217var RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL = 47
218var RIL_REQUEST_QUERY_AVAILABLE_NETWORKS = 48
219var RIL_REQUEST_DTMF_START = 49
220var RIL_REQUEST_DTMF_STOP = 50
221var RIL_REQUEST_BASEBAND_VERSION = 51
222var RIL_REQUEST_SEPARATE_CONNECTION = 52
223var RIL_REQUEST_SET_MUTE = 53
224var RIL_REQUEST_GET_MUTE = 54
225var RIL_REQUEST_QUERY_CLIP = 55
226var RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE = 56
227var RIL_REQUEST_DATA_CALL_LIST = 57
228var RIL_REQUEST_RESET_RADIO = 58
229var RIL_REQUEST_OEM_HOOK_RAW = 59
230var RIL_REQUEST_OEM_HOOK_STRINGS = 60
231var RIL_REQUEST_SCREEN_STATE = 61
232var RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION = 62
233var RIL_REQUEST_WRITE_SMS_TO_SIM = 63
234var RIL_REQUEST_DELETE_SMS_ON_SIM = 64
235var RIL_REQUEST_SET_BAND_MODE = 65
236var RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE = 66
237var RIL_REQUEST_STK_GET_PROFILE = 67
238var RIL_REQUEST_STK_SET_PROFILE = 68
239var RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND = 69
240var RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE = 70
241var RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM = 71
242var RIL_REQUEST_EXPLICIT_CALL_TRANSFER = 72
243var RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE = 73
244var RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE = 74
245var RIL_REQUEST_GET_NEIGHBORING_CELL_IDS = 75
246var RIL_REQUEST_SET_LOCATION_UPDATES = 76
247var RIL_REQUEST_CDMA_SET_SUBSCRIPTION = 77
248var RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE = 78
249var RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE = 79
250var RIL_REQUEST_SET_TTY_MODE = 80
251var RIL_REQUEST_QUERY_TTY_MODE = 81
252var RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE = 82
253var RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE = 83
254var RIL_REQUEST_CDMA_FLASH = 84
255var RIL_REQUEST_CDMA_BURST_DTMF = 85
256var RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY = 86
257var RIL_REQUEST_CDMA_SEND_SMS = 87
258var RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE = 88
259var RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG = 89
260var RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG = 90
261var RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION = 91
262var RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG = 92
263var RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG = 93
264var RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION = 94
265var RIL_REQUEST_CDMA_SUBSCRIPTION = 95
266var RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM = 96
267var RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM = 97
268var RIL_REQUEST_DEVICE_IDENTITY = 98
269var RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE = 99
270var RIL_REQUEST_GET_SMSC_ADDRESS = 100
271var RIL_REQUEST_SET_SMSC_ADDRESS = 101
272var RIL_REQUEST_REPORT_SMS_MEMORY_STATUS = 102
273var RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING = 103
274
275/**
276 * RIL unsolicited requests
277 */
278var RIL_UNSOL_RESPONSE_BASE = 1000
279var RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED = 1000
280var RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED = 1001
281var RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED = 1002
282var RIL_UNSOL_RESPONSE_NEW_SMS = 1003
283var RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT = 1004
284var RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM = 1005
285var RIL_UNSOL_ON_USSD = 1006
286var RIL_UNSOL_ON_USSD_REQUEST = 1007
287var RIL_UNSOL_NITZ_TIME_RECEIVED = 1008
288var RIL_UNSOL_SIGNAL_STRENGTH = 1009
289var RIL_UNSOL_DATA_CALL_LIST_CHANGED = 1010
290var RIL_UNSOL_SUPP_SVC_NOTIFICATION = 1011
291var RIL_UNSOL_STK_SESSION_END = 1012
292var RIL_UNSOL_STK_PROACTIVE_COMMAND = 1013
293var RIL_UNSOL_STK_EVENT_NOTIFY = 1014
294var RIL_UNSOL_STK_CALL_SETUP = 1015
295var RIL_UNSOL_SIM_SMS_STORAGE_FULL = 1016
296var RIL_UNSOL_SIM_REFRESH = 1017
297var RIL_UNSOL_CALL_RING = 1018
298var RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED = 1019
299var RIL_UNSOL_RESPONSE_CDMA_NEW_SMS = 1020
300var RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS = 1021
301var RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL = 1022
302var RIL_UNSOL_RESTRICTED_STATE_CHANGED = 1023
303var RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE = 1024
304var RIL_UNSOL_CDMA_CALL_WAITING = 1025
305var RIL_UNSOL_CDMA_OTA_PROVISION_STATUS = 1026
306var RIL_UNSOL_CDMA_INFO_REC = 1027
307var RIL_UNSOL_OEM_HOOK_RAW = 1028
308var RIL_UNSOL_RINGBACK_TONE = 1029
309var RIL_UNSOL_RESEND_INCALL_MUTE = 1030
310
311/**
312 * Control commands in ctrl.proto for control server
313 */
314var CTRL_CMD_GET_RADIO_STATE = 1
315var CTRL_CMD_SET_RADIO_STATE = 2
316
317/**
318 * Control commands in ctrl.proto that will be dispatched to
319 * simulatedRadio or simulatedIcc
320 */
321var CTRL_CMD_DISPATH_BASE             = 1000
322var CTRL_CMD_SET_MT_CALL              = 1001
323var CTRL_CMD_HANGUP_CONN_REMOTE       = 1002
324var CTRL_CMD_SET_CALL_TRANSITION_FLAG = 1003
325var CTRL_CMD_SET_CALL_ALERT           = 1004
326var CTRL_CMD_SET_CALL_ACTIVE          = 1005
327var CTRL_CMD_ADD_DIALING_CALL         = 1006
328
329/* status for control commands, defined in ctrl.proto */
330var CTRL_STATUS_OK = 0
331var CTRL_STATUS_ERR = 1
332
333/**
334 * Local requests from simulated_radio or simulated_icc
335 */
336var CMD_DELAY_TEST = 2000
337var CMD_UNSOL_SIGNAL_STRENGTH = 2001
338var CMD_UNSOL_CALL_STATE_CHANGED = 2002    // Send RIL_UNSOL_CALL_STATE_CHANGED
339var CMD_CALL_STATE_CHANGE = 2003           // call state change: dialing->alert->active
340var CMD_UNSOL_CALL_RING = 2004
341
342/**
343 * Other variables
344 */
345var OUTGOING = 0;       /* outgoing call */
346var INCOMING = 1;       /* incoming call */
347