summaryrefslogtreecommitdiffstats
path: root/dom/system/gonk/nsIDataCallInterfaceService.idl
blob: c387879fa00abf0dcf3fc1130e110d470a05cc14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

[scriptable, uuid(6b66446a-7000-438f-8e1b-b56b4cbf4fa9)]
interface nsIDataCall : nsISupports
{
  /**
   * Data call fail cause. One of the nsIDataCallInterface.DATACALL_FAIL_*
   * values.
   */
  readonly attribute long failCause;

  /**
   * If failCause != nsIDataCallInterface.DATACALL_FAIL_NONE, this field
   * indicates the suggested retry back-off timer. The unit is milliseconds.
   */
  readonly attribute long suggestedRetryTime;

  /**
   * Context ID, uniquely identifies this call.
   */
  readonly attribute long cid;

  /**
   * Data call network state. One of the nsIDataCallInterface.DATACALL_STATE_*
   * values.
   */
  readonly attribute long active;

  /**
   * Data call connection type. One of the
   * nsIDataCallInterface.DATACALL_PDP_TYPE_* values.
   */
  readonly attribute long pdpType;

  /**
   * The network interface name.
   */
  readonly attribute DOMString ifname;

  /**
   * A space-delimited list of addresses with optional "/" prefix length.
   */
  readonly attribute DOMString addresses;

  /**
   * A space-delimited list of DNS server addresses.
   */
  readonly attribute DOMString dnses;

  /**
   * A space-delimited list of default gateway addresses.
   */
  readonly attribute DOMString gateways;

  /**
   * A space-delimited list of Proxy Call State Control Function addresses for
   * IMS client.
   */
  readonly attribute DOMString pcscf;

  /**
   * MTU received from network, -1 if not set or invalid.
   */
  readonly attribute long mtu;
};

[scriptable, uuid(e119c54b-9354-4ad6-a1ee-18608bde9320)]
interface nsIDataCallInterfaceListener : nsISupports
{
  /**
   * Notify data call interface listeners about unsolicited data call state
   * changes.
   */
  void notifyDataCallListChanged(in uint32_t count,
                                 [array, size_is(count)] in nsIDataCall
                                   dataCalls);
};

[scriptable, uuid(db0b640a-3b3a-4f48-84dc-256e176876c2)]
interface nsIDataCallCallback : nsISupports
{
  /**
   * Called when setupDataCall() returns succesfully.
   */
  void notifySetupDataCallSuccess(in nsIDataCall dataCall);

  /**
   * Called when getDataCallList() returns succesfully.
   */
  void notifyGetDataCallListSuccess(in uint32_t count,
                                    [array, size_is(count)] in nsIDataCall
                                      dataCalls);
  /**
   * Called when request returns succesfully.
   */
  void notifySuccess();

  /**
   * Called when request returns error.
   */
  void notifyError(in AString errorMsg);
};

[scriptable, uuid(ec219021-8623-4b9f-aba5-4db58c60684f)]
interface nsIDataCallInterface : nsISupports
{
  /**
   * Data fail causes, defined in TS 24.008.
   */
  const long DATACALL_FAIL_NONE                          = 0;
  const long DATACALL_FAIL_OPERATOR_BARRED               = 0x08;
  const long DATACALL_FAIL_INSUFFICIENT_RESOURCES        = 0x1A;
  const long DATACALL_FAIL_MISSING_UKNOWN_APN            = 0x1B;
  const long DATACALL_FAIL_UNKNOWN_PDP_ADDRESS_TYPE      = 0x1C;
  const long DATACALL_FAIL_USER_AUTHENTICATION           = 0x1D;
  const long DATACALL_FAIL_ACTIVATION_REJECT_GGSN        = 0x1E;
  const long DATACALL_FAIL_ACTIVATION_REJECT_UNSPECIFIED = 0x1F;
  const long DATACALL_FAIL_SERVICE_OPTION_NOT_SUPPORTED  = 0x20;
  const long DATACALL_FAIL_SERVICE_OPTION_NOT_SUBSCRIBED = 0x21;
  const long DATACALL_FAIL_SERVICE_OPTION_OUT_OF_ORDER   = 0x22;
  const long DATACALL_FAIL_NSAPI_IN_USE                  = 0x23;
  const long DATACALL_FAIL_ONLY_IPV4_ALLOWED             = 0x32;
  const long DATACALL_FAIL_ONLY_IPV6_ALLOWED             = 0x33;
  const long DATACALL_FAIL_ONLY_SINGLE_BEARER_ALLOWED    = 0x34;
  const long DATACALL_FAIL_PROTOCOL_ERRORS               = 0x6F;
  /* Not mentioned in the specification */
  const long DATACALL_FAIL_VOICE_REGISTRATION_FAIL       = -1;
  const long DATACALL_FAIL_DATA_REGISTRATION_FAIL        = -2;
  const long DATACALL_FAIL_SIGNAL_LOST                   = -3;
  const long DATACALL_FAIL_PREF_RADIO_TECH_CHANGED       = -4;
  const long DATACALL_FAIL_RADIO_POWER_OFF               = -5;
  const long DATACALL_FAIL_TETHERED_CALL_ACTIVE          = -6;
  const long DATACALL_FAIL_ERROR_UNSPECIFIED             = 0xFFFF;

  /**
   * Data call network state.
   */
  const long DATACALL_STATE_INACTIVE    = 0;
  const long DATACALL_STATE_ACTIVE_DOWN = 1;
  const long DATACALL_STATE_ACTIVE_UP   = 2;

  /**
   * Data call authentication type. Must match the values in ril_consts
   * RIL_DATACALL_AUTH_TO_GECKO array.
   */
  const long DATACALL_AUTH_NONE         = 0;
  const long DATACALL_AUTH_PAP          = 1;
  const long DATACALL_AUTH_CHAP         = 2;
  const long DATACALL_AUTH_PAP_OR_CHAP  = 3;

   /**
    * Data call protocol type. Must match the values in ril_consts
    * RIL_DATACALL_PDP_TYPES array.
    */
  const long DATACALL_PDP_TYPE_IPV4   = 0;
  const long DATACALL_PDP_TYPE_IPV4V6 = 1;
  const long DATACALL_PDP_TYPE_IPV6   = 2;

  /**
   * Reason for deactivating data call.
   */
  const long DATACALL_DEACTIVATE_NO_REASON      = 0;
  const long DATACALL_DEACTIVATE_RADIO_SHUTDOWN = 1;

  /**
   * Setup data call.
   *
   * @param apn
   *        Apn to connect to.
   * @param username
   *        Username for apn.
   * @param password
   *        Password for apn.
   * @param authType
   *        Authentication type. One of the DATACALL_AUTH_* values.
   * @param pdpType
   *        Connection type. One of the DATACALL_PDP_TYPE_* values.
   * @param nsIDataCallCallback
   *        Called when request is finished.
   *
   * If successful, the notifySetupDataCallSuccess() will be called with the
   * new nsIDataCall.
   *
   * Otherwise, the notifyError() will be called, and the error will be either
   * 'RadioNotAvailable', 'OpNotAllowedBeforeRegToNw',
   * 'OpNotAllowedDuringVoiceCall', 'RequestNotSupported' or 'GenericFailure'.
   */
  void setupDataCall(in AString apn, in AString username,
                     in AString password, in long authType,
                     in long pdpType,
                     in nsIDataCallCallback callback);

  /**
   * Deactivate data call.
   *
   * @param cid
   *        Context id.
   * @param reason
   *        Disconnect Reason. One of the DATACALL_DEACTIVATE_* values.
   * @param nsIDataCallCallback
   *        Called when request is finished.
   *
   * If successful, the notifySuccess() will be called.
   *
   * Otherwise, the notifyError() will be called, and the error will be either
   * 'RadioNotAvailable' or 'GenericFailure'.
   */
  void deactivateDataCall(in long cid,
                          in long reason,
                          in nsIDataCallCallback callback);

  /**
   * Get current data call list.
   *
   * @param nsIDataCallCallback
   *        Called when request is finished.
   *
   * If successful, the notifyGetDataCallListSuccess() will be called with the
   * list of nsIDataCall(s).
   *
   * Otherwise, the notifyError() will be called, and the error will be either
   * 'RadioNotAvailable' or 'GenericFailure'.
   */
  void getDataCallList(in nsIDataCallCallback callback);

  /**
   * Set data registration state.
   *
   * @param attach
   *        whether to attach data registration or not.
   * @param nsIDataCallCallback
   *        Called when request is finished.
   *
   * If successful, the notifySuccess() will be called.
   *
   * Otherwise, the notifyError() will be called, and the error will be either
   * 'RadioNotAvailable', 'SubscriptionNotAvailable' or 'GenericFailure'.
   */
  void setDataRegistration(in boolean attach,
                           in nsIDataCallCallback callback);

  /**
   * Register to receive unsolicited events from this nsIDataCallInterface.
   */
  void registerListener(in nsIDataCallInterfaceListener listener);

  /**
   * Unregister to stop receiving unsolicited events from this
   * nsIDataCallInterface.
   */
  void unregisterListener(in nsIDataCallInterfaceListener listener);
};

[scriptable, uuid(64700406-7429-4743-a6ae-f82e9877fd0d)]
interface nsIDataCallInterfaceService : nsISupports
{
  /**
   * Get the corresponding data call interface.
   *
   * @param clientId
   *        clientId of the data call interface to get.
   */
  nsIDataCallInterface getDataCallInterface(in long clientId);
};