Merge lp:~phablet-team/ofono/refactor-update-from-rilmodem into lp:~phablet-team/ofono/ubuntu
- refactor-update-from-rilmodem
- Merge into ubuntu
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Ricardo Salveti | ||||||||
Approved revision: | 6845 | ||||||||
Merged at revision: | 6845 | ||||||||
Proposed branch: | lp:~phablet-team/ofono/refactor-update-from-rilmodem | ||||||||
Merge into: | lp:~phablet-team/ofono/ubuntu | ||||||||
Diff against target: |
5425 lines (+3369/-562) 34 files modified
.gitignore (+4/-0) Makefile.am (+3/-0) debian/changelog (+40/-0) debian/rules (+9/-0) doc/messagemanager-api.txt (+10/-0) drivers/rilmodem/call-volume.c (+18/-30) drivers/rilmodem/devinfo.c (+12/-17) drivers/rilmodem/gprs.c (+2/-2) drivers/rilmodem/rilutil.c (+0/-93) drivers/rilmodem/rilutil.h (+0/-4) drivers/rilmodem/sim.c (+48/-13) drivers/rilmodem/sms.c (+168/-100) drivers/rilmodem/voicecall.c (+328/-76) gril/gril.c (+63/-60) gril/gril.h (+1/-1) gril/grilreply.c (+256/-15) gril/grilreply.h (+27/-9) gril/grilrequest.c (+149/-0) gril/grilrequest.h (+40/-0) gril/grilunsol.c (+95/-3) gril/grilunsol.h (+24/-3) gril/grilutil.c (+1/-0) gril/parcel.c (+7/-5) gril/ril_constants.h (+25/-0) include/types.h (+6/-0) plugins/smshistory.c (+151/-0) src/stk.c (+1/-1) src/storage.h (+1/-1) test/monitor-ofono (+1/-1) unit/test-caif.c (+18/-8) unit/test-grilreply.c (+1350/-64) unit/test-grilrequest.c (+379/-42) unit/test-grilunsol.c (+129/-10) unit/test-mux.c (+3/-4) |
||||||||
To merge this branch: | bzr merge lp:~phablet-team/ofono/refactor-update-from-rilmodem | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ricardo Salveti (community) | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Review via email: mp+197803@code.launchpad.net |
Commit message
[ Alfonso Sanchez-Beato ]
* gril, include, rilmodem/sms, unit: SMS re-factoring
- merge applicable nemomobile code
- re-factor parcel code
- add sms parcel unit tests
* build, doc, plugins, test: Add SMS history plugin
- adds support for SMS delivery reports (LP: #1223314)
* gril, src, unit: Fix build warning
[ Tony Espy ]
* gril, unit: fix const casts in gril and unit tests
* rilmodem/gprs: set default max_cids to 1 (LP: 1254746)
[ Alfonso Sanchez-Beato ]
* gril, rilmodem/voicecall, unit: Voicecall re-factoring
- merge applicable nemomobile code, including support
for multi-party calling and call hold
- re-factor parcel code
- add voicecall parcel unit tests
* rilmodem: fix memory leaks reported by valgrind
* gril, rilmodem/sim: Remove SIM file-not-found error logging
- includes low-level gril fix to handle ril messages
that include a failure code, but also include event
data (LP: #1254219)
* gril, rilmodem/
- merge applicable nemomobile code
- re-factor parcel code
- add call-volume parcel unit tests
* gril, rilmodem/devinfo, unit: Devinfo re-factoring
- re-factor parcel code
- add devinfo parcel unit tests
[ Tony Espy ]
* unit: Add rilmodem gprs/netreg parcel unit tests
* debian/rules: Add CFLAGS to enable strict warnings checking
Description of the change
This merge proposal includes all of the latest upstream changes from our github ofono/rilmodem repository. It was created by merging our auto-import bzr branch ( lp:~phablet-team/ofono/rilmodem ). It also includes a manual patch to debian/rules to enable strict warnings during build-time ( this mimics those enabled by upstreams maintainer mode ).
This code has been tested on the latest trusty touch images ( r31 ) on both maguro and mako.
As this merge includes code merged from the nemomobile version of rilmodem, several new features are included:
- voicecall hold & multi-party support
- SMS history report ( used for SMS delivery reports )
Note, in order to test these features some supplementary services may need to be enabled on the SIM/Subscriber account used to test, please refer to the Telephony Test Plan document for more details.
Finally, multi-party calling currently doesn't work on maguro. As it's a deprecated device, we've reported a bug ( lp: #1257206 ), but decided that it was more important to release the feature as is.
PS Jenkins bot (ps-jenkins) wrote : | # |
Ricardo Salveti (rsalveti) wrote : | # |
Tested on both mako and maguro for regressions, everything seems to be working as before. Was able to test voicecall hold and swap calls, but couldn't test multi-party but probably because of my carrier (also unable to test it with Android).
Preview Diff
1 | === modified file '.gitignore' |
2 | --- .gitignore 2012-11-28 09:21:51 +0000 |
3 | +++ .gitignore 2013-12-04 21:58:23 +0000 |
4 | @@ -32,6 +32,7 @@ |
5 | dundee/dundee |
6 | dundee/dundee.service |
7 | |
8 | +test-driver |
9 | unit/test-common |
10 | unit/test-util |
11 | unit/test-idmap |
12 | @@ -42,6 +43,9 @@ |
13 | unit/test-caif |
14 | unit/test-stkutil |
15 | unit/test-cdmasms |
16 | +unit/test-grilreply |
17 | +unit/test-grilrequest |
18 | +unit/test-grilunsol |
19 | |
20 | tools/huawei-audio |
21 | tools/auto-enable |
22 | |
23 | === modified file 'Makefile.am' |
24 | --- Makefile.am 2013-11-25 20:24:09 +0000 |
25 | +++ Makefile.am 2013-12-04 21:58:23 +0000 |
26 | @@ -515,6 +515,9 @@ |
27 | builtin_modules += push_notification |
28 | builtin_sources += plugins/push-notification.c |
29 | |
30 | +builtin_modules += smshistory |
31 | +builtin_sources += plugins/smshistory.c |
32 | + |
33 | sbin_PROGRAMS = src/ofonod |
34 | |
35 | src_ofonod_SOURCES = $(gdbus_sources) $(builtin_sources) src/ofono.ver \ |
36 | |
37 | === modified file 'debian/changelog' |
38 | --- debian/changelog 2013-12-03 02:17:22 +0000 |
39 | +++ debian/changelog 2013-12-04 21:58:23 +0000 |
40 | @@ -1,3 +1,43 @@ |
41 | +ofono (1.12+bzr6845-0ubuntu1) UNRELEASED; urgency=low |
42 | + |
43 | + [ Alfonso Sanchez-Beato ] |
44 | + * gril, include, rilmodem/sms, unit: SMS re-factoring |
45 | + - merge applicable nemomobile code |
46 | + - re-factor parcel code |
47 | + - add sms parcel unit tests |
48 | + * build, doc, plugins, test: Add SMS history plugin |
49 | + - adds support for SMS delivery reports (LP: #1223314) |
50 | + * gril, src, unit: Fix build warning |
51 | + |
52 | + [ Tony Espy ] |
53 | + * gril, unit: fix const casts in gril and unit tests |
54 | + * rilmodem/gprs: set default max_cids to 1 (LP: 1254746) |
55 | + |
56 | + [ Alfonso Sanchez-Beato ] |
57 | + * gril, rilmodem/voicecall, unit: Voicecall re-factoring |
58 | + - merge applicable nemomobile code, including support |
59 | + for multi-party calling and call hold |
60 | + - re-factor parcel code |
61 | + - add voicecall parcel unit tests |
62 | + * rilmodem: fix memory leaks reported by valgrind |
63 | + * gril, rilmodem/sim: Remove SIM file-not-found error logging |
64 | + - includes low-level gril fix to handle ril messages |
65 | + that include a failure code, but also include event |
66 | + data (LP: #1254219) |
67 | + * gril, rilmodem/call-volume, unit: Call-volume re-factoring |
68 | + - merge applicable nemomobile code |
69 | + - re-factor parcel code |
70 | + - add call-volume parcel unit tests |
71 | + * gril, rilmodem/devinfo, unit: Devinfo re-factoring |
72 | + - re-factor parcel code |
73 | + - add devinfo parcel unit tests |
74 | + |
75 | + [ Tony Espy ] |
76 | + * unit: Add rilmodem gprs/netreg parcel unit tests |
77 | + * debian/rules: Add CFLAGS to enable strict warnings checking |
78 | + |
79 | + -- Tony Espy <espy@canonical.com> Wed, 04 Dec 2013 14:10:32 -0500 |
80 | + |
81 | ofono (1.12+bzr6844-0ubuntu1) trusty; urgency=low |
82 | |
83 | [ Alfonso Sanchez-Beato ] |
84 | |
85 | === modified file 'debian/rules' |
86 | --- debian/rules 2013-10-02 15:34:41 +0000 |
87 | +++ debian/rules 2013-12-04 21:58:23 +0000 |
88 | @@ -1,5 +1,14 @@ |
89 | #!/usr/bin/make -f |
90 | |
91 | +CFLAGS += -Werror -Wextra \ |
92 | + -Wno-unused-parameter \ |
93 | + -Wno-missing-field-initializers \ |
94 | + -Wdeclaration-after-statement \ |
95 | + -Wmissing-declarations \ |
96 | + -Wredundant-decls \ |
97 | + -Wcast-align \ |
98 | + -DG_DISABLE_DEPRECATED |
99 | + |
100 | %: |
101 | dh $@ --parallel --with=autoreconf |
102 | |
103 | |
104 | === modified file 'doc/messagemanager-api.txt' |
105 | --- doc/messagemanager-api.txt 2011-02-11 16:29:43 +0000 |
106 | +++ doc/messagemanager-api.txt 2013-12-04 21:58:23 +0000 |
107 | @@ -73,6 +73,16 @@ |
108 | This signal is emitted whenever a Message object |
109 | has been removed, e.g. when it reaches a final state. |
110 | |
111 | + StatusReport(object path, boolean delivered) |
112 | + |
113 | + This signal is emitted whenever a SMS Status Report is |
114 | + received for a previously sent message (note that the |
115 | + Message object already has been removed at this point). |
116 | + |
117 | + Possible 'delivered' values are: |
118 | + true - successfully delivered |
119 | + false - delivery failed |
120 | + |
121 | Properties string ServiceCenterAddress |
122 | |
123 | Contains the number of the SMS service center. |
124 | |
125 | === modified file 'drivers/rilmodem/call-volume.c' |
126 | --- drivers/rilmodem/call-volume.c 2013-11-06 03:59:35 +0000 |
127 | +++ drivers/rilmodem/call-volume.c 2013-12-04 21:58:23 +0000 |
128 | @@ -3,7 +3,7 @@ |
129 | * oFono - Open Source Telephony |
130 | * |
131 | * Copyright (C) 2008-2011 Intel Corporation. All rights reserved. |
132 | - * Copyright (C) 2012 Canonical Ltd. |
133 | + * Copyright (C) 2012-2013 Canonical Ltd. |
134 | * |
135 | * This program is free software; you can redistribute it and/or modify |
136 | * it under the terms of the GNU General Public License version 2 as |
137 | @@ -42,6 +42,8 @@ |
138 | |
139 | #include "rilmodem.h" |
140 | #include "parcel.h" |
141 | +#include "grilrequest.h" |
142 | +#include "grilreply.h" |
143 | |
144 | struct cv_data { |
145 | GRil *ril; |
146 | @@ -69,7 +71,7 @@ |
147 | } |
148 | |
149 | static void ril_call_volume_mute(struct ofono_call_volume *cv, int muted, |
150 | - ofono_call_volume_cb_t cb, void *data) |
151 | + ofono_call_volume_cb_t cb, void *data) |
152 | { |
153 | struct cv_data *cvd = ofono_call_volume_get_data(cv); |
154 | struct cb_data *cbd = cb_data_new(cb, data, cvd); |
155 | @@ -77,19 +79,16 @@ |
156 | int request = RIL_REQUEST_SET_MUTE; |
157 | int ret; |
158 | |
159 | - DBG(""); |
160 | - |
161 | - parcel_init(&rilp); |
162 | - parcel_w_int32(&rilp, 1); |
163 | - parcel_w_int32(&rilp, muted); |
164 | DBG("Initial ril muted state: %d", muted); |
165 | - ret = g_ril_send(cvd->ril, request, rilp.data, |
166 | - rilp.size, volume_mute_cb, cbd, g_free); |
167 | + |
168 | + g_ril_request_set_mute(cvd->ril, muted, &rilp); |
169 | + |
170 | + ret = g_ril_send(cvd->ril, request, rilp.data, rilp.size, |
171 | + volume_mute_cb, cbd, g_free); |
172 | + |
173 | + g_ril_print_request(cvd->ril, ret, request); |
174 | parcel_free(&rilp); |
175 | |
176 | - g_ril_append_print_buf(cvd->ril, "(%d)", muted); |
177 | - g_ril_print_request(cvd->ril, ret, request); |
178 | - |
179 | if (ret <= 0) { |
180 | ofono_error("Send RIL_REQUEST_SET_MUTE failed."); |
181 | g_free(cbd); |
182 | @@ -101,22 +100,14 @@ |
183 | { |
184 | struct ofono_call_volume *cv = user_data; |
185 | struct cv_data *cvd = ofono_call_volume_get_data(cv); |
186 | - struct parcel rilp; |
187 | int muted; |
188 | |
189 | if (message->error != RIL_E_SUCCESS) { |
190 | - ofono_error("Could not retrive the ril mute state"); |
191 | + ofono_error("Could not retrieve the ril mute state"); |
192 | return; |
193 | } |
194 | |
195 | - ril_util_init_parcel(message, &rilp); |
196 | - |
197 | - /* skip length of int[] */ |
198 | - parcel_r_int32(&rilp); |
199 | - muted = parcel_r_int32(&rilp); |
200 | - |
201 | - g_ril_append_print_buf(cvd->ril, "{%d}", muted); |
202 | - g_ril_print_response(cvd->ril, message); |
203 | + muted = g_ril_reply_parse_get_mute(cvd->ril, message); |
204 | |
205 | ofono_call_volume_set_muted(cv, muted); |
206 | } |
207 | @@ -148,7 +139,7 @@ |
208 | } |
209 | |
210 | static int ril_call_volume_probe(struct ofono_call_volume *cv, |
211 | - unsigned int vendor, void *data) |
212 | + unsigned int vendor, void *data) |
213 | { |
214 | GRil *ril = data; |
215 | struct cv_data *cvd; |
216 | @@ -162,17 +153,14 @@ |
217 | |
218 | ofono_call_volume_set_data(cv, cvd); |
219 | |
220 | - /* |
221 | - * TODO: analyze if capability check is needed |
222 | - * and/or timer should be adjusted. |
223 | - * |
224 | + /* |
225 | * ofono_call_volume_register() needs to be called after |
226 | * the driver has been set in ofono_call_volume_create(), |
227 | * which calls this function. Most other drivers make |
228 | - * some kind of capabilities query to the modem, and then |
229 | - * call register in the callback; we use a timer instead. |
230 | + * some kind of capabilities query to the modem, and then |
231 | + * call register in the callback; we use an idle event instead. |
232 | */ |
233 | - g_timeout_add_seconds(2, ril_delayed_register, cv); |
234 | + g_idle_add(ril_delayed_register, cv); |
235 | |
236 | return 0; |
237 | } |
238 | |
239 | === modified file 'drivers/rilmodem/devinfo.c' |
240 | --- drivers/rilmodem/devinfo.c 2013-11-06 03:59:35 +0000 |
241 | +++ drivers/rilmodem/devinfo.c 2013-12-04 21:58:23 +0000 |
242 | @@ -3,7 +3,7 @@ |
243 | * oFono - Open Source Telephony - RIL Modem Support |
244 | * |
245 | * Copyright (C) 2008-2011 Intel Corporation. All rights reserved. |
246 | - * Copyright (C) 2012 Canonical Ltd. |
247 | + * Copyright (C) 2012-2013 Canonical Ltd. |
248 | * |
249 | * This program is free software; you can redistribute it and/or modify |
250 | * it under the terms of the GNU General Public License version 2 as |
251 | @@ -39,6 +39,7 @@ |
252 | #include "gril.h" |
253 | |
254 | #include "rilmodem.h" |
255 | +#include "grilreply.h" |
256 | |
257 | /* |
258 | * TODO: The functions in this file are stubbed out, and |
259 | @@ -80,9 +81,9 @@ |
260 | { |
261 | struct cb_data *cbd = user_data; |
262 | ofono_devinfo_query_cb_t cb = cbd->cb; |
263 | + GRil *ril = cbd->user; |
264 | struct ofono_error error; |
265 | - struct parcel rilp; |
266 | - gchar *revision; |
267 | + char *revision; |
268 | |
269 | if (message->error == RIL_E_SUCCESS) { |
270 | decode_ril_error(&error, "OK"); |
271 | @@ -92,8 +93,7 @@ |
272 | return; |
273 | } |
274 | |
275 | - ril_util_init_parcel(message, &rilp); |
276 | - revision = parcel_r_string(&rilp); |
277 | + revision = g_ril_reply_parse_baseband_version(ril, message); |
278 | |
279 | cb(&error, revision, cbd->data); |
280 | |
281 | @@ -104,13 +104,13 @@ |
282 | ofono_devinfo_query_cb_t cb, |
283 | void *data) |
284 | { |
285 | - struct cb_data *cbd = cb_data_new(cb, data, NULL); |
286 | GRil *ril = ofono_devinfo_get_data(info); |
287 | + struct cb_data *cbd = cb_data_new(cb, data, ril); |
288 | int request = RIL_REQUEST_BASEBAND_VERSION; |
289 | int ret; |
290 | |
291 | ret = g_ril_send(ril, request, NULL, 0, |
292 | - query_revision_cb, cbd, g_free); |
293 | + query_revision_cb, cbd, g_free); |
294 | |
295 | g_ril_print_request_no_args(ril, ret, request); |
296 | |
297 | @@ -124,8 +124,8 @@ |
298 | { |
299 | struct cb_data *cbd = user_data; |
300 | ofono_devinfo_query_cb_t cb = cbd->cb; |
301 | + GRil *ril = cbd->user; |
302 | struct ofono_error error; |
303 | - struct parcel rilp; |
304 | gchar *imei; |
305 | |
306 | if (message->error == RIL_E_SUCCESS) { |
307 | @@ -136,9 +136,7 @@ |
308 | return; |
309 | } |
310 | |
311 | - ril_util_init_parcel(message, &rilp); |
312 | - |
313 | - imei = parcel_r_string(&rilp); |
314 | + imei = g_ril_reply_parse_baseband_version(ril, message); |
315 | |
316 | cb(&error, imei, cbd->data); |
317 | |
318 | @@ -149,8 +147,8 @@ |
319 | ofono_devinfo_query_cb_t cb, |
320 | void *data) |
321 | { |
322 | - struct cb_data *cbd = cb_data_new(cb, data, NULL); |
323 | GRil *ril = ofono_devinfo_get_data(info); |
324 | + struct cb_data *cbd = cb_data_new(cb, data, ril); |
325 | /* TODO: make it support both RIL_REQUEST_GET_IMEI (deprecated) and |
326 | * RIL_REQUEST_DEVICE_IDENTITY depending on the rild version used */ |
327 | int request = RIL_REQUEST_GET_IMEI; |
328 | @@ -188,16 +186,13 @@ |
329 | ofono_devinfo_set_data(info, ril); |
330 | |
331 | /* |
332 | - * TODO: analyze if capability check is needed |
333 | - * and/or timer should be adjusted. |
334 | - * |
335 | * ofono_devinfo_register() needs to be called after |
336 | * the driver has been set in ofono_devinfo_create(), |
337 | * which calls this function. Most other drivers make |
338 | * some kind of capabilities query to the modem, and then |
339 | - * call register in the callback; we use a timer instead. |
340 | + * call register in the callback; we use an idle event instead. |
341 | */ |
342 | - g_timeout_add_seconds(1, ril_delayed_register, info); |
343 | + g_idle_add(ril_delayed_register, info); |
344 | |
345 | return 0; |
346 | } |
347 | |
348 | === modified file 'drivers/rilmodem/gprs.c' |
349 | --- drivers/rilmodem/gprs.c 2013-11-25 22:34:47 +0000 |
350 | +++ drivers/rilmodem/gprs.c 2013-12-04 21:58:23 +0000 |
351 | @@ -137,8 +137,6 @@ |
352 | gboolean notify_status = FALSE; |
353 | int old_status; |
354 | |
355 | - DBG(""); |
356 | - |
357 | if (message->error != RIL_E_SUCCESS) { |
358 | ofono_error("%s: DATA_REGISTRATION_STATE reply failure: %s", |
359 | __func__, |
360 | @@ -217,6 +215,8 @@ |
361 | * This callback is a result of the inital call |
362 | * to probe(), so should return after registration. |
363 | */ |
364 | + g_free(reply); |
365 | + |
366 | return; |
367 | } |
368 | |
369 | |
370 | === modified file 'drivers/rilmodem/rilutil.c' |
371 | --- drivers/rilmodem/rilutil.c 2013-11-15 23:18:12 +0000 |
372 | +++ drivers/rilmodem/rilutil.c 2013-12-04 21:58:23 +0000 |
373 | @@ -204,99 +204,6 @@ |
374 | g_free(req); |
375 | } |
376 | |
377 | -GSList *ril_util_parse_clcc(GRil *gril, struct ril_msg *message) |
378 | -{ |
379 | - struct ofono_call *call; |
380 | - struct parcel rilp; |
381 | - GSList *l = NULL; |
382 | - int num, i; |
383 | - gchar *number, *name; |
384 | - |
385 | - ril_util_init_parcel(message, &rilp); |
386 | - |
387 | - g_ril_append_print_buf(gril, "{"); |
388 | - |
389 | - /* Number of RIL_Call structs */ |
390 | - num = parcel_r_int32(&rilp); |
391 | - for (i = 0; i < num; i++) { |
392 | - call = g_try_new(struct ofono_call, 1); |
393 | - if (call == NULL) |
394 | - break; |
395 | - |
396 | - ofono_call_init(call); |
397 | - call->status = parcel_r_int32(&rilp); |
398 | - call->id = parcel_r_int32(&rilp); |
399 | - call->phone_number.type = parcel_r_int32(&rilp); |
400 | - parcel_r_int32(&rilp); /* isMpty */ |
401 | - parcel_r_int32(&rilp); /* isMT */ |
402 | - parcel_r_int32(&rilp); /* als */ |
403 | - call->type = parcel_r_int32(&rilp); /* isVoice */ |
404 | - parcel_r_int32(&rilp); /* isVoicePrivacy */ |
405 | - number = parcel_r_string(&rilp); |
406 | - if (number) { |
407 | - strncpy(call->phone_number.number, number, |
408 | - OFONO_MAX_PHONE_NUMBER_LENGTH); |
409 | - g_free(number); |
410 | - } |
411 | - parcel_r_int32(&rilp); /* numberPresentation */ |
412 | - name = parcel_r_string(&rilp); |
413 | - if (name) { |
414 | - strncpy(call->name, name, |
415 | - OFONO_MAX_CALLER_NAME_LENGTH); |
416 | - g_free(name); |
417 | - } |
418 | - parcel_r_int32(&rilp); /* namePresentation */ |
419 | - parcel_r_int32(&rilp); /* uusInfo */ |
420 | - |
421 | - if (strlen(call->phone_number.number) > 0) |
422 | - call->clip_validity = 0; |
423 | - else |
424 | - call->clip_validity = 2; |
425 | - |
426 | - /* TODO: figure out how to line-wrap properly |
427 | - * without introducing spaces in string. |
428 | - */ |
429 | - g_ril_append_print_buf(gril, |
430 | - "%s [id=%d,status=%d,type=%d,number=%s,name=%s]", |
431 | - print_buf, |
432 | - call->id, call->status, call->type, |
433 | - call->phone_number.number, call->name); |
434 | - |
435 | - l = g_slist_insert_sorted(l, call, ril_util_call_compare); |
436 | - } |
437 | - |
438 | - g_ril_append_print_buf(gril, "%s}", print_buf); |
439 | - g_ril_print_response(gril, message); |
440 | - |
441 | - return l; |
442 | -} |
443 | - |
444 | -gint ril_util_parse_sms_response(GRil *gril, struct ril_msg *message) |
445 | -{ |
446 | - struct parcel rilp; |
447 | - int error, mr; |
448 | - char *ack_pdu; |
449 | - |
450 | - /* Set up Parcel struct for proper parsing */ |
451 | - ril_util_init_parcel(message, &rilp); |
452 | - |
453 | - /* TP-Message-Reference for GSM/ |
454 | - * BearerData MessageId for CDMA |
455 | - */ |
456 | - mr = parcel_r_int32(&rilp); |
457 | - ack_pdu = parcel_r_string(&rilp); |
458 | - error = parcel_r_int32(&rilp); |
459 | - |
460 | - |
461 | - g_ril_append_print_buf(gril, "{%d,%s,%d}", |
462 | - mr, ack_pdu, error); |
463 | - g_ril_print_response(gril, message); |
464 | - |
465 | - g_free(ack_pdu); |
466 | - |
467 | - return mr; |
468 | -} |
469 | - |
470 | gint ril_util_get_signal(GRil *gril, struct ril_msg *message) |
471 | { |
472 | struct parcel rilp; |
473 | |
474 | === modified file 'drivers/rilmodem/rilutil.h' |
475 | --- drivers/rilmodem/rilutil.h 2013-11-15 23:18:12 +0000 |
476 | +++ drivers/rilmodem/rilutil.h 2013-12-04 21:58:23 +0000 |
477 | @@ -104,10 +104,6 @@ |
478 | GDestroyNotify destroy); |
479 | void ril_util_sim_state_query_free(struct ril_util_sim_state_query *req); |
480 | |
481 | -GSList *ril_util_parse_clcc(GRil *gril, struct ril_msg *message); |
482 | - |
483 | -gint ril_util_parse_sms_response(GRil *gril, struct ril_msg *message); |
484 | - |
485 | gint ril_util_get_signal(GRil *gril, struct ril_msg *message); |
486 | |
487 | struct cb_data { |
488 | |
489 | === modified file 'drivers/rilmodem/sim.c' |
490 | --- drivers/rilmodem/sim.c 2013-11-06 03:59:35 +0000 |
491 | +++ drivers/rilmodem/sim.c 2013-12-04 21:58:23 +0000 |
492 | @@ -93,26 +93,51 @@ |
493 | int flen = 0, rlen = 0, str = 0; |
494 | guchar access[3] = { 0x00, 0x00, 0x00 }; |
495 | guchar file_status = EF_STATUS_VALID; |
496 | - struct reply_sim_io *reply; |
497 | + struct reply_sim_io *reply = NULL; |
498 | |
499 | - if (message->error == RIL_E_SUCCESS) { |
500 | - decode_ril_error(&error, "OK"); |
501 | - } else { |
502 | - ofono_error("Reply failure: %s", |
503 | + /* Error, and no data */ |
504 | + if (message->error != RIL_E_SUCCESS && message->buf_len == 0) { |
505 | + ofono_error("%s: Reply failure: %s", __func__, |
506 | ril_error_to_string(message->error)); |
507 | decode_ril_error(&error, "FAIL"); |
508 | goto error; |
509 | } |
510 | |
511 | - if ((reply = g_ril_reply_parse_sim_io(sd->ril, message)) |
512 | - == NULL) { |
513 | - ofono_error("Can't parse SIM IO response from RILD"); |
514 | + /* |
515 | + * The reply can have event data even when message->error is not zero |
516 | + * in mako. |
517 | + */ |
518 | + reply = g_ril_reply_parse_sim_io(sd->ril, message); |
519 | + if (reply == NULL) { |
520 | decode_ril_error(&error, "FAIL"); |
521 | goto error; |
522 | } |
523 | |
524 | sw1 = reply->sw1; |
525 | sw2 = reply->sw2; |
526 | + |
527 | + /* |
528 | + * SIM app file not found || USIM app file not found |
529 | + * See 3gpp TS 51.011, 9.4.4, and ETSI TS 102 221, 10.2.1.5.3 |
530 | + * This can happen with result SUCCESS (maguro) or GENERIC_FAILURE |
531 | + * (mako) |
532 | + */ |
533 | + if ((sw1 == 0x94 && sw2 == 0x04) || (sw1 == 0x6A && sw2 == 0x82)) { |
534 | + DBG("File not found. Error %s", |
535 | + ril_error_to_string(message->error)); |
536 | + decode_ril_error(&error, "FAIL"); |
537 | + goto error; |
538 | + } |
539 | + |
540 | + if (message->error == RIL_E_SUCCESS) { |
541 | + decode_ril_error(&error, "OK"); |
542 | + } else { |
543 | + ofono_error("%s: Reply failure: %s, %02x, %02x", __func__, |
544 | + ril_error_to_string(message->error), sw1, sw2); |
545 | + decode_ril_error(&error, "FAIL"); |
546 | + goto error; |
547 | + } |
548 | + |
549 | if ((sw1 != 0x90 && sw1 != 0x91 && sw1 != 0x92 && sw1 != 0x9f) || |
550 | (sw1 == 0x90 && sw2 != 0x00)) { |
551 | ofono_error("Error reply, invalid values: sw1: %02x sw2: %02x", |
552 | @@ -124,7 +149,7 @@ |
553 | error.type = OFONO_ERROR_TYPE_SIM; |
554 | error.error = (sw1 << 8) | sw2; |
555 | |
556 | - goto err_aft_reply; |
557 | + goto error; |
558 | } |
559 | |
560 | if (reply->hex_len) { |
561 | @@ -142,9 +167,9 @@ |
562 | } |
563 | |
564 | if (!ok) { |
565 | - ofono_error("parse response failed"); |
566 | + ofono_error("%s: parse response failed", __func__); |
567 | decode_ril_error(&error, "FAIL"); |
568 | - goto err_aft_reply; |
569 | + goto error; |
570 | } |
571 | |
572 | cb(&error, flen, str, rlen, access, file_status, cbd->data); |
573 | @@ -153,9 +178,9 @@ |
574 | |
575 | return; |
576 | |
577 | -err_aft_reply: |
578 | - g_ril_reply_free_sim_io(reply); |
579 | error: |
580 | + g_ril_reply_free_sim_io(reply); |
581 | + |
582 | cb(&error, -1, -1, -1, NULL, EF_STATUS_INVALIDATED, cbd->data); |
583 | } |
584 | |
585 | @@ -171,6 +196,8 @@ |
586 | int request = RIL_REQUEST_SIM_IO; |
587 | guint ret = 0; |
588 | |
589 | + DBG("file %04x", fileid); |
590 | + |
591 | req.app_type = sd->app_type; |
592 | req.aid_str = sd->aid_str; |
593 | req.fileid = fileid; |
594 | @@ -252,6 +279,8 @@ |
595 | int request = RIL_REQUEST_SIM_IO; |
596 | guint ret = 0; |
597 | |
598 | + DBG("file %04x", fileid); |
599 | + |
600 | req.app_type = sd->app_type; |
601 | req.aid_str = sd->aid_str; |
602 | req.fileid = fileid; |
603 | @@ -303,6 +332,8 @@ |
604 | int request = RIL_REQUEST_SIM_IO; |
605 | guint ret = 0; |
606 | |
607 | + DBG("file %04x", fileid); |
608 | + |
609 | req.app_type = sd->app_type; |
610 | req.aid_str = sd->aid_str; |
611 | req.fileid = fileid; |
612 | @@ -405,6 +436,8 @@ |
613 | struct reply_sim_app *app, |
614 | guint index) |
615 | { |
616 | + g_free(sd->aid_str); |
617 | + g_free(sd->app_str); |
618 | sd->app_type = app->app_type; |
619 | sd->aid_str = g_strdup(app->aid_str); |
620 | sd->app_str = g_strdup(app->app_str); |
621 | @@ -803,6 +836,8 @@ |
622 | ofono_sim_set_data(sim, NULL); |
623 | |
624 | g_ril_unref(sd->ril); |
625 | + g_free(sd->aid_str); |
626 | + g_free(sd->app_str); |
627 | g_free(sd); |
628 | } |
629 | |
630 | |
631 | === modified file 'drivers/rilmodem/sms.c' |
632 | --- drivers/rilmodem/sms.c 2013-11-06 03:59:35 +0000 |
633 | +++ drivers/rilmodem/sms.c 2013-12-04 21:58:23 +0000 |
634 | @@ -3,7 +3,8 @@ |
635 | * oFono - Open Source Telephony - RIL Modem Support |
636 | * |
637 | * Copyright (C) 2008-2011 Intel Corporation. All rights reserved. |
638 | - * Copyright (C) 2012 Canonical Ltd. |
639 | + * Copyright (C) 2012-2013 Canonical Ltd. |
640 | + * Copyright (C) 2013 Jolla Ltd. |
641 | * |
642 | * This program is free software; you can redistribute it and/or modify |
643 | * it under the terms of the GNU General Public License version 2 as |
644 | @@ -41,13 +42,103 @@ |
645 | #include "util.h" |
646 | |
647 | #include "rilmodem.h" |
648 | +#include "grilrequest.h" |
649 | +#include "grilreply.h" |
650 | +#include "grilunsol.h" |
651 | |
652 | struct sms_data { |
653 | - GRil *ril; |
654 | + GRil *ril; |
655 | unsigned int vendor; |
656 | }; |
657 | |
658 | -static void submit_sms_cb(struct ril_msg *message, gpointer user_data) |
659 | +static void ril_csca_set_cb(struct ril_msg *message, gpointer user_data) |
660 | +{ |
661 | + struct cb_data *cbd = user_data; |
662 | + ofono_sms_sca_set_cb_t cb = cbd->cb; |
663 | + |
664 | + if (message->error == RIL_E_SUCCESS) { |
665 | + CALLBACK_WITH_SUCCESS(cb, cbd->data); |
666 | + } else { |
667 | + ofono_error("%s RILD reply failure: %s", |
668 | + ril_request_id_to_string(message->req), |
669 | + ril_error_to_string(message->error)); |
670 | + CALLBACK_WITH_FAILURE(cb, cbd->data); |
671 | + } |
672 | +} |
673 | + |
674 | +static void ril_csca_set(struct ofono_sms *sms, |
675 | + const struct ofono_phone_number *sca, |
676 | + ofono_sms_sca_set_cb_t cb, void *user_data) |
677 | +{ |
678 | + struct sms_data *sd = ofono_sms_get_data(sms); |
679 | + struct cb_data *cbd = cb_data_new(cb, user_data, sd); |
680 | + struct parcel rilp; |
681 | + gint ret; |
682 | + int request = RIL_REQUEST_SET_SMSC_ADDRESS; |
683 | + |
684 | + g_ril_request_set_smsc_address(sd->ril, sca, &rilp); |
685 | + |
686 | + /* Send request to RIL */ |
687 | + ret = g_ril_send(sd->ril, request, rilp.data, |
688 | + rilp.size, ril_csca_set_cb, cbd, g_free); |
689 | + |
690 | + g_ril_print_request(sd->ril, ret, request); |
691 | + |
692 | + parcel_free(&rilp); |
693 | + |
694 | + /* In case of error free cbd and return the cb with failure */ |
695 | + if (ret == 0) { |
696 | + g_free(cbd); |
697 | + CALLBACK_WITH_FAILURE(cb, user_data); |
698 | + } |
699 | +} |
700 | + |
701 | +static void ril_csca_query_cb(struct ril_msg *message, gpointer user_data) |
702 | +{ |
703 | + struct cb_data *cbd = user_data; |
704 | + ofono_sms_sca_query_cb_t cb = cbd->cb; |
705 | + struct sms_data *sd = cbd->user; |
706 | + struct ofono_phone_number *sca; |
707 | + |
708 | + if (message->error != RIL_E_SUCCESS) { |
709 | + ofono_error("%s RILD reply failure: %s", |
710 | + ril_request_id_to_string(message->req), |
711 | + ril_error_to_string(message->error)); |
712 | + CALLBACK_WITH_FAILURE(cb, NULL, cbd->data); |
713 | + return; |
714 | + } |
715 | + |
716 | + sca = g_ril_reply_parse_get_smsc_address(sd->ril, message); |
717 | + if (sca == NULL) { |
718 | + CALLBACK_WITH_FAILURE(cb, NULL, cbd->data); |
719 | + } else { |
720 | + CALLBACK_WITH_SUCCESS(cb, sca, cbd->data); |
721 | + g_free(sca); |
722 | + } |
723 | +} |
724 | + |
725 | +static void ril_csca_query(struct ofono_sms *sms, ofono_sms_sca_query_cb_t cb, |
726 | + void *user_data) |
727 | +{ |
728 | + struct sms_data *sd = ofono_sms_get_data(sms); |
729 | + struct cb_data *cbd = cb_data_new(cb, user_data, sd); |
730 | + int request = RIL_REQUEST_GET_SMSC_ADDRESS; |
731 | + int ret; |
732 | + |
733 | + DBG("Sending csca_query"); |
734 | + |
735 | + ret = g_ril_send(sd->ril, request, NULL, 0, |
736 | + ril_csca_query_cb, cbd, g_free); |
737 | + |
738 | + g_ril_print_request(sd->ril, ret, request); |
739 | + |
740 | + if (ret == 0) { |
741 | + g_free(cbd); |
742 | + CALLBACK_WITH_FAILURE(cb, NULL, user_data); |
743 | + } |
744 | +} |
745 | + |
746 | +static void ril_submit_sms_cb(struct ril_msg *message, gpointer user_data) |
747 | { |
748 | struct cb_data *cbd = user_data; |
749 | struct ofono_error error; |
750 | @@ -61,7 +152,7 @@ |
751 | decode_ril_error(&error, "FAIL"); |
752 | } |
753 | |
754 | - mr = ril_util_parse_sms_response(sd->ril, message); |
755 | + mr = g_ril_reply_parse_sms_response(sd->ril, message); |
756 | |
757 | cb(&error, mr, cbd->data); |
758 | } |
759 | @@ -73,127 +164,105 @@ |
760 | struct sms_data *sd = ofono_sms_get_data(sms); |
761 | struct cb_data *cbd = cb_data_new(cb, user_data, sd); |
762 | struct parcel rilp; |
763 | - char *tpdu; |
764 | int request = RIL_REQUEST_SEND_SMS; |
765 | - int ret, smsc_len; |
766 | + int ret; |
767 | + struct req_sms_cmgs req; |
768 | |
769 | - DBG("pdu_len: %d, tpdu_len: %d mms: %d", pdu_len, tpdu_len, mms); |
770 | + DBG("pdu_len: %d, tpdu_len: %d mms: %d", pdu_len, tpdu_len, mms); |
771 | |
772 | /* TODO: if (mms) { ... } */ |
773 | |
774 | - parcel_init(&rilp); |
775 | - parcel_w_int32(&rilp, 2); /* Number of strings */ |
776 | - |
777 | - /* SMSC address: |
778 | - * |
779 | - * smsc_len == 1, then zero-length SMSC was spec'd |
780 | - * RILD expects a NULL string in this case instead |
781 | - * of a zero-length string. |
782 | - */ |
783 | - smsc_len = pdu_len - tpdu_len; |
784 | - if (smsc_len > 1) { |
785 | - /* TODO: encode SMSC & write to parcel */ |
786 | - DBG("SMSC address specified (smsc_len %d); NOT-IMPLEMENTED", smsc_len); |
787 | - } |
788 | - |
789 | - parcel_w_string(&rilp, NULL); /* SMSC address; NULL == default */ |
790 | - |
791 | - /* TPDU: |
792 | - * |
793 | - * 'pdu' is a raw hexadecimal string |
794 | - * encode_hex() turns it into an ASCII/hex UTF8 buffer |
795 | - * parcel_w_string() encodes utf8 -> utf16 |
796 | - */ |
797 | - tpdu = encode_hex(pdu + smsc_len, tpdu_len, 0); |
798 | - parcel_w_string(&rilp, tpdu); |
799 | + req.pdu = pdu; |
800 | + req.pdu_len = pdu_len; |
801 | + req.tpdu_len = tpdu_len; |
802 | + |
803 | + g_ril_request_sms_cmgs(sd->ril, &req, &rilp); |
804 | |
805 | ret = g_ril_send(sd->ril, |
806 | request, |
807 | rilp.data, |
808 | rilp.size, |
809 | - submit_sms_cb, cbd, g_free); |
810 | + ril_submit_sms_cb, cbd, g_free); |
811 | |
812 | - g_ril_append_print_buf(sd->ril, "(%s)", tpdu); |
813 | g_ril_print_request(sd->ril, ret, request); |
814 | |
815 | parcel_free(&rilp); |
816 | |
817 | - if (ret <= 0) { |
818 | + if (ret == 0) { |
819 | g_free(cbd); |
820 | CALLBACK_WITH_FAILURE(cb, -1, user_data); |
821 | } |
822 | } |
823 | |
824 | +static void ril_ack_delivery_cb(struct ril_msg *message, gpointer user_data) |
825 | +{ |
826 | + if (message->error != RIL_E_SUCCESS) |
827 | + ofono_error("SMS acknowledgement failed: " |
828 | + "Further SMS reception is not guaranteed"); |
829 | +} |
830 | + |
831 | +static void ril_ack_delivery(struct ofono_sms *sms) |
832 | +{ |
833 | + struct sms_data *sd = ofono_sms_get_data(sms); |
834 | + struct parcel rilp; |
835 | + int ret; |
836 | + int request = RIL_REQUEST_SMS_ACKNOWLEDGE; |
837 | + |
838 | + g_ril_request_sms_acknowledge(sd->ril, &rilp); |
839 | + |
840 | + /* TODO: should ACK be sent for either of the error cases? */ |
841 | + |
842 | + /* ACK the incoming NEW_SMS */ |
843 | + ret = g_ril_send(sd->ril, request, |
844 | + rilp.data, |
845 | + rilp.size, |
846 | + ril_ack_delivery_cb, NULL, NULL); |
847 | + |
848 | + g_ril_print_request(sd->ril, ret, request); |
849 | + |
850 | + parcel_free(&rilp); |
851 | +} |
852 | + |
853 | static void ril_sms_notify(struct ril_msg *message, gpointer user_data) |
854 | { |
855 | struct ofono_sms *sms = user_data; |
856 | struct sms_data *sd = ofono_sms_get_data(sms); |
857 | - struct parcel rilp; |
858 | - char *ril_pdu; |
859 | - int ril_pdu_len; |
860 | unsigned int smsc_len; |
861 | long ril_buf_len; |
862 | - guchar *ril_data; |
863 | - int request = RIL_REQUEST_SMS_ACKNOWLEDGE; |
864 | - int ret; |
865 | + struct unsol_sms_data *pdu_data; |
866 | |
867 | DBG("req: %d; data_len: %d", message->req, (int) message->buf_len); |
868 | |
869 | - if (message->req != RIL_UNSOL_RESPONSE_NEW_SMS) |
870 | - goto error; |
871 | - |
872 | - |
873 | - ril_util_init_parcel(message, &rilp); |
874 | - |
875 | - ril_pdu = parcel_r_string(&rilp); |
876 | - if (ril_pdu == NULL) |
877 | - goto error; |
878 | - |
879 | - ril_pdu_len = strlen(ril_pdu); |
880 | - |
881 | - DBG("ril_pdu_len is %d", ril_pdu_len); |
882 | - ril_data = decode_hex(ril_pdu, ril_pdu_len, &ril_buf_len, -1); |
883 | - if (ril_data == NULL) |
884 | - goto error; |
885 | - |
886 | - /* The first octect in the pdu contains the SMSC address length |
887 | + pdu_data = g_ril_unsol_parse_new_sms(sd->ril, message); |
888 | + if (pdu_data == NULL) |
889 | + goto error; |
890 | + |
891 | + /* |
892 | + * The first octect in the pdu contains the SMSC address length |
893 | * which is the X following octects it reads. We add 1 octet to |
894 | * the read length to take into account this read octet in order |
895 | * to calculate the proper tpdu length. |
896 | */ |
897 | - smsc_len = ril_data[0] + 1; |
898 | + smsc_len = pdu_data->data[0] + 1; |
899 | + ril_buf_len = pdu_data->length; |
900 | DBG("smsc_len is %d", smsc_len); |
901 | |
902 | - g_ril_append_print_buf(sd->ril, "(%s)", ril_pdu); |
903 | - g_ril_print_unsol(sd->ril, message); |
904 | - |
905 | - /* Last parameter is 'tpdu_len' ( substract SMSC length ) */ |
906 | - ofono_sms_deliver_notify(sms, ril_data, |
907 | - ril_buf_len, |
908 | - ril_buf_len - smsc_len); |
909 | - |
910 | - /* Re-use rilp, so initilize */ |
911 | - parcel_init(&rilp); |
912 | - parcel_w_int32(&rilp, 2); /* Number of int32 values in array */ |
913 | - parcel_w_int32(&rilp, 1); /* Successful receipt */ |
914 | - parcel_w_int32(&rilp, 0); /* error code */ |
915 | - |
916 | - /* TODO: should ACK be sent for either of the error cases? */ |
917 | - |
918 | - /* ACK the incoming NEW_SMS; ignore response so no cb needed */ |
919 | - ret = g_ril_send(sd->ril, request, |
920 | - rilp.data, |
921 | - rilp.size, |
922 | - NULL, NULL, NULL); |
923 | - |
924 | - g_ril_append_print_buf(sd->ril, "(1,0)"); |
925 | - g_ril_print_request(sd->ril, ret, request); |
926 | - |
927 | - parcel_free(&rilp); |
928 | - return; |
929 | + if (message->req == RIL_UNSOL_RESPONSE_NEW_SMS) |
930 | + /* Last parameter is 'tpdu_len' ( substract SMSC length ) */ |
931 | + ofono_sms_deliver_notify(sms, pdu_data->data, |
932 | + ril_buf_len, |
933 | + ril_buf_len - smsc_len); |
934 | + else if (message->req == RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT) |
935 | + ofono_sms_status_notify(sms, pdu_data->data, ril_buf_len, |
936 | + ril_buf_len - smsc_len); |
937 | + |
938 | + /* ACK the incoming NEW_SMS */ |
939 | + ril_ack_delivery(sms); |
940 | + |
941 | + g_ril_unsol_free_sms_data(pdu_data); |
942 | |
943 | error: |
944 | - ofono_error("Unable to parse NEW_SMS notification"); |
945 | + ; |
946 | } |
947 | |
948 | static gboolean ril_delayed_register(gpointer user_data) |
949 | @@ -204,12 +273,14 @@ |
950 | DBG(""); |
951 | ofono_sms_register(sms); |
952 | |
953 | - /* register to receive INCOMING_SMS */ |
954 | + /* register to receive INCOMING_SMS and SMS status reports */ |
955 | g_ril_register(data->ril, RIL_UNSOL_RESPONSE_NEW_SMS, |
956 | ril_sms_notify, sms); |
957 | + g_ril_register(data->ril, RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT, |
958 | + ril_sms_notify, sms); |
959 | |
960 | - /* This makes the timeout a single-shot */ |
961 | - return FALSE; |
962 | + /* This makes the delayed call a single-shot */ |
963 | + return FALSE; |
964 | } |
965 | |
966 | static int ril_sms_probe(struct ofono_sms *sms, unsigned int vendor, |
967 | @@ -224,17 +295,14 @@ |
968 | |
969 | ofono_sms_set_data(sms, data); |
970 | |
971 | - /* |
972 | - * TODO: analyze if capability check is needed |
973 | - * and/or timer should be adjusted. |
974 | - * |
975 | + /* |
976 | * ofono_sms_register() needs to be called after |
977 | * the driver has been set in ofono_sms_create(), which |
978 | * calls this function. Most other drivers make some |
979 | * kind of capabilities query to the modem, and then |
980 | - * call register in the callback; we use a timer instead. |
981 | + * call register in the callback; we use an idle add instead. |
982 | */ |
983 | - g_timeout_add_seconds(2, ril_delayed_register, sms); |
984 | + g_idle_add(ril_delayed_register, sms); |
985 | |
986 | return 0; |
987 | } |
988 | @@ -243,7 +311,7 @@ |
989 | { |
990 | struct sms_data *data = ofono_sms_get_data(sms); |
991 | |
992 | - DBG(""); |
993 | + DBG(""); |
994 | |
995 | g_ril_unref(data->ril); |
996 | g_free(data); |
997 | @@ -254,13 +322,13 @@ |
998 | static struct ofono_sms_driver driver = { |
999 | .name = RILMODEM, |
1000 | .probe = ril_sms_probe, |
1001 | + .sca_query = ril_csca_query, |
1002 | + .sca_set = ril_csca_set, |
1003 | .remove = ril_sms_remove, |
1004 | .submit = ril_cmgs, |
1005 | |
1006 | /* |
1007 | * TODO: investigate/implement: |
1008 | - * .sca_query = NULL, |
1009 | - * .sca_set = NULL, |
1010 | * .bearer_query = NULL, |
1011 | * .bearer_set = NULL, |
1012 | */ |
1013 | |
1014 | === modified file 'drivers/rilmodem/voicecall.c' |
1015 | --- drivers/rilmodem/voicecall.c 2013-11-06 03:59:35 +0000 |
1016 | +++ drivers/rilmodem/voicecall.c 2013-12-04 21:58:23 +0000 |
1017 | @@ -3,7 +3,8 @@ |
1018 | * oFono - Open Source Telephony |
1019 | * |
1020 | * Copyright (C) 2008-2011 Intel Corporation. All rights reserved. |
1021 | - * Copyright (C) 2012 Canonical Ltd. |
1022 | + * Copyright (C) 2012-2013 Canonical Ltd. |
1023 | + * Copyright (C) 2013 Jolla Ltd. |
1024 | * |
1025 | * This program is free software; you can redistribute it and/or modify |
1026 | * it under the terms of the GNU General Public License version 2 as |
1027 | @@ -38,6 +39,9 @@ |
1028 | |
1029 | #include "gril.h" |
1030 | #include "grilutil.h" |
1031 | +#include "grilrequest.h" |
1032 | +#include "grilreply.h" |
1033 | +#include "grilunsol.h" |
1034 | |
1035 | #include "common.h" |
1036 | #include "rilmodem.h" |
1037 | @@ -45,21 +49,25 @@ |
1038 | /* Amount of ms we wait between CLCC calls */ |
1039 | #define POLL_CLCC_INTERVAL 300 |
1040 | |
1041 | -/* When +VTD returns 0, an unspecified manufacturer-specific delay is used */ |
1042 | -#define TONE_DURATION 1000 |
1043 | - |
1044 | #define FLAG_NEED_CLIP 1 |
1045 | |
1046 | +#define MAX_DTMF_BUFFER 32 |
1047 | + |
1048 | +/* To use with change_state_req::affected_types */ |
1049 | +#define AFFECTED_STATES_ALL 0x3F |
1050 | + |
1051 | struct voicecall_data { |
1052 | GSList *calls; |
1053 | + /* Call local hangup indicator, one bit per call (1 << call_id) */ |
1054 | unsigned int local_release; |
1055 | unsigned int clcc_source; |
1056 | GRil *ril; |
1057 | unsigned int vendor; |
1058 | - unsigned int tone_duration; |
1059 | - guint vts_source; |
1060 | - unsigned int vts_delay; |
1061 | unsigned char flags; |
1062 | + ofono_voicecall_cb_t cb; |
1063 | + void *data; |
1064 | + gchar *tone_queue; |
1065 | + gboolean tone_pending; |
1066 | }; |
1067 | |
1068 | struct release_id_req { |
1069 | @@ -73,9 +81,32 @@ |
1070 | struct ofono_voicecall *vc; |
1071 | ofono_voicecall_cb_t cb; |
1072 | void *data; |
1073 | + /* Call states affected by a local release (1 << enum call_status) */ |
1074 | int affected_types; |
1075 | }; |
1076 | |
1077 | +struct lastcause_req { |
1078 | + struct ofono_voicecall *vc; |
1079 | + int id; |
1080 | +}; |
1081 | + |
1082 | +static void send_one_dtmf(struct voicecall_data *vd); |
1083 | +static void clear_dtmf_queue(struct voicecall_data *vd); |
1084 | + |
1085 | +static void lastcause_cb(struct ril_msg *message, gpointer user_data) |
1086 | +{ |
1087 | + struct lastcause_req *reqdata = user_data; |
1088 | + struct ofono_voicecall *vc = reqdata->vc; |
1089 | + struct voicecall_data *vd = ofono_voicecall_get_data(vc); |
1090 | + enum ofono_disconnect_reason reason; |
1091 | + |
1092 | + reason = g_ril_reply_parse_call_fail_cause(vd->ril, message); |
1093 | + |
1094 | + DBG("Call %d ended with reason %d", reqdata->id, reason); |
1095 | + |
1096 | + ofono_voicecall_disconnected(vc, reqdata->id, reason, NULL); |
1097 | +} |
1098 | + |
1099 | static void clcc_poll_cb(struct ril_msg *message, gpointer user_data) |
1100 | { |
1101 | struct ofono_voicecall *vc = user_data; |
1102 | @@ -90,7 +121,7 @@ |
1103 | return; |
1104 | } |
1105 | |
1106 | - calls = ril_util_parse_clcc(vd->ril, message); |
1107 | + calls = g_ril_reply_parse_get_calls(vd->ril, message); |
1108 | |
1109 | n = calls; |
1110 | o = vd->calls; |
1111 | @@ -99,23 +130,44 @@ |
1112 | nc = n ? n->data : NULL; |
1113 | oc = o ? o->data : NULL; |
1114 | |
1115 | + /* TODO: Add comments explaining call id handling */ |
1116 | if (oc && (nc == NULL || (nc->id > oc->id))) { |
1117 | - enum ofono_disconnect_reason reason; |
1118 | - |
1119 | - if (vd->local_release & (1 << oc->id)) |
1120 | - reason = OFONO_DISCONNECT_REASON_LOCAL_HANGUP; |
1121 | - else |
1122 | - reason = OFONO_DISCONNECT_REASON_REMOTE_HANGUP; |
1123 | - |
1124 | - if (oc->type) |
1125 | + if (vd->local_release & (1 << oc->id)) { |
1126 | ofono_voicecall_disconnected(vc, oc->id, |
1127 | - reason, NULL); |
1128 | + OFONO_DISCONNECT_REASON_LOCAL_HANGUP, |
1129 | + NULL); |
1130 | + } else { |
1131 | + /* Get disconnect cause before calling core */ |
1132 | + struct lastcause_req *reqdata = |
1133 | + g_try_new0(struct lastcause_req, 1); |
1134 | + if (reqdata) { |
1135 | + int req; |
1136 | + req = RIL_REQUEST_LAST_CALL_FAIL_CAUSE; |
1137 | + reqdata->vc = user_data; |
1138 | + reqdata->id = oc->id; |
1139 | + g_ril_send(vd->ril, req, |
1140 | + NULL, 0, lastcause_cb, |
1141 | + reqdata, g_free); |
1142 | + } |
1143 | + } |
1144 | + |
1145 | + clear_dtmf_queue(vd); |
1146 | |
1147 | o = o->next; |
1148 | } else if (nc && (oc == NULL || (nc->id < oc->id))) { |
1149 | /* new call, signal it */ |
1150 | - if (nc->type) |
1151 | + if (nc->type) { |
1152 | ofono_voicecall_notify(vc, nc); |
1153 | + if (vd->cb) { |
1154 | + struct ofono_error error; |
1155 | + ofono_voicecall_cb_t cb = vd->cb; |
1156 | + decode_ril_error(&error, "OK"); |
1157 | + cb(&error, vd->data); |
1158 | + vd->cb = NULL; |
1159 | + vd->data = NULL; |
1160 | + } |
1161 | + |
1162 | + } |
1163 | |
1164 | n = n->next; |
1165 | } else { |
1166 | @@ -213,7 +265,7 @@ |
1167 | |
1168 | out: |
1169 | ret = g_ril_send(vd->ril, request, NULL, |
1170 | - 0, clcc_poll_cb, req->vc, NULL); |
1171 | + 0, clcc_poll_cb, req->vc, NULL); |
1172 | |
1173 | g_ril_print_request_no_args(vd->ril, ret, request); |
1174 | |
1175 | @@ -285,6 +337,13 @@ |
1176 | if (!vd->clcc_source) |
1177 | vd->clcc_source = g_timeout_add(POLL_CLCC_INTERVAL, |
1178 | poll_clcc, vc); |
1179 | + |
1180 | + /* we cannot answer just yet since we don't know the call id */ |
1181 | + vd->cb = cb; |
1182 | + vd->data = cbd->data; |
1183 | + |
1184 | + return; |
1185 | + |
1186 | out: |
1187 | cb(&error, cbd->data); |
1188 | } |
1189 | @@ -300,25 +359,12 @@ |
1190 | int request = RIL_REQUEST_DIAL; |
1191 | int ret; |
1192 | |
1193 | - parcel_init(&rilp); |
1194 | - |
1195 | - /* Number to dial */ |
1196 | - parcel_w_string(&rilp, phone_number_to_string(ph)); |
1197 | - /* CLIR mode */ |
1198 | - parcel_w_int32(&rilp, clir); |
1199 | - /* USS, need it twice for absent */ |
1200 | - /* TODO: Deal with USS properly */ |
1201 | - parcel_w_int32(&rilp, 0); |
1202 | - parcel_w_int32(&rilp, 0); |
1203 | + g_ril_request_dial(vd->ril, ph, clir, &rilp); |
1204 | |
1205 | /* Send request to RIL */ |
1206 | ret = g_ril_send(vd->ril, request, rilp.data, |
1207 | rilp.size, rild_cb, cbd, g_free); |
1208 | |
1209 | - g_ril_append_print_buf(vd->ril, "(%s,%d,0,0)", |
1210 | - phone_number_to_string(ph), |
1211 | - clir); |
1212 | - |
1213 | g_ril_print_request(vd->ril, ret, request); |
1214 | |
1215 | parcel_free(&rilp); |
1216 | @@ -331,7 +377,7 @@ |
1217 | } |
1218 | |
1219 | static void ril_hangup_all(struct ofono_voicecall *vc, |
1220 | - ofono_voicecall_cb_t cb, void *data) |
1221 | + ofono_voicecall_cb_t cb, void *data) |
1222 | { |
1223 | struct voicecall_data *vd = ofono_voicecall_get_data(vc); |
1224 | struct parcel rilp; |
1225 | @@ -345,15 +391,12 @@ |
1226 | call = l->data; |
1227 | /* TODO: Hangup just the active ones once we have call |
1228 | * state tracking (otherwise it can't handle ringing) */ |
1229 | - parcel_init(&rilp); |
1230 | - parcel_w_int32(&rilp, 1); /* Always 1 - AT+CHLD=1x */ |
1231 | - parcel_w_int32(&rilp, call->id); |
1232 | + g_ril_request_hangup(vd->ril, call->id, &rilp); |
1233 | |
1234 | /* Send request to RIL */ |
1235 | - ret = ril_template(request, vc, generic_cb, 0x3f, |
1236 | + ret = ril_template(request, vc, generic_cb, AFFECTED_STATES_ALL, |
1237 | rilp.data, rilp.size, NULL, NULL); |
1238 | |
1239 | - g_ril_append_print_buf(vd->ril, "(%d)", call->id); |
1240 | g_ril_print_request(vd->ril, ret, request); |
1241 | |
1242 | parcel_free(&rilp); |
1243 | @@ -364,6 +407,27 @@ |
1244 | cb(&error, data); |
1245 | } |
1246 | |
1247 | +static void ril_hangup_specific(struct ofono_voicecall *vc, |
1248 | + int id, ofono_voicecall_cb_t cb, void *data) |
1249 | +{ |
1250 | + struct voicecall_data *vd = ofono_voicecall_get_data(vc); |
1251 | + struct parcel rilp; |
1252 | + int request = RIL_REQUEST_HANGUP; |
1253 | + int ret; |
1254 | + |
1255 | + DBG("Hanging up call with id %d", id); |
1256 | + |
1257 | + g_ril_request_hangup(vd->ril, id, &rilp); |
1258 | + |
1259 | + /* Send request to RIL */ |
1260 | + ret = ril_template(request, vc, generic_cb, AFFECTED_STATES_ALL, |
1261 | + rilp.data, rilp.size, cb, data); |
1262 | + |
1263 | + g_ril_print_request(vd->ril, ret, request); |
1264 | + |
1265 | + parcel_free(&rilp); |
1266 | +} |
1267 | + |
1268 | static void ril_call_state_notify(struct ril_msg *message, gpointer user_data) |
1269 | { |
1270 | struct ofono_voicecall *vc = user_data; |
1271 | @@ -380,6 +444,32 @@ |
1272 | ofono_error("Unable to notify about call state changes"); |
1273 | } |
1274 | |
1275 | +static void ril_ss_notify(struct ril_msg *message, gpointer user_data) |
1276 | +{ |
1277 | + struct ofono_voicecall *vc = user_data; |
1278 | + struct voicecall_data *vd = ofono_voicecall_get_data(vc); |
1279 | + struct unsol_supp_svc_notif *unsol; |
1280 | + |
1281 | + unsol = g_ril_unsol_parse_supp_svc_notif(vd->ril, message); |
1282 | + if (unsol == NULL) { |
1283 | + ofono_error("%s: Parsing error", __func__); |
1284 | + return; |
1285 | + } |
1286 | + |
1287 | + DBG("RIL data: MT/MO: %i, code: %i, index: %i", |
1288 | + unsol->notif_type, unsol->code, unsol->index); |
1289 | + |
1290 | + /* 0 stands for MO intermediate, 1 for MT unsolicited */ |
1291 | + /* TODO How do we know the affected call? Refresh call list? */ |
1292 | + if (unsol->notif_type == 1) |
1293 | + ofono_voicecall_ssn_mt_notify( |
1294 | + vc, 0, unsol->code, unsol->index, &unsol->number); |
1295 | + else |
1296 | + ofono_voicecall_ssn_mo_notify(vc, 0, unsol->code, unsol->index); |
1297 | + |
1298 | + g_ril_unsol_free_supp_svc_notif(unsol); |
1299 | +} |
1300 | + |
1301 | static void ril_answer(struct ofono_voicecall *vc, |
1302 | ofono_voicecall_cb_t cb, void *data) |
1303 | { |
1304 | @@ -396,46 +486,192 @@ |
1305 | g_ril_print_request_no_args(vd->ril, ret, request); |
1306 | } |
1307 | |
1308 | +static void ril_send_dtmf_cb(struct ril_msg *message, gpointer user_data) |
1309 | +{ |
1310 | + struct voicecall_data *vd = user_data; |
1311 | + |
1312 | + if (message->error == RIL_E_SUCCESS) { |
1313 | + /* Remove sent DTMF character from queue */ |
1314 | + gchar *tmp_tone_queue = g_strdup(vd->tone_queue + 1); |
1315 | + int remaining = strlen(tmp_tone_queue); |
1316 | + |
1317 | + memcpy(vd->tone_queue, tmp_tone_queue, remaining); |
1318 | + vd->tone_queue[remaining] = '\0'; |
1319 | + g_free(tmp_tone_queue); |
1320 | + |
1321 | + vd->tone_pending = FALSE; |
1322 | + |
1323 | + if (remaining > 0) |
1324 | + send_one_dtmf(vd); |
1325 | + } else { |
1326 | + DBG("error=%d", message->error); |
1327 | + clear_dtmf_queue(vd); |
1328 | + } |
1329 | +} |
1330 | + |
1331 | +static void send_one_dtmf(struct voicecall_data *vd) |
1332 | +{ |
1333 | + struct parcel rilp; |
1334 | + int request = RIL_REQUEST_DTMF; |
1335 | + int ret; |
1336 | + |
1337 | + if (vd->tone_pending == TRUE) |
1338 | + return; /* RIL request pending */ |
1339 | + |
1340 | + if (strlen(vd->tone_queue) == 0) |
1341 | + return; /* nothing to send */ |
1342 | + |
1343 | + g_ril_request_dtmf(vd->ril, vd->tone_queue[0], &rilp); |
1344 | + |
1345 | + ret = g_ril_send(vd->ril, request, rilp.data, |
1346 | + rilp.size, ril_send_dtmf_cb, vd, NULL); |
1347 | + |
1348 | + g_ril_print_request(vd->ril, ret, request); |
1349 | + parcel_free(&rilp); |
1350 | + |
1351 | + vd->tone_pending = TRUE; |
1352 | +} |
1353 | + |
1354 | static void ril_send_dtmf(struct ofono_voicecall *vc, const char *dtmf, |
1355 | ofono_voicecall_cb_t cb, void *data) |
1356 | { |
1357 | struct voicecall_data *vd = ofono_voicecall_get_data(vc); |
1358 | - int len = strlen(dtmf); |
1359 | - struct parcel rilp; |
1360 | struct ofono_error error; |
1361 | - char *ril_dtmf = g_try_malloc(sizeof(char) * 2); |
1362 | - int request = RIL_REQUEST_DTMF; |
1363 | - int i, ret; |
1364 | - |
1365 | - DBG(""); |
1366 | - |
1367 | - /* Ril wants just one character, but we need to send as string */ |
1368 | - ril_dtmf[1] = '\0'; |
1369 | - |
1370 | - for (i = 0; i < len; i++) { |
1371 | - parcel_init(&rilp); |
1372 | - ril_dtmf[0] = dtmf[i]; |
1373 | - parcel_w_string(&rilp, ril_dtmf); |
1374 | - |
1375 | - ret = g_ril_send(vd->ril, request, rilp.data, |
1376 | - rilp.size, NULL, NULL, NULL); |
1377 | - |
1378 | - g_ril_append_print_buf(vd->ril, "(%s)", ril_dtmf); |
1379 | - g_ril_print_request(vd->ril, ret, request); |
1380 | - parcel_free(&rilp); |
1381 | - |
1382 | - /* TODO: should we break out of look on failure? */ |
1383 | - if (ret <= 0) |
1384 | - ofono_error("send REQUEST_DTMF failed"); |
1385 | - } |
1386 | - |
1387 | - free(ril_dtmf); |
1388 | + |
1389 | + DBG("Queue '%s'", dtmf); |
1390 | + |
1391 | + /* |
1392 | + * Queue any incoming DTMF (up to MAX_DTMF_BUFFER characters), |
1393 | + * send them to RIL one-by-one, immediately call back |
1394 | + * core with no error |
1395 | + */ |
1396 | + g_strlcat(vd->tone_queue, dtmf, MAX_DTMF_BUFFER); |
1397 | + send_one_dtmf(vd); |
1398 | |
1399 | /* We don't really care about errors here */ |
1400 | decode_ril_error(&error, "OK"); |
1401 | cb(&error, data); |
1402 | } |
1403 | |
1404 | +static void clear_dtmf_queue(struct voicecall_data *vd) |
1405 | +{ |
1406 | + g_free(vd->tone_queue); |
1407 | + vd->tone_queue = g_strnfill(MAX_DTMF_BUFFER + 1, '\0'); |
1408 | + vd->tone_pending = FALSE; |
1409 | +} |
1410 | + |
1411 | +static void ril_create_multiparty(struct ofono_voicecall *vc, |
1412 | + ofono_voicecall_cb_t cb, void *data) |
1413 | +{ |
1414 | + struct voicecall_data *vd = ofono_voicecall_get_data(vc); |
1415 | + int request = RIL_REQUEST_CONFERENCE; |
1416 | + int ret; |
1417 | + |
1418 | + ret = ril_template(request, vc, generic_cb, 0, NULL, 0, cb, data); |
1419 | + |
1420 | + g_ril_print_request_no_args(vd->ril, ret, request); |
1421 | +} |
1422 | + |
1423 | +static void ril_private_chat(struct ofono_voicecall *vc, int id, |
1424 | + ofono_voicecall_cb_t cb, void *data) |
1425 | +{ |
1426 | + struct voicecall_data *vd = ofono_voicecall_get_data(vc); |
1427 | + struct parcel rilp; |
1428 | + int request = RIL_REQUEST_SEPARATE_CONNECTION; |
1429 | + int ret; |
1430 | + |
1431 | + g_ril_request_separate_conn(vd->ril, id, &rilp); |
1432 | + |
1433 | + /* Send request to RIL */ |
1434 | + ret = ril_template(request, vc, generic_cb, 0, rilp.data, rilp.size, |
1435 | + cb, data); |
1436 | + |
1437 | + g_ril_print_request(vd->ril, ret, request); |
1438 | + |
1439 | + parcel_free(&rilp); |
1440 | +} |
1441 | + |
1442 | +static void ril_swap_without_accept(struct ofono_voicecall *vc, |
1443 | + ofono_voicecall_cb_t cb, void *data) |
1444 | +{ |
1445 | + struct voicecall_data *vd = ofono_voicecall_get_data(vc); |
1446 | + int request = RIL_REQUEST_SWITCH_HOLDING_AND_ACTIVE; |
1447 | + int ret; |
1448 | + |
1449 | + ret = ril_template(request, vc, generic_cb, 0, NULL, 0, cb, data); |
1450 | + |
1451 | + g_ril_print_request_no_args(vd->ril, ret, request); |
1452 | +} |
1453 | + |
1454 | +static void ril_hold_all_active(struct ofono_voicecall *vc, |
1455 | + ofono_voicecall_cb_t cb, void *data) |
1456 | +{ |
1457 | + struct voicecall_data *vd = ofono_voicecall_get_data(vc); |
1458 | + int request = RIL_REQUEST_SWITCH_HOLDING_AND_ACTIVE; |
1459 | + int ret; |
1460 | + |
1461 | + ret = ril_template(request, vc, generic_cb, 0, NULL, 0, cb, data); |
1462 | + |
1463 | + g_ril_print_request_no_args(vd->ril, ret, request); |
1464 | +} |
1465 | + |
1466 | +static void ril_release_all_held(struct ofono_voicecall *vc, |
1467 | + ofono_voicecall_cb_t cb, void *data) |
1468 | +{ |
1469 | + struct voicecall_data *vd = ofono_voicecall_get_data(vc); |
1470 | + int request = RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND; |
1471 | + int ret; |
1472 | + |
1473 | + ret = ril_template(request, vc, generic_cb, 0, NULL, 0, cb, data); |
1474 | + |
1475 | + g_ril_print_request_no_args(vd->ril, ret, request); |
1476 | +} |
1477 | + |
1478 | +static void ril_release_all_active(struct ofono_voicecall *vc, |
1479 | + ofono_voicecall_cb_t cb, void *data) |
1480 | +{ |
1481 | + struct voicecall_data *vd = ofono_voicecall_get_data(vc); |
1482 | + int request = RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND; |
1483 | + int ret; |
1484 | + |
1485 | + ret = ril_template(request, vc, generic_cb, 0, NULL, 0, cb, data); |
1486 | + |
1487 | + g_ril_print_request_no_args(vd->ril, ret, request); |
1488 | +} |
1489 | + |
1490 | +static void ril_set_udub(struct ofono_voicecall *vc, |
1491 | + ofono_voicecall_cb_t cb, void *data) |
1492 | +{ |
1493 | + struct voicecall_data *vd = ofono_voicecall_get_data(vc); |
1494 | + int request = RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND; |
1495 | + int ret; |
1496 | + |
1497 | + ret = ril_template(request, vc, generic_cb, 0, NULL, 0, cb, data); |
1498 | + |
1499 | + g_ril_print_request_no_args(vd->ril, ret, request); |
1500 | +} |
1501 | + |
1502 | +static gboolean enable_supp_svc(gpointer user_data) |
1503 | +{ |
1504 | + struct ofono_voicecall *vc = user_data; |
1505 | + struct voicecall_data *vd = ofono_voicecall_get_data(vc); |
1506 | + int request = RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION; |
1507 | + int ret; |
1508 | + struct parcel rilp; |
1509 | + |
1510 | + g_ril_request_set_supp_svc_notif(vd->ril, &rilp); |
1511 | + |
1512 | + ret = g_ril_send(vd->ril, request, rilp.data, |
1513 | + rilp.size, NULL, vc, NULL); |
1514 | + |
1515 | + g_ril_print_request(vd->ril, ret, request); |
1516 | + |
1517 | + parcel_free(&rilp); |
1518 | + |
1519 | + /* Makes this a single shot */ |
1520 | + return FALSE; |
1521 | +} |
1522 | + |
1523 | static gboolean ril_delayed_register(gpointer user_data) |
1524 | { |
1525 | struct ofono_voicecall *vc = user_data; |
1526 | @@ -449,6 +685,13 @@ |
1527 | g_ril_register(vd->ril, RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED, |
1528 | ril_call_state_notify, vc); |
1529 | |
1530 | + /* Unsol when call set on hold */ |
1531 | + g_ril_register(vd->ril, RIL_UNSOL_SUPP_SVC_NOTIFICATION, |
1532 | + ril_ss_notify, vc); |
1533 | + |
1534 | + /* request supplementary service notifications*/ |
1535 | + enable_supp_svc(vc); |
1536 | + |
1537 | /* This makes the timeout a single-shot */ |
1538 | return FALSE; |
1539 | } |
1540 | @@ -465,18 +708,21 @@ |
1541 | |
1542 | vd->ril = g_ril_clone(ril); |
1543 | vd->vendor = vendor; |
1544 | - vd->tone_duration = TONE_DURATION; |
1545 | + vd->cb = NULL; |
1546 | + vd->data = NULL; |
1547 | + |
1548 | + clear_dtmf_queue(vd); |
1549 | |
1550 | ofono_voicecall_set_data(vc, vd); |
1551 | |
1552 | - /* |
1553 | + /* |
1554 | * ofono_voicecall_register() needs to be called after |
1555 | * the driver has been set in ofono_voicecall_create(), |
1556 | * which calls this function. Most other drivers make |
1557 | - * some kind of capabilities query to the modem, and then |
1558 | + * some kind of capabilities query to the modem, and then |
1559 | * call register in the callback; we use an idle event instead. |
1560 | */ |
1561 | - g_idle_add(ril_delayed_register, vc); |
1562 | + g_idle_add(ril_delayed_register, vc); |
1563 | |
1564 | return 0; |
1565 | } |
1566 | @@ -488,15 +734,13 @@ |
1567 | if (vd->clcc_source) |
1568 | g_source_remove(vd->clcc_source); |
1569 | |
1570 | - if (vd->vts_source) |
1571 | - g_source_remove(vd->vts_source); |
1572 | - |
1573 | g_slist_foreach(vd->calls, (GFunc) g_free, NULL); |
1574 | g_slist_free(vd->calls); |
1575 | |
1576 | ofono_voicecall_set_data(vc, NULL); |
1577 | |
1578 | g_ril_unref(vd->ril); |
1579 | + g_free(vd->tone_queue); |
1580 | g_free(vd); |
1581 | } |
1582 | |
1583 | @@ -507,7 +751,15 @@ |
1584 | .dial = ril_dial, |
1585 | .answer = ril_answer, |
1586 | .hangup_all = ril_hangup_all, |
1587 | - .send_tones = ril_send_dtmf |
1588 | + .release_specific = ril_hangup_specific, |
1589 | + .send_tones = ril_send_dtmf, |
1590 | + .create_multiparty = ril_create_multiparty, |
1591 | + .private_chat = ril_private_chat, |
1592 | + .swap_without_accept = ril_swap_without_accept, |
1593 | + .hold_all_active = ril_hold_all_active, |
1594 | + .release_all_held = ril_release_all_held, |
1595 | + .set_udub = ril_set_udub, |
1596 | + .release_all_active = ril_release_all_active, |
1597 | }; |
1598 | |
1599 | void ril_voicecall_init(void) |
1600 | |
1601 | === modified file 'gril/gril.c' |
1602 | --- gril/gril.c 2013-11-12 16:59:43 +0000 |
1603 | +++ gril/gril.c 2013-12-04 21:58:23 +0000 |
1604 | @@ -111,6 +111,13 @@ |
1605 | guint group; |
1606 | }; |
1607 | |
1608 | +struct req_hdr { |
1609 | + /* Warning: length is stored in network order */ |
1610 | + uint32_t length; |
1611 | + uint32_t reqid; |
1612 | + uint32_t serial; |
1613 | +}; |
1614 | + |
1615 | #define RIL_PRINT_BUF_SIZE 8096 |
1616 | char print_buf[RIL_PRINT_BUF_SIZE] __attribute__((used)); |
1617 | |
1618 | @@ -225,51 +232,36 @@ |
1619 | gboolean wakeup) |
1620 | { |
1621 | struct ril_request *r; |
1622 | - gsize len; |
1623 | - gchar *cur_bufp; |
1624 | - guint32 *net_length; |
1625 | - gint32 *request, *serial_no; |
1626 | + struct req_hdr header; |
1627 | |
1628 | r = g_try_new0(struct ril_request, 1); |
1629 | - if (r == NULL) |
1630 | - return 0; |
1631 | - |
1632 | - |
1633 | - DBG("req: %s, id: %d, data_len: %d", |
1634 | - ril_request_id_to_string(req), id, (int) data_len); |
1635 | - |
1636 | - /* RIL request: 8 byte header + data */ |
1637 | - len = 8 + data_len; |
1638 | - |
1639 | - /* Add 4 bytes to buffer length to include length prefix */ |
1640 | - r->data_len = len + 4; |
1641 | + if (r == NULL) { |
1642 | + ofono_error("%s Out of memory", __func__); |
1643 | + return NULL; |
1644 | + } |
1645 | + |
1646 | + DBG("req: %s, id: %d, data_len: %zu", |
1647 | + ril_request_id_to_string(req), id, data_len); |
1648 | + |
1649 | + /* Full request size: header size plus buffer length */ |
1650 | + r->data_len = data_len + sizeof(header); |
1651 | |
1652 | r->data = g_try_new(char, r->data_len); |
1653 | if (r->data == NULL) { |
1654 | ofono_error("ril_request: can't allocate new request."); |
1655 | g_free(r); |
1656 | - return 0; |
1657 | + return NULL; |
1658 | } |
1659 | |
1660 | - /* convert length to network byte order (Big Endian) */ |
1661 | - net_length = (guint32 *) r->data; |
1662 | - *net_length = htonl(len); |
1663 | - |
1664 | - /* advance past initial length */ |
1665 | - cur_bufp = r->data + 4; |
1666 | - |
1667 | - /* write request code */ |
1668 | - request = (gint32 *) cur_bufp; |
1669 | - *request = req; |
1670 | - cur_bufp += 4; |
1671 | - |
1672 | - /* write serial number */ |
1673 | - serial_no = (gint32 *) cur_bufp; |
1674 | - *serial_no = id; |
1675 | - cur_bufp += 4; |
1676 | - |
1677 | + /* Length does not include the length field. Network order. */ |
1678 | + header.length = htonl(r->data_len - sizeof(header.length)); |
1679 | + header.reqid = req; |
1680 | + header.serial = id; |
1681 | + |
1682 | + /* copy header */ |
1683 | + memcpy(r->data, &header, sizeof(header)); |
1684 | /* copy request data */ |
1685 | - memcpy(cur_bufp, (const void *) data, data_len); |
1686 | + memcpy(r->data + sizeof(header), data, data_len); |
1687 | |
1688 | r->req = req; |
1689 | r->gid = gid; |
1690 | @@ -330,8 +322,8 @@ |
1691 | gsize count = g_queue_get_length(p->command_queue); |
1692 | struct ril_request *req; |
1693 | gboolean found = FALSE; |
1694 | - guint i; |
1695 | - guint len, id; |
1696 | + guint i, len; |
1697 | + gint id; |
1698 | |
1699 | g_assert(count > 0); |
1700 | |
1701 | @@ -358,7 +350,8 @@ |
1702 | len = g_queue_get_length(p->out_queue); |
1703 | DBG("requests in sent queue before removing:%d", len); |
1704 | for (i = 0; i < len; i++) { |
1705 | - id = (guint) g_queue_peek_nth(p->out_queue, i); |
1706 | + id = GPOINTER_TO_INT(g_queue_peek_nth( |
1707 | + p->out_queue, i)); |
1708 | if (id == req->id) { |
1709 | g_queue_pop_nth(p->out_queue, i); |
1710 | break; |
1711 | @@ -429,13 +422,13 @@ |
1712 | |
1713 | static void dispatch(struct ril_s *p, struct ril_msg *message) |
1714 | { |
1715 | - gint32 *unsolicited_field, *id_num_field; |
1716 | + int32_t *unsolicited_field, *id_num_field; |
1717 | gchar *bufp = message->buf; |
1718 | gchar *datap; |
1719 | gsize data_len; |
1720 | |
1721 | /* This could be done with a struct/union... */ |
1722 | - unsolicited_field = (gint32 *) bufp; |
1723 | + unsolicited_field = (int32_t *) (void *) bufp; |
1724 | if (*unsolicited_field) |
1725 | message->unsolicited = TRUE; |
1726 | else |
1727 | @@ -443,7 +436,7 @@ |
1728 | |
1729 | bufp += 4; |
1730 | |
1731 | - id_num_field = (gint32 *) bufp; |
1732 | + id_num_field = (int32_t *) (void *) bufp; |
1733 | if (message->unsolicited) { |
1734 | message->req = (int) *id_num_field; |
1735 | |
1736 | @@ -457,7 +450,7 @@ |
1737 | message->serial_no = (int) *id_num_field; |
1738 | |
1739 | bufp += 4; |
1740 | - message->error = *((guint32 *) bufp); |
1741 | + message->error = *((int32_t *) (void *) bufp); |
1742 | |
1743 | /* |
1744 | * A RIL Solicited Response is three UINT32 fields ( unsolicied, |
1745 | @@ -471,23 +464,30 @@ |
1746 | /* advance to start of data.. */ |
1747 | bufp += 4; |
1748 | |
1749 | - /* Now, allocate new buffer for data only, copy from |
1750 | - * original, and free the original... |
1751 | + /* |
1752 | + * Now, use buffer for event data if present |
1753 | */ |
1754 | if (data_len) { |
1755 | datap = g_try_malloc(data_len); |
1756 | if (datap == NULL) |
1757 | goto error; |
1758 | |
1759 | - /* Copy bytes into new buffer */ |
1760 | - memmove(datap, (const void *) bufp, data_len); |
1761 | + /* Copy event bytes from message->buf into new buffer */ |
1762 | + memcpy(datap, bufp, data_len); |
1763 | |
1764 | - /* Free old buffer */ |
1765 | + /* Free buffer that includes header */ |
1766 | g_free(message->buf); |
1767 | |
1768 | /* ...and replace with new buffer */ |
1769 | message->buf = datap; |
1770 | message->buf_len = data_len; |
1771 | + } else { |
1772 | + /* Free buffer that includes header */ |
1773 | + g_free(message->buf); |
1774 | + |
1775 | + /* To know if there was no data when parsing */ |
1776 | + message->buf = NULL; |
1777 | + message->buf_len = 0; |
1778 | } |
1779 | |
1780 | if (message->unsolicited == TRUE) |
1781 | @@ -504,10 +504,10 @@ |
1782 | const guchar *bytes, gsize *len) |
1783 | { |
1784 | struct ril_msg *message; |
1785 | - int message_len, plen; |
1786 | + unsigned message_len, plen; |
1787 | |
1788 | /* First four bytes are length in TCP byte order (Big Endian) */ |
1789 | - plen = ntohl(*((uint32_t *) bytes)); |
1790 | + plen = ntohl(*((uint32_t *) (void *) bytes)); |
1791 | bytes += 4; |
1792 | |
1793 | /* TODO: Verify that 4k is the max message size from rild. |
1794 | @@ -615,9 +615,10 @@ |
1795 | struct ril_s *ril = data; |
1796 | struct ril_request *req; |
1797 | gsize bytes_written, towrite, len; |
1798 | - guint qlen, oqlen, id; |
1799 | + guint qlen, oqlen; |
1800 | + gint id; |
1801 | gboolean written = TRUE; |
1802 | - int i, j; |
1803 | + guint i, j; |
1804 | |
1805 | qlen = g_queue_get_length(ril->command_queue); |
1806 | if (qlen < 1) |
1807 | @@ -629,7 +630,8 @@ |
1808 | for (i = 0; i < qlen; i++) { |
1809 | req = g_queue_peek_nth(ril->command_queue, i); |
1810 | if (req) { |
1811 | - id = (guint) g_queue_peek_head(ril->out_queue); |
1812 | + id = GPOINTER_TO_INT(g_queue_peek_head( |
1813 | + ril->out_queue)); |
1814 | if (req->id == id) |
1815 | goto out; |
1816 | } else { |
1817 | @@ -644,7 +646,7 @@ |
1818 | if (req == NULL) |
1819 | return FALSE; |
1820 | |
1821 | - g_queue_push_head(ril->out_queue,(gpointer) req->id); |
1822 | + g_queue_push_head(ril->out_queue, GINT_TO_POINTER(req->id)); |
1823 | |
1824 | goto out; |
1825 | } |
1826 | @@ -655,7 +657,8 @@ |
1827 | return FALSE; |
1828 | |
1829 | for (j = 0; j < oqlen; j++) { |
1830 | - id = (guint) g_queue_peek_nth(ril->out_queue, j); |
1831 | + id = GPOINTER_TO_INT( |
1832 | + g_queue_peek_nth(ril->out_queue, j)); |
1833 | if (req->id == id) { |
1834 | written = TRUE; |
1835 | break; |
1836 | @@ -672,13 +675,13 @@ |
1837 | if (written == TRUE) |
1838 | return FALSE; |
1839 | |
1840 | - g_queue_push_head(ril->out_queue,(gpointer) req->id); |
1841 | + g_queue_push_head(ril->out_queue, GINT_TO_POINTER(req->id)); |
1842 | |
1843 | out: |
1844 | len = req->data_len; |
1845 | |
1846 | towrite = len - ril->req_bytes_written; |
1847 | - DBG("req:%d,len:%d,towrite:%d", req->id, len, towrite); |
1848 | + DBG("req:%d,len:%zu,towrite:%zu", req->id, len, towrite); |
1849 | #ifdef WRITE_SCHEDULER_DEBUG |
1850 | if (towrite > 5) |
1851 | towrite = 5; |
1852 | @@ -865,8 +868,7 @@ |
1853 | static void ril_cancel_group(struct ril_s *ril, guint group) |
1854 | { |
1855 | int n = 0; |
1856 | - int i; |
1857 | - guint len; |
1858 | + guint len, i; |
1859 | struct ril_request *req; |
1860 | |
1861 | if (ril->command_queue == NULL) |
1862 | @@ -882,7 +884,8 @@ |
1863 | |
1864 | len = g_queue_get_length(ril->out_queue); |
1865 | for (i = 0; i < len; i++) { |
1866 | - if ((guint) g_queue_peek_nth(ril->out_queue, i) |
1867 | + if (GPOINTER_TO_INT( |
1868 | + g_queue_peek_nth(ril->out_queue, i)) |
1869 | == req->id) { |
1870 | g_queue_pop_nth(ril->out_queue, i); |
1871 | break; |
1872 | @@ -989,7 +992,7 @@ |
1873 | return FALSE; |
1874 | } |
1875 | |
1876 | -void g_ril_init_parcel(struct ril_msg *message, struct parcel *rilp) |
1877 | +void g_ril_init_parcel(const struct ril_msg *message, struct parcel *rilp) |
1878 | { |
1879 | /* Set up Parcel struct for proper parsing */ |
1880 | rilp->data = message->buf; |
1881 | |
1882 | === modified file 'gril/gril.h' |
1883 | --- gril/gril.h 2013-11-12 16:59:43 +0000 |
1884 | +++ gril/gril.h 2013-12-04 21:58:23 +0000 |
1885 | @@ -91,7 +91,7 @@ |
1886 | #define g_ril_print_unsol_no_args(gril, message) \ |
1887 | G_RIL_TRACE(gril, "[UNSOL]< %s", ril_unsol_request_to_string(message->req)) |
1888 | |
1889 | -void g_ril_init_parcel(struct ril_msg *message, struct parcel *rilp); |
1890 | +void g_ril_init_parcel(const struct ril_msg *message, struct parcel *rilp); |
1891 | |
1892 | GRil *g_ril_new(); |
1893 | |
1894 | |
1895 | === modified file 'gril/grilreply.c' |
1896 | --- gril/grilreply.c 2013-11-15 23:16:57 +0000 |
1897 | +++ gril/grilreply.c 2013-12-04 21:58:23 +0000 |
1898 | @@ -168,7 +168,8 @@ |
1899 | } |
1900 | |
1901 | struct reply_avail_ops *g_ril_reply_parse_avail_ops(GRil *gril, |
1902 | - struct ril_msg *message) { |
1903 | + const struct ril_msg *message) |
1904 | +{ |
1905 | struct parcel rilp; |
1906 | struct reply_operator *operator; |
1907 | struct reply_avail_ops *reply = NULL; |
1908 | @@ -281,7 +282,7 @@ |
1909 | } |
1910 | |
1911 | struct reply_operator *g_ril_reply_parse_operator(GRil *gril, |
1912 | - struct ril_msg *message) |
1913 | + const struct ril_msg *message) |
1914 | { |
1915 | struct parcel rilp; |
1916 | int num_params; |
1917 | @@ -359,8 +360,8 @@ |
1918 | } |
1919 | |
1920 | struct reply_setup_data_call *g_ril_reply_parse_data_call(GRil *gril, |
1921 | - struct ril_msg *message, |
1922 | - struct ofono_error *error) |
1923 | + const struct ril_msg *message, |
1924 | + struct ofono_error *error) |
1925 | { |
1926 | struct parcel rilp; |
1927 | int num = 0; |
1928 | @@ -530,7 +531,7 @@ |
1929 | } |
1930 | |
1931 | struct reply_reg_state *g_ril_reply_parse_reg_state(GRil *gril, |
1932 | - struct ril_msg *message) |
1933 | + const struct ril_msg *message) |
1934 | |
1935 | { |
1936 | struct parcel rilp; |
1937 | @@ -658,7 +659,7 @@ |
1938 | } |
1939 | |
1940 | struct reply_sim_io *g_ril_reply_parse_sim_io(GRil *gril, |
1941 | - struct ril_msg *message) |
1942 | + const struct ril_msg *message) |
1943 | { |
1944 | struct parcel rilp; |
1945 | char *response = NULL; |
1946 | @@ -683,14 +684,14 @@ |
1947 | reply->sw2 = parcel_r_int32(&rilp); |
1948 | |
1949 | response = parcel_r_string(&rilp); |
1950 | - if (response == NULL) |
1951 | - goto error; |
1952 | |
1953 | - reply->hex_response = |
1954 | - decode_hex((const char *) response, strlen(response), |
1955 | - (long *) &reply->hex_len, -1); |
1956 | - if (reply->hex_response == NULL) |
1957 | - goto error; |
1958 | + if (response != NULL) { |
1959 | + reply->hex_response = |
1960 | + decode_hex(response, strlen(response), |
1961 | + (long *) &reply->hex_len, -1); |
1962 | + if (reply->hex_response == NULL) |
1963 | + goto error; |
1964 | + } |
1965 | |
1966 | g_ril_append_print_buf(gril, |
1967 | "(sw1=0x%.2X,sw2=0x%.2X,%s)", |
1968 | @@ -709,7 +710,7 @@ |
1969 | return NULL; |
1970 | } |
1971 | |
1972 | -gchar *g_ril_reply_parse_imsi(GRil *gril, struct ril_msg *message) |
1973 | +gchar *g_ril_reply_parse_imsi(GRil *gril, const struct ril_msg *message) |
1974 | { |
1975 | struct parcel rilp; |
1976 | gchar *imsi; |
1977 | @@ -745,7 +746,7 @@ |
1978 | } |
1979 | |
1980 | struct reply_sim_status *g_ril_reply_parse_sim_status(GRil *gril, |
1981 | - struct ril_msg *message) |
1982 | + const struct ril_msg *message) |
1983 | { |
1984 | struct parcel rilp; |
1985 | unsigned int i; |
1986 | @@ -867,3 +868,243 @@ |
1987 | |
1988 | return NULL; |
1989 | } |
1990 | + |
1991 | +struct ofono_phone_number *g_ril_reply_parse_get_smsc_address( |
1992 | + GRil *gril, |
1993 | + const struct ril_msg *message) |
1994 | +{ |
1995 | + struct ofono_phone_number *sca; |
1996 | + struct parcel rilp; |
1997 | + char *number, *temp_buf; |
1998 | + |
1999 | + sca = g_new0(struct ofono_phone_number, 1); |
2000 | + if (sca == NULL) { |
2001 | + ofono_error("%s Out of memory", __func__); |
2002 | + goto err_alloc; |
2003 | + } |
2004 | + |
2005 | + g_ril_init_parcel(message, &rilp); |
2006 | + |
2007 | + temp_buf = parcel_r_string(&rilp); |
2008 | + if (temp_buf == NULL) { |
2009 | + ofono_error("%s Cannot read SMSC address", __func__); |
2010 | + goto err_readsca; |
2011 | + } |
2012 | + |
2013 | + /* RIL gives address in quotes */ |
2014 | + number = strtok(temp_buf, "\""); |
2015 | + if (number == NULL || *number == '\0') { |
2016 | + ofono_error("%s Invalid SMSC address", __func__); |
2017 | + goto err_scaformat; |
2018 | + } |
2019 | + |
2020 | + if (number[0] == '+') { |
2021 | + number = number + 1; |
2022 | + sca->type = OFONO_NUMBER_TYPE_INTERNATIONAL; |
2023 | + } else { |
2024 | + sca->type = OFONO_NUMBER_TYPE_UNKNOWN; |
2025 | + } |
2026 | + |
2027 | + strncpy(sca->number, number, OFONO_MAX_PHONE_NUMBER_LENGTH); |
2028 | + sca->number[OFONO_MAX_PHONE_NUMBER_LENGTH] = '\0'; |
2029 | + |
2030 | + g_ril_append_print_buf(gril, "{type=%d,number=%s}", |
2031 | + sca->type, sca->number); |
2032 | + g_ril_print_response(gril, message); |
2033 | + |
2034 | + g_free(temp_buf); |
2035 | + |
2036 | + return sca; |
2037 | + |
2038 | +err_scaformat: |
2039 | + g_free(temp_buf); |
2040 | +err_readsca: |
2041 | + g_free(sca); |
2042 | +err_alloc: |
2043 | + return NULL; |
2044 | +} |
2045 | + |
2046 | +int g_ril_reply_parse_sms_response(GRil *gril, const struct ril_msg *message) |
2047 | +{ |
2048 | + struct parcel rilp; |
2049 | + int error, mr; |
2050 | + char *ack_pdu; |
2051 | + |
2052 | + /* Set up Parcel struct for proper parsing */ |
2053 | + g_ril_init_parcel(message, &rilp); |
2054 | + |
2055 | + /* |
2056 | + * TP-Message-Reference for GSM/ |
2057 | + * BearerData MessageId for CDMA |
2058 | + */ |
2059 | + mr = parcel_r_int32(&rilp); |
2060 | + ack_pdu = parcel_r_string(&rilp); |
2061 | + error = parcel_r_int32(&rilp); |
2062 | + |
2063 | + g_ril_append_print_buf(gril, "{%d,%s,%d}", |
2064 | + mr, ack_pdu, error); |
2065 | + g_ril_print_response(gril, message); |
2066 | + |
2067 | + g_free(ack_pdu); |
2068 | + |
2069 | + return mr; |
2070 | +} |
2071 | + |
2072 | +static gint g_ril_call_compare(gconstpointer a, gconstpointer b) |
2073 | +{ |
2074 | + const struct ofono_call *ca = a; |
2075 | + const struct ofono_call *cb = b; |
2076 | + |
2077 | + if (ca->id < cb->id) |
2078 | + return -1; |
2079 | + |
2080 | + if (ca->id > cb->id) |
2081 | + return 1; |
2082 | + |
2083 | + return 0; |
2084 | +} |
2085 | + |
2086 | +GSList *g_ril_reply_parse_get_calls(GRil *gril, const struct ril_msg *message) |
2087 | +{ |
2088 | + struct ofono_call *call; |
2089 | + struct parcel rilp; |
2090 | + GSList *l = NULL; |
2091 | + int num, i; |
2092 | + gchar *number, *name; |
2093 | + |
2094 | + g_ril_init_parcel(message, &rilp); |
2095 | + |
2096 | + g_ril_append_print_buf(gril, "{"); |
2097 | + |
2098 | + /* maguro signals no calls with empty event data */ |
2099 | + if (rilp.size < sizeof(int32_t)) |
2100 | + goto no_calls; |
2101 | + |
2102 | + /* Number of RIL_Call structs */ |
2103 | + num = parcel_r_int32(&rilp); |
2104 | + for (i = 0; i < num; i++) { |
2105 | + call = g_try_new(struct ofono_call, 1); |
2106 | + if (call == NULL) |
2107 | + break; |
2108 | + |
2109 | + ofono_call_init(call); |
2110 | + call->status = parcel_r_int32(&rilp); |
2111 | + call->id = parcel_r_int32(&rilp); |
2112 | + call->phone_number.type = parcel_r_int32(&rilp); |
2113 | + parcel_r_int32(&rilp); /* isMpty */ |
2114 | + parcel_r_int32(&rilp); /* isMT */ |
2115 | + parcel_r_int32(&rilp); /* als */ |
2116 | + call->type = parcel_r_int32(&rilp); /* isVoice */ |
2117 | + parcel_r_int32(&rilp); /* isVoicePrivacy */ |
2118 | + number = parcel_r_string(&rilp); |
2119 | + if (number) { |
2120 | + strncpy(call->phone_number.number, number, |
2121 | + OFONO_MAX_PHONE_NUMBER_LENGTH); |
2122 | + g_free(number); |
2123 | + } |
2124 | + |
2125 | + parcel_r_int32(&rilp); /* numberPresentation */ |
2126 | + name = parcel_r_string(&rilp); |
2127 | + if (name) { |
2128 | + strncpy(call->name, name, |
2129 | + OFONO_MAX_CALLER_NAME_LENGTH); |
2130 | + g_free(name); |
2131 | + } |
2132 | + |
2133 | + parcel_r_int32(&rilp); /* namePresentation */ |
2134 | + parcel_r_int32(&rilp); /* uusInfo */ |
2135 | + |
2136 | + if (strlen(call->phone_number.number) > 0) |
2137 | + call->clip_validity = 0; |
2138 | + else |
2139 | + call->clip_validity = 2; |
2140 | + |
2141 | + g_ril_append_print_buf(gril, |
2142 | + "%s [id=%d,status=%d,type=%d," |
2143 | + "number=%s,name=%s]", |
2144 | + print_buf, |
2145 | + call->id, call->status, call->type, |
2146 | + call->phone_number.number, call->name); |
2147 | + |
2148 | + l = g_slist_insert_sorted(l, call, g_ril_call_compare); |
2149 | + } |
2150 | + |
2151 | +no_calls: |
2152 | + g_ril_append_print_buf(gril, "%s}", print_buf); |
2153 | + g_ril_print_response(gril, message); |
2154 | + |
2155 | + return l; |
2156 | +} |
2157 | + |
2158 | +enum ofono_disconnect_reason g_ril_reply_parse_call_fail_cause( |
2159 | + GRil *gril, const struct ril_msg *message) |
2160 | +{ |
2161 | + enum ofono_disconnect_reason reason = OFONO_DISCONNECT_REASON_ERROR; |
2162 | + int last_cause = CALL_FAIL_ERROR_UNSPECIFIED; |
2163 | + struct parcel rilp; |
2164 | + |
2165 | + g_ril_init_parcel(message, &rilp); |
2166 | + |
2167 | + if (rilp.size < sizeof(int32_t)) |
2168 | + ofono_error("%s: Parcel is too small", __func__); |
2169 | + else if (parcel_r_int32(&rilp) > 0) |
2170 | + last_cause = parcel_r_int32(&rilp); |
2171 | + |
2172 | + if (last_cause == CALL_FAIL_NORMAL || last_cause == CALL_FAIL_BUSY) |
2173 | + reason = OFONO_DISCONNECT_REASON_REMOTE_HANGUP; |
2174 | + |
2175 | + g_ril_append_print_buf(gril, "{%d}", last_cause); |
2176 | + g_ril_print_response(gril, message); |
2177 | + |
2178 | + return reason; |
2179 | +} |
2180 | + |
2181 | +int g_ril_reply_parse_get_mute(GRil *gril, const struct ril_msg *message) |
2182 | +{ |
2183 | + struct parcel rilp; |
2184 | + int muted; |
2185 | + |
2186 | + g_ril_init_parcel(message, &rilp); |
2187 | + |
2188 | + /* skip length of int[] */ |
2189 | + parcel_r_int32(&rilp); |
2190 | + muted = parcel_r_int32(&rilp); |
2191 | + |
2192 | + g_ril_append_print_buf(gril, "{%d}", muted); |
2193 | + g_ril_print_response(gril, message); |
2194 | + |
2195 | + return muted; |
2196 | + |
2197 | +} |
2198 | + |
2199 | +char *g_ril_reply_parse_baseband_version(GRil *gril, |
2200 | + const struct ril_msg *message) |
2201 | +{ |
2202 | + struct parcel rilp; |
2203 | + char *version; |
2204 | + |
2205 | + g_ril_init_parcel(message, &rilp); |
2206 | + |
2207 | + version = parcel_r_string(&rilp); |
2208 | + |
2209 | + g_ril_append_print_buf(gril, "{%s}", version); |
2210 | + g_ril_print_response(gril, message); |
2211 | + |
2212 | + return version; |
2213 | +} |
2214 | + |
2215 | +char *g_ril_reply_parse_get_imei(GRil *gril, |
2216 | + const struct ril_msg *message) |
2217 | +{ |
2218 | + struct parcel rilp; |
2219 | + char *imei; |
2220 | + |
2221 | + g_ril_init_parcel(message, &rilp); |
2222 | + |
2223 | + imei = parcel_r_string(&rilp); |
2224 | + |
2225 | + g_ril_append_print_buf(gril, "{%s}", imei); |
2226 | + g_ril_print_response(gril, message); |
2227 | + |
2228 | + return imei; |
2229 | +} |
2230 | |
2231 | === modified file 'gril/grilreply.h' |
2232 | --- gril/grilreply.h 2013-11-15 23:16:57 +0000 |
2233 | +++ gril/grilreply.h 2013-12-04 21:58:23 +0000 |
2234 | @@ -98,33 +98,51 @@ |
2235 | void g_ril_reply_free_avail_ops(struct reply_avail_ops *reply); |
2236 | |
2237 | struct reply_avail_ops *g_ril_reply_parse_avail_ops(GRil *gril, |
2238 | - struct ril_msg *message); |
2239 | - |
2240 | + const struct ril_msg *message); |
2241 | void g_ril_reply_free_operator(struct reply_operator *reply); |
2242 | |
2243 | struct reply_operator *g_ril_reply_parse_operator(GRil *gril, |
2244 | - struct ril_msg *message); |
2245 | + const struct ril_msg *message); |
2246 | |
2247 | void g_ril_reply_free_setup_data_call(struct reply_setup_data_call *reply); |
2248 | |
2249 | struct reply_setup_data_call *g_ril_reply_parse_data_call(GRil *gril, |
2250 | - struct ril_msg *message, |
2251 | - struct ofono_error *error); |
2252 | + const struct ril_msg *message, |
2253 | + struct ofono_error *error); |
2254 | |
2255 | void g_ril_reply_free_sim_io(struct reply_sim_io *reply); |
2256 | |
2257 | struct reply_sim_io *g_ril_reply_parse_sim_io(GRil *gril, |
2258 | - struct ril_msg *message); |
2259 | + const struct ril_msg *message); |
2260 | |
2261 | -gchar *g_ril_reply_parse_imsi(GRil *gril, struct ril_msg *message); |
2262 | +gchar *g_ril_reply_parse_imsi(GRil *gril, const struct ril_msg *message); |
2263 | |
2264 | struct reply_reg_state *g_ril_reply_parse_reg_state(GRil *gril, |
2265 | - struct ril_msg *message); |
2266 | + const struct ril_msg *message); |
2267 | |
2268 | void g_ril_reply_free_sim_status(struct reply_sim_status *status); |
2269 | |
2270 | struct reply_sim_status *g_ril_reply_parse_sim_status(GRil *gril, |
2271 | - struct ril_msg *message); |
2272 | + const struct ril_msg *message); |
2273 | + |
2274 | +struct ofono_phone_number *g_ril_reply_parse_get_smsc_address( |
2275 | + GRil *gril, |
2276 | + const struct ril_msg *message); |
2277 | + |
2278 | +int g_ril_reply_parse_sms_response(GRil *gril, const struct ril_msg *message); |
2279 | + |
2280 | +GSList *g_ril_reply_parse_get_calls(GRil *gril, const struct ril_msg *message); |
2281 | + |
2282 | +enum ofono_disconnect_reason g_ril_reply_parse_call_fail_cause( |
2283 | + GRil *gril, const struct ril_msg *message); |
2284 | + |
2285 | +int g_ril_reply_parse_get_mute(GRil *gril, const struct ril_msg *message); |
2286 | + |
2287 | +char *g_ril_reply_parse_baseband_version(GRil *gril, |
2288 | + const struct ril_msg *message); |
2289 | + |
2290 | +char *g_ril_reply_parse_get_imei(GRil *gril, |
2291 | + const struct ril_msg *message); |
2292 | |
2293 | #ifdef __cplusplus |
2294 | } |
2295 | |
2296 | === modified file 'gril/grilrequest.c' |
2297 | --- gril/grilrequest.c 2013-11-15 23:16:57 +0000 |
2298 | +++ gril/grilrequest.c 2013-12-04 21:58:23 +0000 |
2299 | @@ -38,6 +38,7 @@ |
2300 | #include "grilrequest.h" |
2301 | #include "simutil.h" |
2302 | #include "util.h" |
2303 | +#include "common.h" |
2304 | |
2305 | /* DEACTIVATE_DATA_CALL request parameters */ |
2306 | #define DEACTIVATE_DATA_CALL_NUM_PARAMS 2 |
2307 | @@ -568,3 +569,151 @@ |
2308 | g_ril_append_print_buf(gril, "(old=%s,new=%s,aid=%s)", |
2309 | old_passwd, new_passwd, aid_str); |
2310 | } |
2311 | + |
2312 | +void g_ril_request_sms_cmgs(GRil *gril, |
2313 | + const struct req_sms_cmgs *req, |
2314 | + struct parcel *rilp) |
2315 | +{ |
2316 | + int smsc_len; |
2317 | + char *tpdu; |
2318 | + |
2319 | + parcel_init(rilp); |
2320 | + parcel_w_int32(rilp, 2); /* Number of strings */ |
2321 | + |
2322 | + /* |
2323 | + * SMSC address: |
2324 | + * |
2325 | + * smsc_len == 1, then zero-length SMSC was spec'd |
2326 | + * RILD expects a NULL string in this case instead |
2327 | + * of a zero-length string. |
2328 | + */ |
2329 | + smsc_len = req->pdu_len - req->tpdu_len; |
2330 | + /* TODO: encode SMSC & write to parcel */ |
2331 | + if (smsc_len > 1) |
2332 | + ofono_error("SMSC address specified (smsc_len %d); " |
2333 | + "NOT-IMPLEMENTED", smsc_len); |
2334 | + |
2335 | + parcel_w_string(rilp, NULL); /* SMSC address; NULL == default */ |
2336 | + |
2337 | + /* |
2338 | + * TPDU: |
2339 | + * |
2340 | + * 'pdu' is a raw hexadecimal string |
2341 | + * encode_hex() turns it into an ASCII/hex UTF8 buffer |
2342 | + * parcel_w_string() encodes utf8 -> utf16 |
2343 | + */ |
2344 | + tpdu = encode_hex(req->pdu + smsc_len, req->tpdu_len, 0); |
2345 | + parcel_w_string(rilp, tpdu); |
2346 | + |
2347 | + g_ril_append_print_buf(gril, "(%s)", tpdu); |
2348 | + |
2349 | + g_free(tpdu); |
2350 | +} |
2351 | + |
2352 | +void g_ril_request_sms_acknowledge(GRil *gril, |
2353 | + struct parcel *rilp) |
2354 | +{ |
2355 | + parcel_init(rilp); |
2356 | + parcel_w_int32(rilp, 2); /* Number of int32 values in array */ |
2357 | + parcel_w_int32(rilp, 1); /* Successful receipt */ |
2358 | + parcel_w_int32(rilp, 0); /* error code */ |
2359 | + |
2360 | + g_ril_append_print_buf(gril, "(1,0)"); |
2361 | +} |
2362 | + |
2363 | +void g_ril_request_set_smsc_address(GRil *gril, |
2364 | + const struct ofono_phone_number *sca, |
2365 | + struct parcel *rilp) |
2366 | +{ |
2367 | + char number[OFONO_MAX_PHONE_NUMBER_LENGTH + 4]; |
2368 | + |
2369 | + if (sca->type == OFONO_NUMBER_TYPE_INTERNATIONAL) |
2370 | + snprintf(number, sizeof(number), "\"+%s\"", sca->number); |
2371 | + else |
2372 | + snprintf(number, sizeof(number), "\"%s\"", sca->number); |
2373 | + |
2374 | + parcel_init(rilp); |
2375 | + parcel_w_string(rilp, number); |
2376 | + |
2377 | + g_ril_append_print_buf(gril, "(%s)", number); |
2378 | +} |
2379 | + |
2380 | +void g_ril_request_dial(GRil *gril, |
2381 | + const struct ofono_phone_number *ph, |
2382 | + enum ofono_clir_option clir, |
2383 | + struct parcel *rilp) |
2384 | +{ |
2385 | + parcel_init(rilp); |
2386 | + |
2387 | + /* Number to dial */ |
2388 | + parcel_w_string(rilp, phone_number_to_string(ph)); |
2389 | + /* CLIR mode */ |
2390 | + parcel_w_int32(rilp, clir); |
2391 | + /* USS, empty string */ |
2392 | + /* TODO: Deal with USS properly */ |
2393 | + parcel_w_int32(rilp, 0); |
2394 | + parcel_w_int32(rilp, 0); |
2395 | + |
2396 | + g_ril_append_print_buf(gril, "(%s,%d,0,0)", |
2397 | + phone_number_to_string(ph), |
2398 | + clir); |
2399 | +} |
2400 | + |
2401 | +void g_ril_request_hangup(GRil *gril, |
2402 | + unsigned call_id, |
2403 | + struct parcel *rilp) |
2404 | +{ |
2405 | + parcel_init(rilp); |
2406 | + parcel_w_int32(rilp, 1); /* Always 1 - AT+CHLD=1x */ |
2407 | + parcel_w_int32(rilp, call_id); |
2408 | + |
2409 | + g_ril_append_print_buf(gril, "(%u)", call_id); |
2410 | +} |
2411 | + |
2412 | +void g_ril_request_dtmf(GRil *gril, |
2413 | + char dtmf_char, |
2414 | + struct parcel *rilp) |
2415 | +{ |
2416 | + char ril_dtmf[2]; |
2417 | + |
2418 | + parcel_init(rilp); |
2419 | + /* Ril wants just one character, but we need to send as string */ |
2420 | + ril_dtmf[0] = dtmf_char; |
2421 | + ril_dtmf[1] = '\0'; |
2422 | + parcel_w_string(rilp, ril_dtmf); |
2423 | + |
2424 | + g_ril_append_print_buf(gril, "(%s)", ril_dtmf); |
2425 | +} |
2426 | + |
2427 | +void g_ril_request_separate_conn(GRil *gril, |
2428 | + int call_id, |
2429 | + struct parcel *rilp) |
2430 | +{ |
2431 | + parcel_init(rilp); |
2432 | + |
2433 | + /* Payload is an array that holds just one element */ |
2434 | + parcel_w_int32(rilp, 1); |
2435 | + parcel_w_int32(rilp, call_id); |
2436 | + |
2437 | + g_ril_append_print_buf(gril, "(%d)", call_id); |
2438 | +} |
2439 | + |
2440 | +void g_ril_request_set_supp_svc_notif(GRil *gril, |
2441 | + struct parcel *rilp) |
2442 | +{ |
2443 | + parcel_init(rilp); |
2444 | + parcel_w_int32(rilp, 1); /* size of array */ |
2445 | + parcel_w_int32(rilp, 1); /* notifications enabled */ |
2446 | + |
2447 | + g_ril_append_print_buf(gril, "(1)"); |
2448 | +} |
2449 | + |
2450 | +void g_ril_request_set_mute(GRil *gril, int muted, struct parcel *rilp) |
2451 | +{ |
2452 | + parcel_init(rilp); |
2453 | + |
2454 | + parcel_w_int32(rilp, 1); |
2455 | + parcel_w_int32(rilp, muted); |
2456 | + |
2457 | + g_ril_append_print_buf(gril, "(%d)", muted); |
2458 | +} |
2459 | |
2460 | === modified file 'gril/grilrequest.h' |
2461 | --- gril/grilrequest.h 2013-11-15 23:16:57 +0000 |
2462 | +++ gril/grilrequest.h 2013-12-04 21:58:23 +0000 |
2463 | @@ -86,6 +86,12 @@ |
2464 | const char *passwd; |
2465 | }; |
2466 | |
2467 | +struct req_sms_cmgs { |
2468 | + const unsigned char *pdu; |
2469 | + int pdu_len; |
2470 | + int tpdu_len; |
2471 | +}; |
2472 | + |
2473 | gboolean g_ril_request_deactivate_data_call(GRil *gril, |
2474 | const struct req_deactivate_data_call *req, |
2475 | struct parcel *rilp, |
2476 | @@ -141,6 +147,40 @@ |
2477 | const gchar *aid_str, |
2478 | struct parcel *rilp); |
2479 | |
2480 | +void g_ril_request_sms_cmgs(GRil *gril, |
2481 | + const struct req_sms_cmgs *req, |
2482 | + struct parcel *rilp); |
2483 | + |
2484 | +void g_ril_request_sms_acknowledge(GRil *gril, struct parcel *rilp); |
2485 | + |
2486 | +void g_ril_request_set_smsc_address(GRil *gril, |
2487 | + const struct ofono_phone_number *sca, |
2488 | + struct parcel *rilp); |
2489 | + |
2490 | +void g_ril_request_dial(GRil *gril, |
2491 | + const struct ofono_phone_number *ph, |
2492 | + enum ofono_clir_option clir, |
2493 | + struct parcel *rilp); |
2494 | + |
2495 | +void g_ril_request_hangup(GRil *gril, |
2496 | + unsigned call_id, |
2497 | + struct parcel *rilp); |
2498 | + |
2499 | +void g_ril_request_dtmf(GRil *gril, |
2500 | + char dtmf_char, |
2501 | + struct parcel *rilp); |
2502 | + |
2503 | +void g_ril_request_separate_conn(GRil *gril, |
2504 | + int call_id, |
2505 | + struct parcel *rilp); |
2506 | + |
2507 | +void g_ril_request_set_supp_svc_notif(GRil *gril, |
2508 | + struct parcel *rilp); |
2509 | + |
2510 | +void g_ril_request_set_mute(GRil *gril, |
2511 | + int muted, |
2512 | + struct parcel *rilp); |
2513 | + |
2514 | #ifdef __cplusplus |
2515 | } |
2516 | #endif |
2517 | |
2518 | === modified file 'gril/grilunsol.c' |
2519 | --- gril/grilunsol.c 2013-11-15 23:16:57 +0000 |
2520 | +++ gril/grilunsol.c 2013-12-04 21:58:23 +0000 |
2521 | @@ -34,7 +34,9 @@ |
2522 | #include <ofono/log.h> |
2523 | #include <ofono/modem.h> |
2524 | #include <ofono/gprs-context.h> |
2525 | +#include "util.h" |
2526 | |
2527 | +#include "common.h" |
2528 | #include "grilunsol.h" |
2529 | |
2530 | /* Minimum size is two int32s version/number of calls */ |
2531 | @@ -44,7 +46,7 @@ |
2532 | * Minimum NITZ is: 'yy/mm/dd,hh:mm:ss' |
2533 | * TZ '(+/-)tz,dt' are optional |
2534 | */ |
2535 | -#define MIN_NITZ_SIZE 17 |
2536 | +#define MIN_NITZ_SIZE 17 |
2537 | |
2538 | static gint data_call_compare(gconstpointer a, gconstpointer b) |
2539 | { |
2540 | @@ -84,7 +86,7 @@ |
2541 | } |
2542 | |
2543 | struct unsol_data_call_list *g_ril_unsol_parse_data_call_list(GRil *gril, |
2544 | - struct ril_msg *message, |
2545 | + const struct ril_msg *message, |
2546 | struct ofono_error *error) |
2547 | { |
2548 | struct data_call *call; |
2549 | @@ -163,7 +165,7 @@ |
2550 | return reply; |
2551 | } |
2552 | |
2553 | -char *g_ril_unsol_parse_nitz(GRil *gril, struct ril_msg *message) |
2554 | +char *g_ril_unsol_parse_nitz(GRil *gril, const struct ril_msg *message) |
2555 | { |
2556 | struct parcel rilp; |
2557 | gchar *nitz = NULL; |
2558 | @@ -187,3 +189,93 @@ |
2559 | error: |
2560 | return nitz; |
2561 | } |
2562 | + |
2563 | +void g_ril_unsol_free_sms_data(struct unsol_sms_data *unsol) |
2564 | +{ |
2565 | + if (unsol != NULL) { |
2566 | + g_free(unsol->data); |
2567 | + g_free(unsol); |
2568 | + } |
2569 | +} |
2570 | + |
2571 | +struct unsol_sms_data *g_ril_unsol_parse_new_sms(GRil *gril, |
2572 | + const struct ril_msg *message) |
2573 | +{ |
2574 | + struct parcel rilp; |
2575 | + char *ril_pdu; |
2576 | + size_t ril_pdu_len; |
2577 | + struct unsol_sms_data *sms_data; |
2578 | + |
2579 | + sms_data = g_new0(struct unsol_sms_data, 1); |
2580 | + if (sms_data == NULL) { |
2581 | + ofono_error("%s out of memory", __func__); |
2582 | + goto error; |
2583 | + } |
2584 | + |
2585 | + g_ril_init_parcel(message, &rilp); |
2586 | + |
2587 | + ril_pdu = parcel_r_string(&rilp); |
2588 | + if (ril_pdu == NULL) { |
2589 | + ofono_error("%s Unable to parse notification", __func__); |
2590 | + goto error; |
2591 | + } |
2592 | + |
2593 | + ril_pdu_len = strlen(ril_pdu); |
2594 | + |
2595 | + sms_data->data = decode_hex(ril_pdu, ril_pdu_len, |
2596 | + &sms_data->length, -1); |
2597 | + if (sms_data->data == NULL) { |
2598 | + ofono_error("%s Unable to decode notification", __func__); |
2599 | + goto error_dec; |
2600 | + } |
2601 | + |
2602 | + g_ril_append_print_buf(gril, "{%s}", ril_pdu); |
2603 | + g_ril_print_unsol(gril, message); |
2604 | + |
2605 | + g_free(ril_pdu); |
2606 | + |
2607 | + return sms_data; |
2608 | + |
2609 | +error_dec: |
2610 | + g_free(ril_pdu); |
2611 | +error: |
2612 | + g_ril_unsol_free_sms_data(sms_data); |
2613 | + return NULL; |
2614 | +} |
2615 | + |
2616 | +void g_ril_unsol_free_supp_svc_notif(struct unsol_supp_svc_notif *unsol) |
2617 | +{ |
2618 | + g_free(unsol); |
2619 | +} |
2620 | + |
2621 | +struct unsol_supp_svc_notif *g_ril_unsol_parse_supp_svc_notif(GRil *gril, |
2622 | + struct ril_msg *message) |
2623 | +{ |
2624 | + struct parcel rilp; |
2625 | + char *tmp_number; |
2626 | + int type; |
2627 | + struct unsol_supp_svc_notif *unsol = |
2628 | + g_new0(struct unsol_supp_svc_notif, 1); |
2629 | + |
2630 | + g_ril_init_parcel(message, &rilp); |
2631 | + |
2632 | + unsol->notif_type = parcel_r_int32(&rilp); |
2633 | + unsol->code = parcel_r_int32(&rilp); |
2634 | + unsol->index = parcel_r_int32(&rilp); |
2635 | + type = parcel_r_int32(&rilp); |
2636 | + tmp_number = parcel_r_string(&rilp); |
2637 | + |
2638 | + if (tmp_number != NULL) { |
2639 | + strncpy(unsol->number.number, tmp_number, |
2640 | + OFONO_MAX_PHONE_NUMBER_LENGTH); |
2641 | + unsol->number.type = type; |
2642 | + g_free(tmp_number); |
2643 | + } |
2644 | + |
2645 | + g_ril_append_print_buf(gril, "{%d,%d,%d,%d,%s}", |
2646 | + unsol->notif_type, unsol->code, unsol->index, |
2647 | + type, tmp_number); |
2648 | + g_ril_print_unsol(gril, message); |
2649 | + |
2650 | + return unsol; |
2651 | +} |
2652 | |
2653 | === modified file 'gril/grilunsol.h' |
2654 | --- gril/grilunsol.h 2013-11-15 23:16:57 +0000 |
2655 | +++ gril/grilunsol.h 2013-12-04 21:58:23 +0000 |
2656 | @@ -49,14 +49,35 @@ |
2657 | char *gateways; |
2658 | }; |
2659 | |
2660 | +struct unsol_sms_data { |
2661 | + long length; |
2662 | + unsigned char *data; |
2663 | +}; |
2664 | + |
2665 | +struct unsol_supp_svc_notif { |
2666 | + int notif_type; |
2667 | + int code; |
2668 | + int index; |
2669 | + struct ofono_phone_number number; |
2670 | +}; |
2671 | + |
2672 | void g_ril_unsol_free_data_call_list(struct unsol_data_call_list *unsol); |
2673 | |
2674 | struct unsol_data_call_list *g_ril_unsol_parse_data_call_list(GRil *gril, |
2675 | - struct ril_msg *message, |
2676 | + const struct ril_msg *message, |
2677 | struct ofono_error *error); |
2678 | |
2679 | -char *g_ril_unsol_parse_nitz(GRil *gril, struct ril_msg *message); |
2680 | - |
2681 | +char *g_ril_unsol_parse_nitz(GRil *gril, const struct ril_msg *message); |
2682 | + |
2683 | +void g_ril_unsol_free_sms_data(struct unsol_sms_data *unsol); |
2684 | + |
2685 | +struct unsol_sms_data *g_ril_unsol_parse_new_sms(GRil *gril, |
2686 | + const struct ril_msg *message); |
2687 | + |
2688 | +void g_ril_unsol_free_supp_svc_notif(struct unsol_supp_svc_notif *unsol); |
2689 | + |
2690 | +struct unsol_supp_svc_notif *g_ril_unsol_parse_supp_svc_notif(GRil *gril, |
2691 | + struct ril_msg *message); |
2692 | |
2693 | #ifdef __cplusplus |
2694 | } |
2695 | |
2696 | === modified file 'gril/grilutil.c' |
2697 | --- gril/grilutil.c 2013-09-09 19:21:32 +0000 |
2698 | +++ gril/grilutil.c 2013-12-04 21:58:23 +0000 |
2699 | @@ -413,6 +413,7 @@ |
2700 | case RIL_UNSOL_ON_USSD_REQUEST: return "UNSOL_ON_USSD_REQUEST(obsolete)"; |
2701 | case RIL_UNSOL_NITZ_TIME_RECEIVED: return "UNSOL_NITZ_TIME_RECEIVED"; |
2702 | case RIL_UNSOL_SIGNAL_STRENGTH: return "UNSOL_SIGNAL_STRENGTH"; |
2703 | + case RIL_UNSOL_SUPP_SVC_NOTIFICATION: return "UNSOL_SUPP_SVC_NOTIFICATION"; |
2704 | case RIL_UNSOL_STK_SESSION_END: return "UNSOL_STK_SESSION_END"; |
2705 | case RIL_UNSOL_STK_PROACTIVE_COMMAND: return "UNSOL_STK_PROACTIVE_COMMAND"; |
2706 | case RIL_UNSOL_STK_EVENT_NOTIFY: return "UNSOL_STK_EVENT_NOTIFY"; |
2707 | |
2708 | === modified file 'gril/parcel.c' |
2709 | --- gril/parcel.c 2013-11-05 16:26:21 +0000 |
2710 | +++ gril/parcel.c 2013-12-04 21:58:23 +0000 |
2711 | @@ -73,7 +73,7 @@ |
2712 | int32_t parcel_r_int32(struct parcel *p) |
2713 | { |
2714 | int32_t ret; |
2715 | - ret = *((int32_t *) (p->data + p->offset)); |
2716 | + ret = *((int32_t *) (void *) (p->data + p->offset)); |
2717 | p->offset += sizeof(int32_t); |
2718 | return ret; |
2719 | } |
2720 | @@ -87,7 +87,7 @@ |
2721 | |
2722 | if (p->offset + sizeof(int32_t) < p->capacity) { |
2723 | /* There's enough space */ |
2724 | - *((int32_t *) (p->data + p->offset)) = val; |
2725 | + *((int32_t *) (void *) (p->data + p->offset)) = val; |
2726 | p->offset += sizeof(int32_t); |
2727 | p->size += sizeof(int32_t); |
2728 | break; |
2729 | @@ -127,7 +127,8 @@ |
2730 | if (p->offset + len < p->capacity) { |
2731 | /* There's enough space */ |
2732 | memcpy(p->data + p->offset, gs16, gs16_size); |
2733 | - *((char16_t *) (p->data + p->offset + gs16_size)) = 0; |
2734 | + *((char16_t *) (void *) |
2735 | + (p->data + p->offset + gs16_size)) = 0; |
2736 | p->offset += padded; |
2737 | p->size += padded; |
2738 | if (padded != len) { |
2739 | @@ -148,7 +149,8 @@ |
2740 | DBG("Writing %d bytes, padded to %d\n", |
2741 | (int) len, (int) padded); |
2742 | |
2743 | - *((uint32_t*)(p->data + p->offset - 4)) &= |
2744 | + *((uint32_t*) (void *) |
2745 | + (p->data + p->offset - 4)) &= |
2746 | mask[padded - len]; |
2747 | } |
2748 | break; |
2749 | @@ -172,7 +174,7 @@ |
2750 | if (len16 < 0) |
2751 | return NULL; |
2752 | |
2753 | - ret = g_utf16_to_utf8((gunichar2 *) (p->data + p->offset), |
2754 | + ret = g_utf16_to_utf8((gunichar2 *) (void *) (p->data + p->offset), |
2755 | len16, NULL, NULL, NULL); |
2756 | if (ret == NULL) |
2757 | return NULL; |
2758 | |
2759 | === modified file 'gril/ril_constants.h' |
2760 | --- gril/ril_constants.h 2013-09-09 19:21:32 +0000 |
2761 | +++ gril/ril_constants.h 2013-12-04 21:58:23 +0000 |
2762 | @@ -76,6 +76,31 @@ |
2763 | #define RADIO_TECH_HSPAP 15 |
2764 | #define RADIO_TECH_GSM 16 |
2765 | |
2766 | +/* See RIL_REQUEST_LAST_CALL_FAIL_CAUSE */ |
2767 | +#define CALL_FAIL_UNOBTAINABLE_NUMBER 1 |
2768 | +#define CALL_FAIL_NORMAL 16 |
2769 | +#define CALL_FAIL_BUSY 17 |
2770 | +#define CALL_FAIL_CONGESTION 34 |
2771 | +#define CALL_FAIL_ACM_LIMIT_EXCEEDED 68 |
2772 | +#define CALL_FAIL_CALL_BARRED 240 |
2773 | +#define CALL_FAIL_FDN_BLOCKED 241 |
2774 | +#define CALL_FAIL_IMSI_UNKNOWN_IN_VLR 242 |
2775 | +#define CALL_FAIL_IMEI_NOT_ACCEPTED 243 |
2776 | +#define CALL_FAIL_DIAL_MODIFIED_TO_USSD 244 |
2777 | +#define CALL_FAIL_DIAL_MODIFIED_TO_SS 245 |
2778 | +#define CALL_FAIL_DIAL_MODIFIED_TO_DIAL 246 |
2779 | +#define CALL_FAIL_CDMA_LOCKED_UNTIL_POWER_CYCLE 1000 |
2780 | +#define CALL_FAIL_CDMA_DROP 1001 |
2781 | +#define CALL_FAIL_CDMA_INTERCEPT 1002 |
2782 | +#define CALL_FAIL_CDMA_REORDER 1003 |
2783 | +#define CALL_FAIL_CDMA_SO_REJECT 1004 |
2784 | +#define CALL_FAIL_CDMA_RETRY_ORDER 1005 |
2785 | +#define CALL_FAIL_CDMA_ACCESS_FAILURE 1006 |
2786 | +#define CALL_FAIL_CDMA_PREEMPTED 1007 |
2787 | +#define CALL_FAIL_CDMA_NOT_EMERGENCY 1008 |
2788 | +#define CALL_FAIL_CDMA_ACCESS_BLOCKED 1009 |
2789 | +#define CALL_FAIL_ERROR_UNSPECIFIED 0xffff |
2790 | + |
2791 | /* see RIL_REQUEST_DEACTIVATE_DATA_CALL parameter*/ |
2792 | #define RIL_DEACTIVATE_DATA_CALL_NO_REASON 0 |
2793 | #define RIL_DEACTIVATE_DATA_CALL_RADIO_SHUTDOWN 1 |
2794 | |
2795 | === modified file 'include/types.h' |
2796 | --- include/types.h 2013-09-09 19:21:32 +0000 |
2797 | +++ include/types.h 2013-12-04 21:58:23 +0000 |
2798 | @@ -83,6 +83,12 @@ |
2799 | #define OFONO_MAX_PHONE_NUMBER_LENGTH 80 |
2800 | #define OFONO_MAX_CALLER_NAME_LENGTH 80 |
2801 | |
2802 | +/* Number types, 3GPP TS 24.008 subclause 10.5.4.7, octect 3 */ |
2803 | +/* Unknown, ISDN numbering plan */ |
2804 | +#define OFONO_NUMBER_TYPE_UNKNOWN 129 |
2805 | +/* International, ISDN numbering plan */ |
2806 | +#define OFONO_NUMBER_TYPE_INTERNATIONAL 145 |
2807 | + |
2808 | struct ofono_phone_number { |
2809 | char number[OFONO_MAX_PHONE_NUMBER_LENGTH + 1]; |
2810 | int type; |
2811 | |
2812 | === added file 'plugins/smshistory.c' |
2813 | --- plugins/smshistory.c 1970-01-01 00:00:00 +0000 |
2814 | +++ plugins/smshistory.c 2013-12-04 21:58:23 +0000 |
2815 | @@ -0,0 +1,151 @@ |
2816 | +/* |
2817 | + * |
2818 | + * oFono - Open Source Telephony |
2819 | + * |
2820 | + * Copyright (C) 2008-2011 Intel Corporation. All rights reserved. |
2821 | + * Copyright (C) 2013 Jolla Ltd. All rights reserved. |
2822 | + * Copyright (C) 2013 Canonical Ltd. |
2823 | + * |
2824 | + * This program is free software; you can redistribute it and/or modify |
2825 | + * it under the terms of the GNU General Public License version 2 as |
2826 | + * published by the Free Software Foundation. |
2827 | + * |
2828 | + * This program is distributed in the hope that it will be useful, |
2829 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2830 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2831 | + * GNU General Public License for more details. |
2832 | + * |
2833 | + * You should have received a copy of the GNU General Public License |
2834 | + * along with this program; if not, write to the Free Software |
2835 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
2836 | + * |
2837 | + */ |
2838 | + |
2839 | +#ifdef HAVE_CONFIG_H |
2840 | +#include <config.h> |
2841 | +#endif |
2842 | + |
2843 | +#include <string.h> |
2844 | +#include <stdio.h> |
2845 | +#include <glib.h> |
2846 | +#include <gdbus.h> |
2847 | + |
2848 | +#define OFONO_API_SUBJECT_TO_CHANGE |
2849 | +#include <ofono/plugin.h> |
2850 | +#include <ofono/log.h> |
2851 | +#include <ofono/history.h> |
2852 | +#include <ofono/types.h> |
2853 | + |
2854 | +#include "ofono.h" |
2855 | +#include "common.h" |
2856 | + |
2857 | +static const char msg_prefix[] = "/message_"; |
2858 | + |
2859 | +static int sms_history_probe(struct ofono_history_context *context) |
2860 | +{ |
2861 | + ofono_debug("SMS History Probe for modem: %p", context->modem); |
2862 | + return 0; |
2863 | +} |
2864 | + |
2865 | +static void sms_history_remove(struct ofono_history_context *context) |
2866 | +{ |
2867 | + ofono_debug("SMS History Remove for modem: %p", context->modem); |
2868 | +} |
2869 | + |
2870 | +static void sms_history_sms_send_status( |
2871 | + struct ofono_history_context *context, |
2872 | + const struct ofono_uuid *uuid, |
2873 | + time_t when, |
2874 | + enum ofono_history_sms_status s) |
2875 | +{ |
2876 | + if ((s == OFONO_HISTORY_SMS_STATUS_DELIVERED) |
2877 | + || (s == OFONO_HISTORY_SMS_STATUS_DELIVER_FAILED)) { |
2878 | + |
2879 | + DBusMessage *signal; |
2880 | + DBusMessageIter iter; |
2881 | + DBusMessageIter dict; |
2882 | + const char *uuid_str; |
2883 | + char *msg_uuid_str; |
2884 | + size_t msg_len; |
2885 | + struct ofono_atom *atom; |
2886 | + const char *path; |
2887 | + DBusConnection *conn; |
2888 | + int delivered; |
2889 | + |
2890 | + atom = __ofono_modem_find_atom(context->modem, |
2891 | + OFONO_ATOM_TYPE_SMS); |
2892 | + if (atom == NULL) |
2893 | + return; |
2894 | + |
2895 | + path = __ofono_atom_get_path(atom); |
2896 | + if (path == NULL) |
2897 | + return; |
2898 | + |
2899 | + conn = ofono_dbus_get_connection(); |
2900 | + if (conn == NULL) |
2901 | + return; |
2902 | + |
2903 | + delivered = (s == OFONO_HISTORY_SMS_STATUS_DELIVERED); |
2904 | + |
2905 | + uuid_str = ofono_uuid_to_str(uuid); |
2906 | + /* sizeof adds extra space for one '\0' */ |
2907 | + msg_len = strlen(path) + sizeof(msg_prefix) |
2908 | + + strlen(uuid_str); |
2909 | + |
2910 | + msg_uuid_str = g_try_malloc(msg_len); |
2911 | + if (msg_uuid_str == NULL) |
2912 | + return; |
2913 | + |
2914 | + /* modem path + msg_prefix + UUID as string */ |
2915 | + snprintf(msg_uuid_str, msg_len, "%s%s%s", path, |
2916 | + msg_prefix, uuid_str); |
2917 | + |
2918 | + DBG("SMS %s delivery success: %d", msg_uuid_str, delivered); |
2919 | + |
2920 | + signal = dbus_message_new_signal(path, |
2921 | + OFONO_MESSAGE_MANAGER_INTERFACE, |
2922 | + "StatusReport"); |
2923 | + if (signal != NULL) { |
2924 | + dbus_message_iter_init_append(signal, &iter); |
2925 | + dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, |
2926 | + &msg_uuid_str); |
2927 | + |
2928 | + dbus_message_iter_open_container( |
2929 | + &iter, |
2930 | + DBUS_TYPE_ARRAY, |
2931 | + OFONO_PROPERTIES_ARRAY_SIGNATURE, |
2932 | + &dict); |
2933 | + ofono_dbus_dict_append(&dict, "Delivered", |
2934 | + DBUS_TYPE_BOOLEAN, |
2935 | + &delivered); |
2936 | + dbus_message_iter_close_container(&iter, &dict); |
2937 | + |
2938 | + g_dbus_send_message(conn, signal); |
2939 | + } |
2940 | + |
2941 | + g_free(msg_uuid_str); |
2942 | + } |
2943 | +} |
2944 | + |
2945 | +static struct ofono_history_driver smshistory_driver = { |
2946 | + .name = "SMS History", |
2947 | + .probe = sms_history_probe, |
2948 | + .remove = sms_history_remove, |
2949 | + .sms_send_status = sms_history_sms_send_status, |
2950 | +}; |
2951 | + |
2952 | +static int sms_history_init(void) |
2953 | +{ |
2954 | + DBG(""); |
2955 | + return ofono_history_driver_register(&smshistory_driver); |
2956 | +} |
2957 | + |
2958 | +static void sms_history_exit(void) |
2959 | +{ |
2960 | + DBG(""); |
2961 | + ofono_history_driver_unregister(&smshistory_driver); |
2962 | +} |
2963 | + |
2964 | +OFONO_PLUGIN_DEFINE(smshistory, "SMS History Plugin", |
2965 | + VERSION, OFONO_PLUGIN_PRIORITY_DEFAULT, |
2966 | + sms_history_init, sms_history_exit) |
2967 | |
2968 | === modified file 'src/stk.c' |
2969 | --- src/stk.c 2012-11-28 16:31:15 +0000 |
2970 | +++ src/stk.c 2013-12-04 21:58:23 +0000 |
2971 | @@ -280,7 +280,7 @@ |
2972 | |
2973 | e.type = STK_ENVELOPE_TYPE_CBS_PP_DOWNLOAD; |
2974 | e.src = STK_DEVICE_IDENTITY_TYPE_NETWORK; |
2975 | - memcpy(&e.cbs_pp_download.page, msg, sizeof(msg)); |
2976 | + memcpy(&e.cbs_pp_download.page, msg, sizeof(*msg)); |
2977 | |
2978 | err = stk_send_envelope(stk, &e, stk_cbs_download_cb, |
2979 | ENVELOPE_RETRIES_DEFAULT); |
2980 | |
2981 | === modified file 'src/storage.h' |
2982 | --- src/storage.h 2013-10-02 15:37:04 +0000 |
2983 | +++ src/storage.h 2013-12-04 21:58:23 +0000 |
2984 | @@ -25,7 +25,7 @@ |
2985 | #define TFR |
2986 | #endif |
2987 | |
2988 | -#include <sys/types.h> |
2989 | +#include <stdlib.h> |
2990 | #include <fcntl.h> |
2991 | |
2992 | int create_dirs(const char *filename, const mode_t mode); |
2993 | |
2994 | === modified file 'test/monitor-ofono' |
2995 | --- test/monitor-ofono 2013-10-02 15:37:04 +0000 |
2996 | +++ test/monitor-ofono 2013-12-04 21:58:23 +0000 |
2997 | @@ -138,7 +138,7 @@ |
2998 | interface_keyword="interface") |
2999 | |
3000 | for member in ["IncomingBroadcast", "EmergencyBroadcast", |
3001 | - "IncomingMessage", "ImmediateMessage"]: |
3002 | + "IncomingMessage", "ImmediateMessage", "StatusReport"]: |
3003 | bus.add_signal_receiver(message, |
3004 | bus_name="org.ofono", |
3005 | signal_name = member, |
3006 | |
3007 | === modified file 'unit/test-caif.c' |
3008 | --- unit/test-caif.c 2011-10-10 20:40:17 +0000 |
3009 | +++ unit/test-caif.c 2013-12-04 21:58:23 +0000 |
3010 | @@ -140,10 +140,8 @@ |
3011 | |
3012 | static void test_basic(void) |
3013 | { |
3014 | - if (g_test_trap_fork(60 * 1000 * 1000, 0) == TRUE) { |
3015 | - test_connect(TRUE); |
3016 | - exit(0); |
3017 | - } |
3018 | + g_test_trap_subprocess("/testcaif/basic:subprocess", |
3019 | + 60 * 1000 * 1000, 0); |
3020 | |
3021 | g_test_trap_assert_passed(); |
3022 | //g_test_trap_assert_stderr("failed"); |
3023 | @@ -151,21 +149,33 @@ |
3024 | |
3025 | static void test_chnlat(void) |
3026 | { |
3027 | - if (g_test_trap_fork(60 * 1000 * 1000, 0) == TRUE) { |
3028 | - test_connect(FALSE); |
3029 | - exit(0); |
3030 | - } |
3031 | + g_test_trap_subprocess("/testcaif/chnlat:subprocess", |
3032 | + 60 * 1000 * 1000, 0); |
3033 | |
3034 | g_test_trap_assert_passed(); |
3035 | //g_test_trap_assert_stderr("failed"); |
3036 | } |
3037 | |
3038 | +static void test_connect_sock(void) |
3039 | +{ |
3040 | + test_connect(TRUE); |
3041 | +} |
3042 | + |
3043 | +static void test_connect_no_sock(void) |
3044 | +{ |
3045 | + test_connect(FALSE); |
3046 | +} |
3047 | + |
3048 | int main(int argc, char **argv) |
3049 | { |
3050 | g_test_init(&argc, &argv, NULL); |
3051 | |
3052 | g_test_add_func("/testcaif/basic", test_basic); |
3053 | g_test_add_func("/testcaif/chnlat", test_chnlat); |
3054 | + g_test_add_func("/testcaif/basic:subprocess", |
3055 | + test_connect_sock); |
3056 | + g_test_add_func("/testcaif/chnlat:subprocess", |
3057 | + test_connect_no_sock); |
3058 | |
3059 | return g_test_run(); |
3060 | } |
3061 | |
3062 | === modified file 'unit/test-grilreply.c' |
3063 | --- unit/test-grilreply.c 2013-11-05 16:28:08 +0000 |
3064 | +++ unit/test-grilreply.c 2013-12-04 21:58:23 +0000 |
3065 | @@ -33,6 +33,7 @@ |
3066 | #include <ofono/gprs-context.h> |
3067 | #include <ofono/types.h> |
3068 | |
3069 | +#include "common.h" |
3070 | #include "grilreply.h" |
3071 | |
3072 | /* |
3073 | @@ -41,6 +42,13 @@ |
3074 | * once more tests are added. |
3075 | */ |
3076 | |
3077 | +typedef struct reg_state_test reg_state_test; |
3078 | +struct reg_state_test { |
3079 | + int status; |
3080 | + int tech; |
3081 | + const struct ril_msg msg; |
3082 | +}; |
3083 | + |
3084 | static const struct ril_msg reply_data_call_invalid_1 = { |
3085 | .buf = "", |
3086 | .buf_len = 0, |
3087 | @@ -55,8 +63,8 @@ |
3088 | */ |
3089 | static const guchar reply_data_call_invalid_parcel2[] = { |
3090 | 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
3091 | - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, |
3092 | - 0x02, 0x00, 0x00, 0x00, 0x49, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00 |
3093 | + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, |
3094 | + 0x02, 0x00, 0x00, 0x00, 0x49, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00 |
3095 | }; |
3096 | |
3097 | static const struct ril_msg reply_data_call_invalid_2 = { |
3098 | @@ -75,20 +83,20 @@ |
3099 | */ |
3100 | static const guchar reply_data_call_invalid_parcel3[] = { |
3101 | 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
3102 | - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, |
3103 | + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, |
3104 | 0xff, 0xff, 0xff, 0xff, |
3105 | 0x0a, 0x00, 0x00, 0x00, 0x72, 0x00, 0x6d, 0x00, 0x6e, 0x00, 0x65, 0x00, |
3106 | 0x74, 0x00, 0x5f, 0x00, 0x75, 0x00, 0x73, 0x00, 0x62, 0x00, 0x30, 0x00, |
3107 | - 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, |
3108 | - 0x2e, 0x00, 0x31, 0x00, 0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, |
3109 | + 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, |
3110 | + 0x2e, 0x00, 0x31, 0x00, 0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, |
3111 | 0x33, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x35, 0x00, 0x34, 0x00, |
3112 | 0x2f, 0x00, 0x33, 0x00, 0x30, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, |
3113 | - 0x31, 0x00, 0x37, 0x00, 0x32, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00, |
3114 | - 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, |
3115 | + 0x31, 0x00, 0x37, 0x00, 0x32, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00, |
3116 | + 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, |
3117 | 0x30, 0x00, 0x33, 0x00, 0x20, 0x00, 0x31, 0x00, 0x37, 0x00, 0x32, 0x00, |
3118 | 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, |
3119 | - 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x30, 0x00, 0x33, 0x00, 0x00, 0x00, |
3120 | - 0x0e, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x31, 0x00, |
3121 | + 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x30, 0x00, 0x33, 0x00, 0x00, 0x00, |
3122 | + 0x0e, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x31, 0x00, |
3123 | 0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, 0x33, 0x00, 0x35, 0x00, |
3124 | 0x2e, 0x00, 0x31, 0x00, 0x35, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00 |
3125 | }; |
3126 | @@ -109,18 +117,18 @@ |
3127 | */ |
3128 | static const guchar reply_data_call_invalid_parcel4[] = { |
3129 | 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
3130 | - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, |
3131 | - 0x02, 0x00, 0x00, 0x00, 0x49, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, |
3132 | - 0xff, 0xff, 0xff, 0xff, 0x11, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, |
3133 | - 0x2e, 0x00, 0x31, 0x00, 0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, |
3134 | + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, |
3135 | + 0x02, 0x00, 0x00, 0x00, 0x49, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, |
3136 | + 0xff, 0xff, 0xff, 0xff, 0x11, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, |
3137 | + 0x2e, 0x00, 0x31, 0x00, 0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, |
3138 | 0x33, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x35, 0x00, 0x34, 0x00, |
3139 | 0x2f, 0x00, 0x33, 0x00, 0x30, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, |
3140 | - 0x31, 0x00, 0x37, 0x00, 0x32, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00, |
3141 | - 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, |
3142 | + 0x31, 0x00, 0x37, 0x00, 0x32, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00, |
3143 | + 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, |
3144 | 0x30, 0x00, 0x33, 0x00, 0x20, 0x00, 0x31, 0x00, 0x37, 0x00, 0x32, 0x00, |
3145 | 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, |
3146 | - 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x30, 0x00, 0x33, 0x00, 0x00, 0x00, |
3147 | - 0x0e, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x31, 0x00, |
3148 | + 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x30, 0x00, 0x33, 0x00, 0x00, 0x00, |
3149 | + 0x0e, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x31, 0x00, |
3150 | 0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, 0x33, 0x00, 0x35, 0x00, |
3151 | 0x2e, 0x00, 0x31, 0x00, 0x35, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00 |
3152 | }; |
3153 | @@ -141,17 +149,17 @@ |
3154 | */ |
3155 | static const guchar reply_data_call_invalid_parcel5[] = { |
3156 | 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
3157 | - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, |
3158 | - 0x02, 0x00, 0x00, 0x00, 0x49, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, |
3159 | + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, |
3160 | + 0x02, 0x00, 0x00, 0x00, 0x49, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, |
3161 | 0x0a, 0x00, 0x00, 0x00, 0x72, 0x00, 0x6d, 0x00, 0x6e, 0x00, 0x65, 0x00, |
3162 | 0x74, 0x00, 0x5f, 0x00, 0x75, 0x00, 0x73, 0x00, 0x62, 0x00, 0x30, 0x00, |
3163 | - 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x1d, 0x00, 0x00, 0x00, |
3164 | - 0x31, 0x00, 0x37, 0x00, 0x32, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00, |
3165 | - 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, |
3166 | + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x1d, 0x00, 0x00, 0x00, |
3167 | + 0x31, 0x00, 0x37, 0x00, 0x32, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00, |
3168 | + 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, |
3169 | 0x30, 0x00, 0x33, 0x00, 0x20, 0x00, 0x31, 0x00, 0x37, 0x00, 0x32, 0x00, |
3170 | 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, |
3171 | - 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x30, 0x00, 0x33, 0x00, 0x00, 0x00, |
3172 | - 0x0e, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x31, 0x00, |
3173 | + 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x30, 0x00, 0x33, 0x00, 0x00, 0x00, |
3174 | + 0x0e, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x31, 0x00, |
3175 | 0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, 0x33, 0x00, 0x35, 0x00, |
3176 | 0x2e, 0x00, 0x31, 0x00, 0x35, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00 |
3177 | }; |
3178 | @@ -172,19 +180,19 @@ |
3179 | */ |
3180 | static const guchar reply_data_call_invalid_parcel6[] = { |
3181 | 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
3182 | - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, |
3183 | - 0x02, 0x00, 0x00, 0x00, 0x49, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, |
3184 | + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, |
3185 | + 0x02, 0x00, 0x00, 0x00, 0x49, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, |
3186 | 0x0a, 0x00, 0x00, 0x00, 0x72, 0x00, 0x6d, 0x00, 0x6e, 0x00, 0x65, 0x00, |
3187 | 0x74, 0x00, 0x5f, 0x00, 0x75, 0x00, 0x73, 0x00, 0x62, 0x00, 0x30, 0x00, |
3188 | - 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, |
3189 | - 0x2e, 0x00, 0x31, 0x00, 0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, |
3190 | + 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, |
3191 | + 0x2e, 0x00, 0x31, 0x00, 0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, |
3192 | 0x33, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x35, 0x00, 0x34, 0x00, |
3193 | 0x2f, 0x00, 0x33, 0x00, 0x30, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, |
3194 | - 0x31, 0x00, 0x37, 0x00, 0x32, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00, |
3195 | - 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, |
3196 | + 0x31, 0x00, 0x37, 0x00, 0x32, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00, |
3197 | + 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, |
3198 | 0x30, 0x00, 0x33, 0x00, 0x20, 0x00, 0x31, 0x00, 0x37, 0x00, 0x32, 0x00, |
3199 | 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, |
3200 | - 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x30, 0x00, 0x33, 0x00, 0x00, 0x00, |
3201 | + 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x30, 0x00, 0x33, 0x00, 0x00, 0x00, |
3202 | 0xff, 0xff, 0xff, 0xff |
3203 | }; |
3204 | |
3205 | @@ -204,15 +212,15 @@ |
3206 | */ |
3207 | static const guchar reply_data_call_invalid_parcel7[] = { |
3208 | 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
3209 | - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, |
3210 | - 0x02, 0x00, 0x00, 0x00, 0x49, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, |
3211 | + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, |
3212 | + 0x02, 0x00, 0x00, 0x00, 0x49, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, |
3213 | 0x0a, 0x00, 0x00, 0x00, 0x72, 0x00, 0x6d, 0x00, 0x6e, 0x00, 0x65, 0x00, |
3214 | 0x74, 0x00, 0x5f, 0x00, 0x75, 0x00, 0x73, 0x00, 0x62, 0x00, 0x30, 0x00, |
3215 | - 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, |
3216 | - 0x2e, 0x00, 0x31, 0x00, 0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, |
3217 | + 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, |
3218 | + 0x2e, 0x00, 0x31, 0x00, 0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, |
3219 | 0x33, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x35, 0x00, 0x34, 0x00, |
3220 | 0x2f, 0x00, 0x33, 0x00, 0x30, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, |
3221 | - 0x0e, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x31, 0x00, |
3222 | + 0x0e, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x31, 0x00, |
3223 | 0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, 0x33, 0x00, 0x35, 0x00, |
3224 | 0x2e, 0x00, 0x31, 0x00, 0x35, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00 |
3225 | }; |
3226 | @@ -233,20 +241,20 @@ |
3227 | */ |
3228 | static const guchar reply_data_call_valid_parcel1[] = { |
3229 | 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
3230 | - 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, |
3231 | - 0x02, 0x00, 0x00, 0x00, 0x49, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, |
3232 | + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, |
3233 | + 0x02, 0x00, 0x00, 0x00, 0x49, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, |
3234 | 0x0a, 0x00, 0x00, 0x00, 0x72, 0x00, 0x6d, 0x00, 0x6e, 0x00, 0x65, 0x00, |
3235 | 0x74, 0x00, 0x5f, 0x00, 0x75, 0x00, 0x73, 0x00, 0x62, 0x00, 0x30, 0x00, |
3236 | - 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, |
3237 | - 0x2e, 0x00, 0x31, 0x00, 0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, |
3238 | + 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, |
3239 | + 0x2e, 0x00, 0x31, 0x00, 0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, |
3240 | 0x33, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x35, 0x00, 0x34, 0x00, |
3241 | 0x2f, 0x00, 0x33, 0x00, 0x30, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, |
3242 | - 0x31, 0x00, 0x37, 0x00, 0x32, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00, |
3243 | - 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, |
3244 | + 0x31, 0x00, 0x37, 0x00, 0x32, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00, |
3245 | + 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, |
3246 | 0x30, 0x00, 0x33, 0x00, 0x20, 0x00, 0x31, 0x00, 0x37, 0x00, 0x32, 0x00, |
3247 | 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, |
3248 | - 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x30, 0x00, 0x33, 0x00, 0x00, 0x00, |
3249 | - 0x0e, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x31, 0x00, |
3250 | + 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x30, 0x00, 0x33, 0x00, 0x00, 0x00, |
3251 | + 0x0e, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x31, 0x00, |
3252 | 0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, 0x33, 0x00, 0x35, 0x00, |
3253 | 0x2e, 0x00, 0x31, 0x00, 0x35, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00 |
3254 | }; |
3255 | @@ -260,6 +268,831 @@ |
3256 | .error = 0, |
3257 | }; |
3258 | |
3259 | +/* Invalid RIL_REQUEST_DATA_REGISTRATION_STATE: buffer too small */ |
3260 | +static const struct ril_msg reply_data_reg_state_invalid_1 = { |
3261 | + .buf = "XYZ", |
3262 | + .buf_len = 3, |
3263 | + .unsolicited = FALSE, |
3264 | + .req = RIL_REQUEST_DATA_REGISTRATION_STATE, |
3265 | + .serial_no = 0, |
3266 | + .error = 0, |
3267 | +}; |
3268 | + |
3269 | +/* |
3270 | + * The following hex data represents a RIL_REQUEST_DATA_REGISTRATION_STATE |
3271 | + * reply with an invalid number of parameters ( 0 ). |
3272 | + */ |
3273 | +static const guchar reply_data_reg_state_invalid_parcel2[] = { |
3274 | + 0x00, 0x00, 0x00, 0x00 |
3275 | +}; |
3276 | + |
3277 | +static const struct ril_msg reply_data_reg_state_invalid_2 = { |
3278 | + .buf = (gchar *) &reply_data_reg_state_invalid_parcel2, |
3279 | + .buf_len = sizeof(reply_data_reg_state_invalid_parcel2), |
3280 | + .unsolicited = FALSE, |
3281 | + .req = RIL_REQUEST_DATA_REGISTRATION_STATE, |
3282 | + .serial_no = 0, |
3283 | + .error = 0, |
3284 | +}; |
3285 | + |
3286 | +/* |
3287 | + * The following hex data represents a RIL_REQUEST_DATA_REGISTRATION_STATE |
3288 | + * reply with a null status parameter: |
3289 | + * |
3290 | + * {(null),1b3f,07eaf3dc,hspa,(null),20} |
3291 | + */ |
3292 | +static const guchar reply_data_reg_state_invalid_parcel3[] = { |
3293 | + 0x06, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, |
3294 | + 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, |
3295 | + 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, 0x65, 0x00, 0x61, 0x00, |
3296 | + 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, |
3297 | + 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, |
3298 | + 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x30, 0x00, |
3299 | + 0x00, 0x00, 0x00, 0x00 |
3300 | +}; |
3301 | + |
3302 | +static const struct ril_msg reply_data_reg_state_invalid_3 = { |
3303 | + .buf = (gchar *) &reply_data_reg_state_invalid_parcel3, |
3304 | + .buf_len = sizeof(reply_data_reg_state_invalid_parcel3), |
3305 | + .unsolicited = FALSE, |
3306 | + .req = RIL_REQUEST_DATA_REGISTRATION_STATE, |
3307 | + .serial_no = 0, |
3308 | + .error = 0, |
3309 | +}; |
3310 | + |
3311 | +/* |
3312 | + * The following hex data represents a valid RIL_REQUEST_DATA_REGISTRATION_STATE |
3313 | + * reply with the following parameters: |
3314 | + * |
3315 | + * RADIO_TECH_UNKNOWN (0) -> none |
3316 | + * |
3317 | + * {registered,1b3f,07eaf3dc,none,(null),20} |
3318 | + */ |
3319 | +static const guchar reply_data_reg_state_valid_parcel1[] = { |
3320 | + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, |
3321 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, |
3322 | + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, |
3323 | + 0x65, 0x00, 0x61, 0x00, 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00, |
3324 | + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, |
3325 | + 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x30, 0x00, |
3326 | + 0x00, 0x00, 0x00, 0x00 |
3327 | +}; |
3328 | + |
3329 | +static const reg_state_test data_reg_valid_1 = { |
3330 | + .status = NETWORK_REGISTRATION_STATUS_REGISTERED, |
3331 | + .tech = PACKET_BEARER_NONE, |
3332 | + .msg = { |
3333 | + .buf = (gchar *) &reply_data_reg_state_valid_parcel1, |
3334 | + .buf_len = sizeof(reply_data_reg_state_valid_parcel1), |
3335 | + .unsolicited = FALSE, |
3336 | + .req = RIL_REQUEST_DATA_REGISTRATION_STATE, |
3337 | + .serial_no = 0, |
3338 | + .error = 0, |
3339 | + } |
3340 | +}; |
3341 | + |
3342 | +/* |
3343 | + * The following hex data represents a valid RIL_REQUEST_DATA_REGISTRATION_STATE |
3344 | + * reply with the following parameters: |
3345 | + * |
3346 | + * RADIO_TECH_GSM (16) -> none |
3347 | + * |
3348 | + * {registered,1b3f,07eaf3dc,none,(null),20} |
3349 | + */ |
3350 | +static const guchar reply_data_reg_state_valid_parcel2[] = { |
3351 | + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, |
3352 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, |
3353 | + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, |
3354 | + 0x65, 0x00, 0x61, 0x00, 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00, |
3355 | + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x36, 0x00, |
3356 | + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, |
3357 | + 0x32, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00 |
3358 | +}; |
3359 | + |
3360 | +static const reg_state_test data_reg_valid_2 = { |
3361 | + .status = NETWORK_REGISTRATION_STATUS_REGISTERED, |
3362 | + .tech = PACKET_BEARER_NONE, |
3363 | + .msg = { |
3364 | + .buf = (gchar *) &reply_data_reg_state_valid_parcel2, |
3365 | + .buf_len = sizeof(reply_data_reg_state_valid_parcel2), |
3366 | + .unsolicited = FALSE, |
3367 | + .req = RIL_REQUEST_DATA_REGISTRATION_STATE, |
3368 | + .serial_no = 0, |
3369 | + .error = 0, |
3370 | + } |
3371 | +}; |
3372 | + |
3373 | +/* |
3374 | + * The following hex data represents a valid RIL_REQUEST_DATA_REGISTRATION_STATE |
3375 | + * reply with the following parameters: |
3376 | + * |
3377 | + * RADIO_TECH_GPRS (1) -> gprs |
3378 | + * |
3379 | + * {registered,1b3f,07eaf3dc,gprs,(null),20} |
3380 | + */ |
3381 | +static const guchar reply_data_reg_state_valid_parcel3[] = { |
3382 | + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, |
3383 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, |
3384 | + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, |
3385 | + 0x65, 0x00, 0x61, 0x00, 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00, |
3386 | + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, |
3387 | + 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x30, 0x00, |
3388 | + 0x00, 0x00, 0x00, 0x00 |
3389 | +}; |
3390 | + |
3391 | +static const reg_state_test data_reg_valid_3 = { |
3392 | + .status = NETWORK_REGISTRATION_STATUS_REGISTERED, |
3393 | + .tech = PACKET_BEARER_GPRS, |
3394 | + .msg = { |
3395 | + .buf = (gchar *) &reply_data_reg_state_valid_parcel3, |
3396 | + .buf_len = sizeof(reply_data_reg_state_valid_parcel3), |
3397 | + .unsolicited = FALSE, |
3398 | + .req = RIL_REQUEST_DATA_REGISTRATION_STATE, |
3399 | + .serial_no = 0, |
3400 | + .error = 0, |
3401 | + } |
3402 | +}; |
3403 | + |
3404 | +/* |
3405 | + * The following hex data represents a valid RIL_REQUEST_DATA_REGISTRATION_STATE |
3406 | + * reply with the following parameters: |
3407 | + * |
3408 | + * RADIO_TECH_EDGE (2) -> edge |
3409 | + * |
3410 | + * {registered,1b3f,07eaf3dc,edge,(null),20} |
3411 | + */ |
3412 | +static const guchar reply_data_reg_state_valid_parcel4[] = { |
3413 | + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, |
3414 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, |
3415 | + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, |
3416 | + 0x65, 0x00, 0x61, 0x00, 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00, |
3417 | + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, |
3418 | + 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x30, 0x00, |
3419 | + 0x00, 0x00, 0x00, 0x00 |
3420 | +}; |
3421 | + |
3422 | +static const reg_state_test data_reg_valid_4 = { |
3423 | + .status = NETWORK_REGISTRATION_STATUS_REGISTERED, |
3424 | + .tech = PACKET_BEARER_EGPRS, |
3425 | + .msg = { |
3426 | + .buf = (gchar *) &reply_data_reg_state_valid_parcel4, |
3427 | + .buf_len = sizeof(reply_data_reg_state_valid_parcel4), |
3428 | + .unsolicited = FALSE, |
3429 | + .req = RIL_REQUEST_DATA_REGISTRATION_STATE, |
3430 | + .serial_no = 0, |
3431 | + .error = 0, |
3432 | + } |
3433 | +}; |
3434 | + |
3435 | +/* |
3436 | + * The following hex data represents a valid RIL_REQUEST_DATA_REGISTRATION_STATE |
3437 | + * reply with the following parameters: |
3438 | + * |
3439 | + * RADIO_TECH_UMTS (3) -> umts |
3440 | + * |
3441 | + * {registered,1b3f,07eaf3dc,umts,(null),20} |
3442 | + */ |
3443 | +static const guchar reply_data_reg_state_valid_parcel5[] = { |
3444 | + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, |
3445 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, |
3446 | + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, |
3447 | + 0x65, 0x00, 0x61, 0x00, 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00, |
3448 | + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, |
3449 | + 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x30, 0x00, |
3450 | + 0x00, 0x00, 0x00, 0x00 |
3451 | +}; |
3452 | + |
3453 | +static const reg_state_test data_reg_valid_5 = { |
3454 | + .status = NETWORK_REGISTRATION_STATUS_REGISTERED, |
3455 | + .tech = PACKET_BEARER_UMTS, |
3456 | + .msg = { |
3457 | + .buf = (gchar *) &reply_data_reg_state_valid_parcel5, |
3458 | + .buf_len = sizeof(reply_data_reg_state_valid_parcel5), |
3459 | + .unsolicited = FALSE, |
3460 | + .req = RIL_REQUEST_DATA_REGISTRATION_STATE, |
3461 | + .serial_no = 0, |
3462 | + .error = 0, |
3463 | + } |
3464 | +}; |
3465 | + |
3466 | +/* |
3467 | + * The following hex data represents a valid RIL_REQUEST_DATA_REGISTRATION_STATE |
3468 | + * reply with the following parameters: |
3469 | + * |
3470 | + * RADIO_TECH_HSDPA (9) -> hsdpa |
3471 | + * |
3472 | + * {registered,1b3f,07eaf3dc,hsdpa,(null),20} |
3473 | + */ |
3474 | +static const guchar reply_data_reg_state_valid_parcel6[] = { |
3475 | + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, |
3476 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, |
3477 | + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, |
3478 | + 0x65, 0x00, 0x61, 0x00, 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00, |
3479 | + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, |
3480 | + 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x30, 0x00, |
3481 | + 0x00, 0x00, 0x00, 0x00 |
3482 | +}; |
3483 | + |
3484 | +static const reg_state_test data_reg_valid_6 = { |
3485 | + .status = NETWORK_REGISTRATION_STATUS_REGISTERED, |
3486 | + .tech = PACKET_BEARER_HSDPA, |
3487 | + .msg = { |
3488 | + .buf = (gchar *) &reply_data_reg_state_valid_parcel6, |
3489 | + .buf_len = sizeof(reply_data_reg_state_valid_parcel6), |
3490 | + .unsolicited = FALSE, |
3491 | + .req = RIL_REQUEST_DATA_REGISTRATION_STATE, |
3492 | + .serial_no = 0, |
3493 | + .error = 0, |
3494 | + } |
3495 | +}; |
3496 | + |
3497 | +/* |
3498 | + * The following hex data represents a valid RIL_REQUEST_DATA_REGISTRATION_STATE |
3499 | + * reply with the following parameters: |
3500 | + * |
3501 | + * RADIO_TECH_HSUPA (10) -> hsupa |
3502 | + * |
3503 | + * {registered,1b3f,07eaf3dc,hsupa,(null),20} |
3504 | + */ |
3505 | +static const guchar reply_data_reg_state_valid_parcel7[] = { |
3506 | + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, |
3507 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, |
3508 | + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, |
3509 | + 0x65, 0x00, 0x61, 0x00, 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00, |
3510 | + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, |
3511 | + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, |
3512 | + 0x32, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00 |
3513 | +}; |
3514 | + |
3515 | +static const reg_state_test data_reg_valid_7 = { |
3516 | + .status = NETWORK_REGISTRATION_STATUS_REGISTERED, |
3517 | + .tech = PACKET_BEARER_HSUPA, |
3518 | + .msg = { |
3519 | + .buf = (gchar *) &reply_data_reg_state_valid_parcel7, |
3520 | + .buf_len = sizeof(reply_data_reg_state_valid_parcel7), |
3521 | + .unsolicited = FALSE, |
3522 | + .req = RIL_REQUEST_DATA_REGISTRATION_STATE, |
3523 | + .serial_no = 0, |
3524 | + .error = 0, |
3525 | + } |
3526 | +}; |
3527 | + |
3528 | +/* |
3529 | + * The following hex data represents a valid RIL_REQUEST_DATA_REGISTRATION_STATE |
3530 | + * reply with the following parameters: |
3531 | + * |
3532 | + * RADIO_TECH_HSPA (11) -> hspa |
3533 | + * |
3534 | + * {registered,1b3f,07eaf3dc,hspa,(null),20} |
3535 | + */ |
3536 | +static const guchar reply_data_reg_state_valid_parcel8[] = { |
3537 | + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, |
3538 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, |
3539 | + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, |
3540 | + 0x65, 0x00, 0x61, 0x00, 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00, |
3541 | + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x31, 0x00, |
3542 | + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, |
3543 | + 0x32, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00 |
3544 | +}; |
3545 | + |
3546 | + |
3547 | +static const reg_state_test data_reg_valid_8 = { |
3548 | + .status = NETWORK_REGISTRATION_STATUS_REGISTERED, |
3549 | + .tech = PACKET_BEARER_HSUPA_HSDPA, |
3550 | + .msg = { |
3551 | + .buf = (gchar *) &reply_data_reg_state_valid_parcel8, |
3552 | + .buf_len = sizeof(reply_data_reg_state_valid_parcel8), |
3553 | + .unsolicited = FALSE, |
3554 | + .req = RIL_REQUEST_DATA_REGISTRATION_STATE, |
3555 | + .serial_no = 0, |
3556 | + .error = 0, |
3557 | + } |
3558 | +}; |
3559 | + |
3560 | +/* |
3561 | + * The following hex data represents a valid RIL_REQUEST_DATA_REGISTRATION_STATE |
3562 | + * reply with the following parameters: |
3563 | + * |
3564 | + * RADIO_TECH_LTE (14) -> lte |
3565 | + * |
3566 | + * {registered,1b3f,07eaf3dc,lte,(null),20} |
3567 | + */ |
3568 | +static const guchar reply_data_reg_state_valid_parcel9[] = { |
3569 | + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, |
3570 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, |
3571 | + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, |
3572 | + 0x65, 0x00, 0x61, 0x00, 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00, |
3573 | + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x34, 0x00, |
3574 | + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, |
3575 | + 0x32, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00 |
3576 | +}; |
3577 | + |
3578 | + |
3579 | +static const reg_state_test data_reg_valid_9 = { |
3580 | + .status = NETWORK_REGISTRATION_STATUS_REGISTERED, |
3581 | + .tech = PACKET_BEARER_EPS, |
3582 | + .msg = { |
3583 | + .buf = (gchar *) &reply_data_reg_state_valid_parcel9, |
3584 | + .buf_len = sizeof(reply_data_reg_state_valid_parcel9), |
3585 | + .unsolicited = FALSE, |
3586 | + .req = RIL_REQUEST_DATA_REGISTRATION_STATE, |
3587 | + .serial_no = 0, |
3588 | + .error = 0, |
3589 | + } |
3590 | +}; |
3591 | + |
3592 | +/* |
3593 | + * The following hex data represents a valid RIL_REQUEST_DATA_REGISTRATION_STATE |
3594 | + * reply with the following parameters: |
3595 | + * |
3596 | + * RADIO_TECH_HSPAP (15) -> hspa |
3597 | + * |
3598 | + * Note, as ofono currently doesn't define a bearer enum that represents HSPA+, |
3599 | + * it's currently mapped to HSPA. |
3600 | + * |
3601 | + * {registered,1b3f,07eaf3dc,hspa,(null),20} |
3602 | + */ |
3603 | +static const guchar reply_data_reg_state_valid_parcel10[] = { |
3604 | + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, |
3605 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, |
3606 | + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, |
3607 | + 0x65, 0x00, 0x61, 0x00, 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00, |
3608 | + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x35, 0x00, |
3609 | + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, |
3610 | + 0x32, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00 |
3611 | +}; |
3612 | + |
3613 | + |
3614 | +static const reg_state_test data_reg_valid_10 = { |
3615 | + .status = NETWORK_REGISTRATION_STATUS_REGISTERED, |
3616 | + .tech = PACKET_BEARER_HSUPA_HSDPA, |
3617 | + .msg = { |
3618 | + .buf = (gchar *) &reply_data_reg_state_valid_parcel10, |
3619 | + .buf_len = sizeof(reply_data_reg_state_valid_parcel10), |
3620 | + .unsolicited = FALSE, |
3621 | + .req = RIL_REQUEST_DATA_REGISTRATION_STATE, |
3622 | + .serial_no = 0, |
3623 | + .error = 0, |
3624 | + } |
3625 | +}; |
3626 | + |
3627 | +/* |
3628 | + * TODO: investigate creation of a base reply, which could |
3629 | + * then be modified for each test, as opposed to duplicating |
3630 | + * the bulk of the data for each test. |
3631 | + */ |
3632 | + |
3633 | +/* |
3634 | + * The following hex data represents a valid |
3635 | + * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters: |
3636 | + * |
3637 | + * RADIO_TECH_UMTS (3) -> umts |
3638 | + * |
3639 | + * {registered,1b3f,07eaf3dc,umts,(null),(null)} |
3640 | + */ |
3641 | +static const guchar reply_voice_reg_state_valid_parcel1[] = { |
3642 | + 0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, |
3643 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, |
3644 | + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, |
3645 | + 0x65, 0x00, 0x61, 0x00, 0x35, 0x00, 0x31, 0x00, 0x37, 0x00, 0x61, 0x00, |
3646 | + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, |
3647 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
3648 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
3649 | + 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, |
3650 | + 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, |
3651 | + 0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, 0x35, 0x00, 0x00, 0x00 |
3652 | +}; |
3653 | + |
3654 | +static const reg_state_test voice_reg_valid_1 = { |
3655 | + .status = NETWORK_REGISTRATION_STATUS_REGISTERED, |
3656 | + .tech = ACCESS_TECHNOLOGY_UTRAN, |
3657 | + .msg = { |
3658 | + .buf = (gchar *) &reply_voice_reg_state_valid_parcel1, |
3659 | + .buf_len = sizeof(reply_voice_reg_state_valid_parcel1), |
3660 | + .unsolicited = FALSE, |
3661 | + .req = RIL_REQUEST_VOICE_REGISTRATION_STATE, |
3662 | + .serial_no = 0, |
3663 | + .error = 0, |
3664 | + } |
3665 | +}; |
3666 | + |
3667 | +/* |
3668 | + * The following hex data represents a valid |
3669 | + * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters: |
3670 | + * |
3671 | + * |
3672 | + * RADIO_TECH_GPRS (1) -> gsm |
3673 | + * |
3674 | + * {unregistered,1b3f,07eaf3dc,gsm,(null),(null)} |
3675 | + */ |
3676 | +static const guchar reply_voice_reg_state_valid_parcel2[] = { |
3677 | + 0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, |
3678 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, |
3679 | + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, |
3680 | + 0x65, 0x00, 0x61, 0x00, 0x35, 0x00, 0x31, 0x00, 0x37, 0x00, 0x61, 0x00, |
3681 | + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, |
3682 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
3683 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
3684 | + 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, |
3685 | + 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, |
3686 | + 0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, 0x35, 0x00, 0x00, 0x00 |
3687 | +}; |
3688 | + |
3689 | +static const reg_state_test voice_reg_valid_2 = { |
3690 | + .status = (int) NETWORK_REGISTRATION_STATUS_NOT_REGISTERED, |
3691 | + .tech = ACCESS_TECHNOLOGY_GSM, |
3692 | + .msg = { |
3693 | + .buf = (gchar *) &reply_voice_reg_state_valid_parcel2, |
3694 | + .buf_len = sizeof(reply_voice_reg_state_valid_parcel2), |
3695 | + .unsolicited = FALSE, |
3696 | + .req = RIL_REQUEST_VOICE_REGISTRATION_STATE, |
3697 | + .serial_no = 0, |
3698 | + .error = 0, |
3699 | + } |
3700 | +}; |
3701 | + |
3702 | +/* |
3703 | + * The following hex data represents a valid |
3704 | + * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters: |
3705 | + * |
3706 | + * RADIO_TECH_GSM (16) -> gsm |
3707 | + * |
3708 | + * {searching,1b3f,07eaf3dc,gsm,(null),(null)} |
3709 | + */ |
3710 | +static const guchar reply_voice_reg_state_valid_parcel3[] = { |
3711 | + 0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, |
3712 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, |
3713 | + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, |
3714 | + 0x65, 0x00, 0x61, 0x00, 0x35, 0x00, 0x31, 0x00, 0x30, 0x00, 0x61, 0x00, |
3715 | + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x36, 0x00, |
3716 | + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
3717 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
3718 | + 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, |
3719 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, |
3720 | + 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, |
3721 | + 0x35, 0x00, 0x00, 0x00 |
3722 | +}; |
3723 | + |
3724 | +static const reg_state_test voice_reg_valid_3 = { |
3725 | + .status = NETWORK_REGISTRATION_STATUS_SEARCHING, |
3726 | + .tech = ACCESS_TECHNOLOGY_GSM, |
3727 | + .msg = { |
3728 | + .buf = (gchar *) &reply_voice_reg_state_valid_parcel3, |
3729 | + .buf_len = sizeof(reply_voice_reg_state_valid_parcel3), |
3730 | + .unsolicited = FALSE, |
3731 | + .req = RIL_REQUEST_VOICE_REGISTRATION_STATE, |
3732 | + .serial_no = 0, |
3733 | + .error = 0, |
3734 | + } |
3735 | +}; |
3736 | + |
3737 | +/* |
3738 | + * The following hex data represents a valid |
3739 | + * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters: |
3740 | + * |
3741 | + * RADIO_TECH_EDGE (2) -> edge |
3742 | + * |
3743 | + * {denied,1b3f,07eaf3dc,edge,(null),(null)} |
3744 | + */ |
3745 | +static const guchar reply_voice_reg_state_valid_parcel4[] = { |
3746 | + 0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, |
3747 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, |
3748 | + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, |
3749 | + 0x65, 0x00, 0x61, 0x00, 0x35, 0x00, 0x31, 0x00, 0x30, 0x00, 0x61, 0x00, |
3750 | + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, |
3751 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
3752 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
3753 | + 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, |
3754 | + 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, |
3755 | + 0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, 0x35, 0x00, 0x00, 0x00 |
3756 | +}; |
3757 | + |
3758 | +static const reg_state_test voice_reg_valid_4 = { |
3759 | + .status = NETWORK_REGISTRATION_STATUS_DENIED, |
3760 | + .tech = ACCESS_TECHNOLOGY_GSM_EGPRS, |
3761 | + .msg = { |
3762 | + .buf = (gchar *) &reply_voice_reg_state_valid_parcel4, |
3763 | + .buf_len = sizeof(reply_voice_reg_state_valid_parcel4), |
3764 | + .unsolicited = FALSE, |
3765 | + .req = RIL_REQUEST_VOICE_REGISTRATION_STATE, |
3766 | + .serial_no = 0, |
3767 | + .error = 0, |
3768 | + } |
3769 | +}; |
3770 | + |
3771 | +/* |
3772 | + * The following hex data represents a valid |
3773 | + * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters: |
3774 | + * |
3775 | + * {unknown,1b3f,07eaf3dc,"",(null),(null)} |
3776 | + */ |
3777 | +static const guchar reply_voice_reg_state_valid_parcel5[] = { |
3778 | + 0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, |
3779 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, |
3780 | + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, |
3781 | + 0x65, 0x00, 0x61, 0x00, 0x35, 0x00, 0x31, 0x00, 0x30, 0x00, 0x61, 0x00, |
3782 | + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, |
3783 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
3784 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
3785 | + 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, |
3786 | + 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, |
3787 | + 0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, 0x35, 0x00, 0x00, 0x00 |
3788 | +}; |
3789 | + |
3790 | +static const reg_state_test voice_reg_valid_5 = { |
3791 | + .status = NETWORK_REGISTRATION_STATUS_UNKNOWN, |
3792 | + .tech = -1, |
3793 | + .msg = { |
3794 | + .buf = (gchar *) &reply_voice_reg_state_valid_parcel5, |
3795 | + .buf_len = sizeof(reply_voice_reg_state_valid_parcel5), |
3796 | + .unsolicited = FALSE, |
3797 | + .req = RIL_REQUEST_VOICE_REGISTRATION_STATE, |
3798 | + .serial_no = 0, |
3799 | + .error = 0, |
3800 | + } |
3801 | +}; |
3802 | + |
3803 | +/* |
3804 | + * The following hex data represents a valid |
3805 | + * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters: |
3806 | + * |
3807 | + * RADIO_TECH_LTE (14) -> lte |
3808 | + * |
3809 | + * {roaming,1b3f,07eaf3dc,lte,(null),(null)} |
3810 | + */ |
3811 | +static const guchar reply_voice_reg_state_valid_parcel6[] = { |
3812 | + 0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, |
3813 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, |
3814 | + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, |
3815 | + 0x65, 0x00, 0x61, 0x00, 0x35, 0x00, 0x31, 0x00, 0x30, 0x00, 0x61, 0x00, |
3816 | + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x34, 0x00, |
3817 | + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
3818 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
3819 | + 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, |
3820 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, |
3821 | + 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, |
3822 | + 0x35, 0x00, 0x00, 0x00 |
3823 | +}; |
3824 | + |
3825 | +static const reg_state_test voice_reg_valid_6 = { |
3826 | + .status = NETWORK_REGISTRATION_STATUS_ROAMING, |
3827 | + .tech = ACCESS_TECHNOLOGY_EUTRAN, |
3828 | + .msg = { |
3829 | + .buf = (gchar *) &reply_voice_reg_state_valid_parcel6, |
3830 | + .buf_len = sizeof(reply_voice_reg_state_valid_parcel6), |
3831 | + .unsolicited = FALSE, |
3832 | + .req = RIL_REQUEST_VOICE_REGISTRATION_STATE, |
3833 | + .serial_no = 0, |
3834 | + .error = 0, |
3835 | + } |
3836 | +}; |
3837 | + |
3838 | +/* |
3839 | + * The following hex data represents a valid |
3840 | + * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters: |
3841 | + * |
3842 | + * RADIO_TECH_HSDPA (9) -> hsdpa |
3843 | + * |
3844 | + * {roaming,1b3f,07eaf3dc,hsdpa,(null),(null)} |
3845 | + */ |
3846 | +static const guchar reply_voice_reg_state_valid_parcel7[] = { |
3847 | + 0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, |
3848 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, |
3849 | + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, |
3850 | + 0x65, 0x00, 0x61, 0x00, 0x35, 0x00, 0x31, 0x00, 0x30, 0x00, 0x61, 0x00, |
3851 | + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, |
3852 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
3853 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
3854 | + 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, |
3855 | + 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, |
3856 | + 0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, 0x35, 0x00, 0x00, 0x00 |
3857 | +}; |
3858 | + |
3859 | +static const reg_state_test voice_reg_valid_7 = { |
3860 | + .status = NETWORK_REGISTRATION_STATUS_ROAMING, |
3861 | + .tech = ACCESS_TECHNOLOGY_UTRAN_HSDPA, |
3862 | + .msg = { |
3863 | + .buf = (gchar *) &reply_voice_reg_state_valid_parcel7, |
3864 | + .buf_len = sizeof(reply_voice_reg_state_valid_parcel7), |
3865 | + .unsolicited = FALSE, |
3866 | + .req = RIL_REQUEST_VOICE_REGISTRATION_STATE, |
3867 | + .serial_no = 0, |
3868 | + .error = 0, |
3869 | + } |
3870 | +}; |
3871 | + |
3872 | +/* |
3873 | + * The following hex data represents a valid |
3874 | + * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters: |
3875 | + * |
3876 | + * RADIO_TECH_HSUPA (10) -> hsupa |
3877 | + * |
3878 | + * {roaming,1b3f,07eaf3dc,hsupa,(null),(null)} |
3879 | + */ |
3880 | +static const guchar reply_voice_reg_state_valid_parcel8[] = { |
3881 | + 0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, |
3882 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, |
3883 | + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, |
3884 | + 0x65, 0x00, 0x61, 0x00, 0x35, 0x00, 0x31, 0x00, 0x30, 0x00, 0x61, 0x00, |
3885 | + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, |
3886 | + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
3887 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
3888 | + 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, |
3889 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, |
3890 | + 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, |
3891 | + 0x35, 0x00, 0x00, 0x00 |
3892 | +}; |
3893 | + |
3894 | +static const reg_state_test voice_reg_valid_8 = { |
3895 | + .status = NETWORK_REGISTRATION_STATUS_ROAMING, |
3896 | + .tech = ACCESS_TECHNOLOGY_UTRAN_HSUPA, |
3897 | + .msg = { |
3898 | + .buf = (gchar *) &reply_voice_reg_state_valid_parcel8, |
3899 | + .buf_len = sizeof(reply_voice_reg_state_valid_parcel8), |
3900 | + .unsolicited = FALSE, |
3901 | + .req = RIL_REQUEST_VOICE_REGISTRATION_STATE, |
3902 | + .serial_no = 0, |
3903 | + .error = 0, |
3904 | + } |
3905 | +}; |
3906 | + |
3907 | +/* |
3908 | + * The following hex data represents a valid |
3909 | + * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters: |
3910 | + * |
3911 | + * RADIO_TECH_HSPA (11) -> hspa |
3912 | + * |
3913 | + * {roaming,1b3f,07eaf3dc,hspa,(null),(null)} |
3914 | + */ |
3915 | +static const guchar reply_voice_reg_state_valid_parcel9[] = { |
3916 | + 0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, |
3917 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, |
3918 | + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, |
3919 | + 0x65, 0x00, 0x61, 0x00, 0x35, 0x00, 0x31, 0x00, 0x30, 0x00, 0x61, 0x00, |
3920 | + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x31, 0x00, |
3921 | + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
3922 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
3923 | + 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, |
3924 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, |
3925 | + 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, |
3926 | + 0x35, 0x00, 0x00, 0x00 |
3927 | +}; |
3928 | + |
3929 | +static const reg_state_test voice_reg_valid_9 = { |
3930 | + .status = NETWORK_REGISTRATION_STATUS_ROAMING, |
3931 | + .tech = ACCESS_TECHNOLOGY_UTRAN_HSDPA_HSUPA, |
3932 | + .msg = { |
3933 | + .buf = (gchar *) &reply_voice_reg_state_valid_parcel9, |
3934 | + .buf_len = sizeof(reply_voice_reg_state_valid_parcel9), |
3935 | + .unsolicited = FALSE, |
3936 | + .req = RIL_REQUEST_VOICE_REGISTRATION_STATE, |
3937 | + .serial_no = 0, |
3938 | + .error = 0, |
3939 | + } |
3940 | +}; |
3941 | + |
3942 | +/* |
3943 | + * The following hex data represents a valid |
3944 | + * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters: |
3945 | + * |
3946 | + * RADIO_TECH_HSPAP (15) --> hspa |
3947 | + * |
3948 | + * Note, as ofono currently doesn't define an access tech enum that represents |
3949 | + * HSPA+, it's currently mapped to HSPA. |
3950 | + * |
3951 | + * {roaming,1b3f,07eaf3dc,hspa,(null),(null)} |
3952 | + */ |
3953 | +static const guchar reply_voice_reg_state_valid_parcel10[] = { |
3954 | + 0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, |
3955 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, |
3956 | + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, |
3957 | + 0x65, 0x00, 0x61, 0x00, 0x35, 0x00, 0x31, 0x00, 0x30, 0x00, 0x61, 0x00, |
3958 | + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x35, 0x00, |
3959 | + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
3960 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, |
3961 | + 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, |
3962 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, |
3963 | + 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, |
3964 | + 0x35, 0x00, 0x00, 0x00 |
3965 | +}; |
3966 | + |
3967 | +static const reg_state_test voice_reg_valid_10 = { |
3968 | + .status = NETWORK_REGISTRATION_STATUS_ROAMING, |
3969 | + .tech = ACCESS_TECHNOLOGY_UTRAN_HSDPA_HSUPA, |
3970 | + .msg = { |
3971 | + .buf = (gchar *) &reply_voice_reg_state_valid_parcel10, |
3972 | + .buf_len = sizeof(reply_voice_reg_state_valid_parcel10), |
3973 | + .unsolicited = FALSE, |
3974 | + .req = RIL_REQUEST_VOICE_REGISTRATION_STATE, |
3975 | + .serial_no = 0, |
3976 | + .error = 0, |
3977 | + } |
3978 | +}; |
3979 | + |
3980 | +static const struct ril_msg reply_operator_invalid_1 = { |
3981 | + .buf = "", |
3982 | + .buf_len = 0, |
3983 | + .unsolicited = FALSE, |
3984 | + .req = RIL_REQUEST_OPERATOR, |
3985 | + .serial_no = 0, |
3986 | + .error = 0, |
3987 | +}; |
3988 | + |
3989 | +/* |
3990 | + * The following hexadecimal data contains the event data of an |
3991 | + * invalid RIL_REQUEST_OPERATOR with an invald number of parameters |
3992 | + * |
3993 | + * {lalpha=AT&T, salpha=} |
3994 | + */ |
3995 | +static const guchar reply_operator_invalid_parcel2[] = { |
3996 | + 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x41, 0x00, 0x54, 0x00, |
3997 | + 0x26, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
3998 | + 0x00, 0x00, 0x00, 0x00 |
3999 | +}; |
4000 | + |
4001 | +static const struct ril_msg reply_operator_invalid_2 = { |
4002 | + .buf = (char *) &reply_operator_invalid_parcel2, |
4003 | + .buf_len = sizeof(reply_operator_invalid_parcel2), |
4004 | + .unsolicited = FALSE, |
4005 | + .req = RIL_REQUEST_OPERATOR, |
4006 | + .serial_no = 0, |
4007 | + .error = 0, |
4008 | +}; |
4009 | + |
4010 | +/* |
4011 | + * The following hexadecimal data contains the event data of a |
4012 | + * valid RIL_REQUEST_OPERATOR with the following parameters: |
4013 | + * |
4014 | + * {lalpha=AT&T, salpha=, numeric=310410} |
4015 | + */ |
4016 | +static const guchar reply_operator_valid_parcel1[] = { |
4017 | + 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x41, 0x00, 0x54, 0x00, |
4018 | + 0x26, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
4019 | + 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x33, 0x00, 0x31, 0x00, |
4020 | + 0x30, 0x00, 0x34, 0x00, 0x31, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00 |
4021 | +}; |
4022 | + |
4023 | +static const struct ril_msg reply_operator_valid_1 = { |
4024 | + .buf = (char *) &reply_operator_valid_parcel1, |
4025 | + .buf_len = sizeof(reply_operator_valid_parcel1), |
4026 | + .unsolicited = FALSE, |
4027 | + .req = RIL_REQUEST_OPERATOR, |
4028 | + .serial_no = 0, |
4029 | + .error = 0, |
4030 | +}; |
4031 | + |
4032 | +static const struct ril_msg reply_avail_ops_invalid_1 = { |
4033 | + .buf = "", |
4034 | + .buf_len = 0, |
4035 | + .unsolicited = FALSE, |
4036 | + .req = RIL_REQUEST_QUERY_AVAILABLE_NETWORKS, |
4037 | + .serial_no = 0, |
4038 | + .error = 0, |
4039 | +}; |
4040 | + |
4041 | +/* |
4042 | + * The following hexadecimal data contains the event data of an |
4043 | + * invalid RIL_REQUEST_QUERY_AVAILABLE_NETWORKS with an invald |
4044 | + * number of strings ( not evenly divisible by 4, the count of |
4045 | + * strings per operator ). |
4046 | + */ |
4047 | +static const guchar reply_avail_ops_invalid_parcel2[] = { |
4048 | + 0x0b, 0x00, 0x00, 0x00 |
4049 | +}; |
4050 | + |
4051 | +static const struct ril_msg reply_avail_ops_invalid_2 = { |
4052 | + .buf = (char *) &reply_avail_ops_invalid_parcel2, |
4053 | + .buf_len = sizeof(reply_avail_ops_invalid_parcel2), |
4054 | + .unsolicited = FALSE, |
4055 | + .req = RIL_REQUEST_QUERY_AVAILABLE_NETWORKS, |
4056 | + .serial_no = 0, |
4057 | + .error = 0, |
4058 | +}; |
4059 | + |
4060 | +/* |
4061 | + * The following hexadecimal data contains the event data of a |
4062 | + * valid RIL_REQUEST_AVAILABLE_NETWORKS with the following parameters: |
4063 | + * |
4064 | + * {lalpha=AT&T, salpha=, numeric=310410, status=available} |
4065 | + */ |
4066 | +static const guchar reply_avail_ops_valid_parcel1[] = { |
4067 | + 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x41, 0x00, 0x54, 0x00, |
4068 | + 0x26, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
4069 | + 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x33, 0x00, 0x31, 0x00, |
4070 | + 0x30, 0x00, 0x34, 0x00, 0x31, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, |
4071 | + 0x09, 0x00, 0x00, 0x00, 0x61, 0x00, 0x76, 0x00, 0x61, 0x00, 0x69, 0x00, |
4072 | + 0x6c, 0x00, 0x61, 0x00, 0x62, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x00, 0x00 |
4073 | +}; |
4074 | + |
4075 | +static const struct ril_msg reply_avail_ops_valid_1 = { |
4076 | + .buf = (char *) &reply_avail_ops_valid_parcel1, |
4077 | + .buf_len = sizeof(reply_avail_ops_valid_parcel1), |
4078 | + .unsolicited = FALSE, |
4079 | + .req = RIL_REQUEST_QUERY_AVAILABLE_NETWORKS, |
4080 | + .serial_no = 0, |
4081 | + .error = 0, |
4082 | +}; |
4083 | + |
4084 | /* |
4085 | * The following hexadecimal data contains the event data of a valid |
4086 | * RIL_REQUEST_SIM_IO reply with the following parameters: |
4087 | @@ -332,14 +1165,191 @@ |
4088 | .error = 0, |
4089 | }; |
4090 | |
4091 | +/* |
4092 | + * The following hexadecimal data contains the event data of a valid |
4093 | + * RIL_REQUEST_GET_SMSC_ADDRESS reply with the following parameters: |
4094 | + * |
4095 | + * {type=145,number=34607003110} |
4096 | + */ |
4097 | +static const guchar reply_get_smsc_address_valid_parcel1[] = { |
4098 | + 0x12, 0x00, 0x00, 0x00, 0x22, 0x00, 0x2b, 0x00, 0x33, 0x00, 0x34, 0x00, |
4099 | + 0x36, 0x00, 0x30, 0x00, 0x37, 0x00, 0x30, 0x00, 0x30, 0x00, 0x33, 0x00, |
4100 | + 0x31, 0x00, 0x31, 0x00, 0x30, 0x00, 0x22, 0x00, 0x2c, 0x00, 0x31, 0x00, |
4101 | + 0x34, 0x00, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00 |
4102 | +}; |
4103 | + |
4104 | +static const struct ril_msg reply_get_smsc_address_valid_1 = { |
4105 | + .buf = (gchar *) reply_get_smsc_address_valid_parcel1, |
4106 | + .buf_len = sizeof(reply_get_smsc_address_valid_parcel1), |
4107 | + .unsolicited = FALSE, |
4108 | + .req = RIL_REQUEST_GET_SMSC_ADDRESS, |
4109 | + .serial_no = 0, |
4110 | + .error = 0, |
4111 | +}; |
4112 | + |
4113 | +/* |
4114 | + * The following hexadecimal data contains the event data of a valid |
4115 | + * RIL_REQUEST_GET_CURRENT_CALLS reply with the following parameters: |
4116 | + * |
4117 | + * {[id=2,status=0,type=1,number=686732222,name=] |
4118 | + * [id=1,status=1,type=1,number=917525555,name=]} |
4119 | + */ |
4120 | +static const guchar reply_get_current_calls_valid_parcel1[] = { |
4121 | + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, |
4122 | + 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
4123 | + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
4124 | + 0x09, 0x00, 0x00, 0x00, 0x36, 0x00, 0x38, 0x00, 0x36, 0x00, 0x37, 0x00, |
4125 | + 0x33, 0x00, 0x32, 0x00, 0x32, 0x00, 0x32, 0x00, 0x32, 0x00, 0x00, 0x00, |
4126 | + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, |
4127 | + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, |
4128 | + 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
4129 | + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
4130 | + 0x09, 0x00, 0x00, 0x00, 0x39, 0x00, 0x31, 0x00, 0x37, 0x00, 0x35, 0x00, |
4131 | + 0x32, 0x00, 0x35, 0x00, 0x35, 0x00, 0x35, 0x00, 0x35, 0x00, 0x00, 0x00, |
4132 | + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, |
4133 | + 0x00, 0x00, 0x00, 0x00 |
4134 | +}; |
4135 | + |
4136 | +static const struct ril_msg reply_get_current_calls_valid_1 = { |
4137 | + .buf = (gchar *) reply_get_current_calls_valid_parcel1, |
4138 | + .buf_len = sizeof(reply_get_current_calls_valid_parcel1), |
4139 | + .unsolicited = FALSE, |
4140 | + .req = RIL_REQUEST_GET_CURRENT_CALLS, |
4141 | + .serial_no = 0, |
4142 | + .error = 0, |
4143 | +}; |
4144 | + |
4145 | +/* RIL_REQUEST_GET_CURRENT_CALLS NULL reply */ |
4146 | +static const struct ril_msg reply_get_current_calls_invalid_1 = { |
4147 | + .buf = NULL, |
4148 | + .buf_len = 0, |
4149 | + .unsolicited = FALSE, |
4150 | + .req = RIL_REQUEST_GET_CURRENT_CALLS, |
4151 | + .serial_no = 0, |
4152 | + .error = 0, |
4153 | +}; |
4154 | + |
4155 | +/* RIL_REQUEST_GET_CURRENT_CALLS no calls */ |
4156 | +static const guchar reply_get_current_calls_invalid_parcel2[] = { |
4157 | + 0x00, 0x00, 0x00, 0x00, |
4158 | +}; |
4159 | + |
4160 | +static const struct ril_msg reply_get_current_calls_invalid_2 = { |
4161 | + .buf = (gchar *) reply_get_current_calls_invalid_parcel2, |
4162 | + .buf_len = sizeof(reply_get_current_calls_invalid_parcel2), |
4163 | + .unsolicited = FALSE, |
4164 | + .req = RIL_REQUEST_GET_CURRENT_CALLS, |
4165 | + .serial_no = 0, |
4166 | + .error = 0, |
4167 | +}; |
4168 | + |
4169 | +/* |
4170 | + * The following hexadecimal data contains the event data of a valid |
4171 | + * RIL_REQUEST_LAST_CALL_FAIL_CAUSE reply with the following parameters: |
4172 | + * |
4173 | + * {16} |
4174 | + */ |
4175 | +static const guchar reply_call_fail_cause_valid_parcel1[] = { |
4176 | + 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 |
4177 | +}; |
4178 | + |
4179 | +static const struct ril_msg reply_call_fail_cause_valid_1 = { |
4180 | + .buf = (gchar *) reply_call_fail_cause_valid_parcel1, |
4181 | + .buf_len = sizeof(reply_call_fail_cause_valid_parcel1), |
4182 | + .unsolicited = FALSE, |
4183 | + .req = RIL_REQUEST_LAST_CALL_FAIL_CAUSE, |
4184 | + .serial_no = 0, |
4185 | + .error = 0, |
4186 | +}; |
4187 | + |
4188 | +/* |
4189 | + * The following hexadecimal data contains the event data of a valid |
4190 | + * RIL_REQUEST_GET_MUTE reply with the following parameters: |
4191 | + * |
4192 | + * {muted=0} |
4193 | + */ |
4194 | +static const guchar reply_get_mute_off_parcel1[] = { |
4195 | + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
4196 | +}; |
4197 | + |
4198 | +static const struct ril_msg reply_get_mute_off_1 = { |
4199 | + .buf = (gchar *) reply_get_mute_off_parcel1, |
4200 | + .buf_len = sizeof(reply_get_mute_off_parcel1), |
4201 | + .unsolicited = FALSE, |
4202 | + .req = RIL_REQUEST_GET_MUTE, |
4203 | + .serial_no = 0, |
4204 | + .error = 0, |
4205 | +}; |
4206 | + |
4207 | +/* |
4208 | + * The following hexadecimal data contains the event data of a valid |
4209 | + * RIL_REQUEST_GET_MUTE reply with the following parameters: |
4210 | + * |
4211 | + * {muted=1} |
4212 | + */ |
4213 | +static const guchar reply_get_mute_on_parcel1[] = { |
4214 | + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 |
4215 | +}; |
4216 | + |
4217 | +static const struct ril_msg reply_get_mute_on_1 = { |
4218 | + .buf = (gchar *) reply_get_mute_on_parcel1, |
4219 | + .buf_len = sizeof(reply_get_mute_on_parcel1), |
4220 | + .unsolicited = FALSE, |
4221 | + .req = RIL_REQUEST_GET_MUTE, |
4222 | + .serial_no = 0, |
4223 | + .error = 0, |
4224 | +}; |
4225 | + |
4226 | +/* |
4227 | + * The following hexadecimal data contains the event data of a valid |
4228 | + * RIL_REQUEST_BASEBAND_VERSION reply with the following parameters: |
4229 | + * |
4230 | + * {M9615A-CEFWMAZM-2.0.1700.48} |
4231 | + */ |
4232 | +static const guchar reply_baseband_version_valid_parcel1[] = { |
4233 | + 0x1b, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x39, 0x00, 0x36, 0x00, 0x31, 0x00, |
4234 | + 0x35, 0x00, 0x41, 0x00, 0x2d, 0x00, 0x43, 0x00, 0x45, 0x00, 0x46, 0x00, |
4235 | + 0x57, 0x00, 0x4d, 0x00, 0x41, 0x00, 0x5a, 0x00, 0x4d, 0x00, 0x2d, 0x00, |
4236 | + 0x32, 0x00, 0x2e, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x37, 0x00, |
4237 | + 0x30, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x34, 0x00, 0x38, 0x00, 0x00, 0x00 |
4238 | +}; |
4239 | + |
4240 | +static const struct ril_msg reply_baseband_version_valid_1 = { |
4241 | + .buf = (gchar *) reply_baseband_version_valid_parcel1, |
4242 | + .buf_len = sizeof(reply_baseband_version_valid_parcel1), |
4243 | + .unsolicited = FALSE, |
4244 | + .req = RIL_REQUEST_BASEBAND_VERSION, |
4245 | + .serial_no = 0, |
4246 | + .error = 0, |
4247 | +}; |
4248 | + |
4249 | +/* |
4250 | + * The following hexadecimal data contains the event data of a valid |
4251 | + * RIL_REQUEST_GET_IMEI reply with the following parameters: |
4252 | + * |
4253 | + * {355136050779043} |
4254 | + */ |
4255 | +static const guchar reply_get_imei_valid_parcel1[] = { |
4256 | + 0x0f, 0x00, 0x00, 0x00, 0x33, 0x00, 0x35, 0x00, 0x35, 0x00, 0x31, 0x00, |
4257 | + 0x33, 0x00, 0x36, 0x00, 0x30, 0x00, 0x35, 0x00, 0x30, 0x00, 0x37, 0x00, |
4258 | + 0x37, 0x00, 0x39, 0x00, 0x30, 0x00, 0x34, 0x00, 0x33, 0x00, 0x00, 0x00 |
4259 | +}; |
4260 | + |
4261 | +static const struct ril_msg reply_get_imei_valid_1 = { |
4262 | + .buf = (gchar *) reply_get_imei_valid_parcel1, |
4263 | + .buf_len = sizeof(reply_get_imei_valid_parcel1), |
4264 | + .unsolicited = FALSE, |
4265 | + .req = RIL_REQUEST_GET_IMEI, |
4266 | + .serial_no = 0, |
4267 | + .error = 0, |
4268 | +}; |
4269 | + |
4270 | static void test_reply_data_call_invalid(gconstpointer data) |
4271 | { |
4272 | - /* TODO: fix de-const cast... */ |
4273 | - struct ril_msg *message = (struct ril_msg *) data; |
4274 | struct ofono_error error; |
4275 | struct reply_setup_data_call *reply; |
4276 | |
4277 | - reply = g_ril_reply_parse_data_call(NULL, message, &error); |
4278 | + reply = g_ril_reply_parse_data_call(NULL, data, &error); |
4279 | g_assert(reply != NULL); |
4280 | g_ril_reply_free_setup_data_call(reply); |
4281 | |
4282 | @@ -349,12 +1359,10 @@ |
4283 | |
4284 | static void test_reply_data_call_valid(gconstpointer data) |
4285 | { |
4286 | - /* TODO: fix de-const cast... */ |
4287 | - struct ril_msg *message = (struct ril_msg *) data; |
4288 | struct ofono_error error; |
4289 | - struct reply_setup_data_call *reply; |
4290 | + struct reply_setup_data_call *reply = |
4291 | + g_ril_reply_parse_data_call(NULL, data, &error); |
4292 | |
4293 | - reply = g_ril_reply_parse_data_call(NULL, message, &error); |
4294 | g_assert(reply != NULL); |
4295 | g_ril_reply_free_setup_data_call(reply); |
4296 | |
4297 | @@ -362,39 +1370,152 @@ |
4298 | error.error == 0); |
4299 | } |
4300 | |
4301 | +static void test_reply_reg_state_invalid(gconstpointer data) |
4302 | +{ |
4303 | + struct reply_reg_state *reply = g_ril_reply_parse_reg_state(NULL, data); |
4304 | + g_assert(reply == NULL); |
4305 | +} |
4306 | + |
4307 | +static void test_reply_reg_state_valid(gconstpointer data) |
4308 | +{ |
4309 | + const reg_state_test *test = data; |
4310 | + struct reply_reg_state *reply = |
4311 | + g_ril_reply_parse_reg_state(NULL, &test->msg); |
4312 | + |
4313 | + g_assert(reply != NULL); |
4314 | + g_assert(reply->status == test->status); |
4315 | + |
4316 | + g_assert(reply->tech == test->tech); |
4317 | + g_free(reply); |
4318 | +} |
4319 | + |
4320 | +static void test_reply_operator_invalid(gconstpointer data) |
4321 | +{ |
4322 | + struct reply_operator *reply = g_ril_reply_parse_operator(NULL, data); |
4323 | + g_assert(reply == NULL); |
4324 | +} |
4325 | + |
4326 | +static void test_reply_operator_valid(gconstpointer data) |
4327 | +{ |
4328 | + struct reply_operator *reply = g_ril_reply_parse_operator(NULL, data); |
4329 | + g_assert(reply != NULL); |
4330 | +} |
4331 | + |
4332 | +static void test_reply_avail_ops_invalid(gconstpointer data) |
4333 | +{ |
4334 | + struct reply_avail_ops *reply = g_ril_reply_parse_avail_ops(NULL, data); |
4335 | + g_assert(reply == NULL); |
4336 | +} |
4337 | + |
4338 | +static void test_reply_avail_ops_valid(gconstpointer data) |
4339 | +{ |
4340 | + struct reply_avail_ops *reply = g_ril_reply_parse_avail_ops(NULL, data); |
4341 | + g_assert(reply != NULL); |
4342 | +} |
4343 | + |
4344 | static void test_reply_sim_io_valid(gconstpointer data) |
4345 | { |
4346 | - /* TODO: fix de-const cast... */ |
4347 | - struct ril_msg *message = (struct ril_msg *) data; |
4348 | - struct reply_sim_io *reply; |
4349 | - |
4350 | - reply = g_ril_reply_parse_sim_io(NULL, message); |
4351 | + struct reply_sim_io *reply = g_ril_reply_parse_sim_io(NULL, data); |
4352 | g_assert(reply != NULL); |
4353 | g_ril_reply_free_sim_io(reply); |
4354 | } |
4355 | |
4356 | static void test_reply_imsi_valid(gconstpointer data) |
4357 | { |
4358 | - /* TODO: fix de-const cast... */ |
4359 | - struct ril_msg *message = (struct ril_msg *) data; |
4360 | - gchar *reply; |
4361 | - |
4362 | - reply = g_ril_reply_parse_imsi(NULL, message); |
4363 | + gchar *reply = g_ril_reply_parse_imsi(NULL, data); |
4364 | g_assert(reply != NULL); |
4365 | g_free(reply); |
4366 | } |
4367 | |
4368 | static void test_reply_sim_status_valid(gconstpointer data) |
4369 | { |
4370 | - /* TODO: fix de-const cast... */ |
4371 | - struct ril_msg *message = (struct ril_msg *) data; |
4372 | struct reply_sim_status *reply; |
4373 | |
4374 | - reply = g_ril_reply_parse_sim_status(NULL, message); |
4375 | + reply = g_ril_reply_parse_sim_status(NULL, data); |
4376 | g_assert(reply != NULL); |
4377 | g_ril_reply_free_sim_status(reply); |
4378 | } |
4379 | |
4380 | +static void test_reply_get_smsc_address_valid(gconstpointer data) |
4381 | +{ |
4382 | + struct ofono_phone_number *reply; |
4383 | + |
4384 | + reply = g_ril_reply_parse_get_smsc_address(NULL, data); |
4385 | + |
4386 | + g_assert(reply != NULL); |
4387 | + g_free(reply); |
4388 | +} |
4389 | + |
4390 | +static void test_reply_get_current_calls_valid(gconstpointer data) |
4391 | +{ |
4392 | + GSList *calls; |
4393 | + |
4394 | + calls = g_ril_reply_parse_get_calls(NULL, data); |
4395 | + |
4396 | + g_assert(calls != NULL); |
4397 | + |
4398 | + g_slist_foreach(calls, (GFunc) g_free, NULL); |
4399 | + g_slist_free(calls); |
4400 | +} |
4401 | + |
4402 | +static void test_reply_get_current_calls_invalid(gconstpointer data) |
4403 | +{ |
4404 | + GSList *calls; |
4405 | + |
4406 | + calls = g_ril_reply_parse_get_calls(NULL, data); |
4407 | + |
4408 | + g_assert(calls == NULL); |
4409 | +} |
4410 | + |
4411 | +static void test_reply_call_fail_cause_valid(gconstpointer data) |
4412 | +{ |
4413 | + enum ofono_disconnect_reason reason; |
4414 | + |
4415 | + reason = g_ril_reply_parse_call_fail_cause(NULL, data); |
4416 | + |
4417 | + g_assert(reason >= 0); |
4418 | +} |
4419 | + |
4420 | +static void test_reply_get_mute_off(gconstpointer data) |
4421 | +{ |
4422 | + int muted; |
4423 | + |
4424 | + muted = g_ril_reply_parse_get_mute(NULL, data); |
4425 | + |
4426 | + g_assert(muted == 0); |
4427 | +} |
4428 | + |
4429 | +static void test_reply_get_mute_on(gconstpointer data) |
4430 | +{ |
4431 | + int muted; |
4432 | + |
4433 | + muted = g_ril_reply_parse_get_mute(NULL, data); |
4434 | + |
4435 | + g_assert(muted == 1); |
4436 | +} |
4437 | + |
4438 | +static void test_reply_baseband_version_valid(gconstpointer data) |
4439 | +{ |
4440 | + char *version; |
4441 | + |
4442 | + version = g_ril_reply_parse_baseband_version(NULL, data); |
4443 | + |
4444 | + g_assert(version != NULL); |
4445 | + |
4446 | + g_free(version); |
4447 | +} |
4448 | + |
4449 | +static void test_reply_get_imei_valid(gconstpointer data) |
4450 | +{ |
4451 | + char *imei; |
4452 | + |
4453 | + imei = g_ril_reply_parse_get_imei(NULL, data); |
4454 | + |
4455 | + g_assert(imei != NULL); |
4456 | + |
4457 | + g_free(imei); |
4458 | +} |
4459 | + |
4460 | int main(int argc, char **argv) |
4461 | { |
4462 | g_test_init(&argc, &argv, NULL); |
4463 | @@ -447,6 +1568,126 @@ |
4464 | &reply_data_call_valid_1, |
4465 | test_reply_data_call_valid); |
4466 | |
4467 | + g_test_add_data_func("/testgrilreply/gprs: " |
4468 | + "invalid DATA_REG_STATE Test 1", |
4469 | + &reply_data_reg_state_invalid_1, |
4470 | + test_reply_reg_state_invalid); |
4471 | + |
4472 | + g_test_add_data_func("/testgrilreply/gprs: " |
4473 | + "invalid DATA_REG_STATE Test 2", |
4474 | + &reply_data_reg_state_invalid_2, |
4475 | + test_reply_reg_state_invalid); |
4476 | + |
4477 | + g_test_add_data_func("/testgrilreply/gprs: " |
4478 | + "invalid DATA_REG_STATE Test 3", |
4479 | + &reply_data_reg_state_invalid_3, |
4480 | + test_reply_reg_state_invalid); |
4481 | + |
4482 | + g_test_add_data_func("/testgrilreply/gprs: " |
4483 | + "valid DATA_REG_STATE Test 1", |
4484 | + &data_reg_valid_1, |
4485 | + test_reply_reg_state_valid); |
4486 | + |
4487 | + g_test_add_data_func("/testgrilreply/gprs: " |
4488 | + "valid DATA_REG_STATE Test 2", |
4489 | + &data_reg_valid_2, |
4490 | + test_reply_reg_state_valid); |
4491 | + |
4492 | + g_test_add_data_func("/testgrilreply/gprs: " |
4493 | + "valid DATA_REG_STATE Test 3", |
4494 | + &data_reg_valid_3, |
4495 | + test_reply_reg_state_valid); |
4496 | + |
4497 | + g_test_add_data_func("/testgrilreply/gprs: " |
4498 | + "valid DATA_REG_STATE Test 4", |
4499 | + &data_reg_valid_4, |
4500 | + test_reply_reg_state_valid); |
4501 | + |
4502 | + g_test_add_data_func("/testgrilreply/gprs: " |
4503 | + "valid DATA_REG_STATE Test 5", |
4504 | + &data_reg_valid_5, |
4505 | + test_reply_reg_state_valid); |
4506 | + |
4507 | + g_test_add_data_func("/testgrilreply/gprs: " |
4508 | + "valid DATA_REG_STATE Test 6", |
4509 | + &data_reg_valid_6, |
4510 | + test_reply_reg_state_valid); |
4511 | + |
4512 | + g_test_add_data_func("/testgrilreply/gprs: " |
4513 | + "valid DATA_REG_STATE Test 7", |
4514 | + &data_reg_valid_7, |
4515 | + test_reply_reg_state_valid); |
4516 | + |
4517 | + g_test_add_data_func("/testgrilreply/gprs: " |
4518 | + "valid DATA_REG_STATE Test 8", |
4519 | + &data_reg_valid_8, |
4520 | + test_reply_reg_state_valid); |
4521 | + |
4522 | + g_test_add_data_func("/testgrilreply/gprs: " |
4523 | + "valid DATA_REG_STATE Test 9", |
4524 | + &data_reg_valid_9, |
4525 | + test_reply_reg_state_valid); |
4526 | + |
4527 | + g_test_add_data_func("/testgrilreply/gprs: " |
4528 | + "valid DATA_REG_STATE Test 10", |
4529 | + &data_reg_valid_10, |
4530 | + test_reply_reg_state_valid); |
4531 | + |
4532 | + g_test_add_data_func("/testgrilreply/netreg: " |
4533 | + "valid VOICE_REG_STATE Test 1", |
4534 | + &voice_reg_valid_1, |
4535 | + test_reply_reg_state_valid); |
4536 | + |
4537 | + g_test_add_data_func("/testgrilreply/netreg: " |
4538 | + "valid VOICE_REG_STATE Test 2", |
4539 | + &voice_reg_valid_2, |
4540 | + test_reply_reg_state_valid); |
4541 | + |
4542 | + g_test_add_data_func("/testgrilreply/netreg: " |
4543 | + "valid VOICE_REG_STATE Test 3", |
4544 | + &voice_reg_valid_3, |
4545 | + test_reply_reg_state_valid); |
4546 | + |
4547 | + g_test_add_data_func("/testgrilreply/netreg: " |
4548 | + "valid VOICE_REG_STATE Test 4", |
4549 | + &voice_reg_valid_4, |
4550 | + test_reply_reg_state_valid); |
4551 | + |
4552 | + g_test_add_data_func("/testgrilreply/netreg: " |
4553 | + "valid VOICE_REG_STATE Test 5", |
4554 | + &voice_reg_valid_5, |
4555 | + test_reply_reg_state_valid); |
4556 | + |
4557 | + g_test_add_data_func("/testgrilreply/netreg: " |
4558 | + "invalid GET_OPERATOR Test 1", |
4559 | + &reply_operator_invalid_1, |
4560 | + test_reply_operator_invalid); |
4561 | + |
4562 | + g_test_add_data_func("/testgrilreply/netreg: " |
4563 | + "invalid GET_OPERATOR Test 2", |
4564 | + &reply_operator_invalid_2, |
4565 | + test_reply_operator_invalid); |
4566 | + |
4567 | + g_test_add_data_func("/testgrilreply/netreg: " |
4568 | + "valid GET_OPERATOR Test 1", |
4569 | + &reply_operator_valid_1, |
4570 | + test_reply_operator_valid); |
4571 | + |
4572 | + g_test_add_data_func("/testgrilreply/netreg: " |
4573 | + "invalid QUERY_AVAIL_OPS Test 1", |
4574 | + &reply_avail_ops_invalid_1, |
4575 | + test_reply_avail_ops_invalid); |
4576 | + |
4577 | + g_test_add_data_func("/testgrilreply/netreg: " |
4578 | + "invalid QUERY_AVAIL_OPS Test 2", |
4579 | + &reply_avail_ops_invalid_2, |
4580 | + test_reply_avail_ops_invalid); |
4581 | + |
4582 | + g_test_add_data_func("/testgrilreply/netreg: " |
4583 | + "valid QUERY_AVAIL_OPS Test 1", |
4584 | + &reply_avail_ops_valid_1, |
4585 | + test_reply_avail_ops_valid); |
4586 | + |
4587 | g_test_add_data_func("/testgrilreply/sim: " |
4588 | "valid SIM_IO Test 1", |
4589 | &reply_sim_io_valid_1, |
4590 | @@ -462,6 +1703,51 @@ |
4591 | &reply_sim_status_valid_1, |
4592 | test_reply_sim_status_valid); |
4593 | |
4594 | + g_test_add_data_func("/testgrilreply/sim: " |
4595 | + "valid GET_SMSC_ADDRESS Test 1", |
4596 | + &reply_get_smsc_address_valid_1, |
4597 | + test_reply_get_smsc_address_valid); |
4598 | + |
4599 | + g_test_add_data_func("/testgrilreply/voicecall: " |
4600 | + "valid GET_CURRENT_CALLS Test 1", |
4601 | + &reply_get_current_calls_valid_1, |
4602 | + test_reply_get_current_calls_valid); |
4603 | + |
4604 | + g_test_add_data_func("/testgrilreply/voicecall: " |
4605 | + "invalid GET_CURRENT_CALLS Test 1", |
4606 | + &reply_get_current_calls_invalid_1, |
4607 | + test_reply_get_current_calls_invalid); |
4608 | + |
4609 | + g_test_add_data_func("/testgrilreply/voicecall: " |
4610 | + "invalid GET_CURRENT_CALLS Test 2", |
4611 | + &reply_get_current_calls_invalid_2, |
4612 | + test_reply_get_current_calls_invalid); |
4613 | + |
4614 | + g_test_add_data_func("/testgrilreply/voicecall: " |
4615 | + "valid CALL_FAIL_CAUSE Test 1", |
4616 | + &reply_call_fail_cause_valid_1, |
4617 | + test_reply_call_fail_cause_valid); |
4618 | + |
4619 | + g_test_add_data_func("/testgrilreply/call-volume: " |
4620 | + "off GET_MUTE Test 1", |
4621 | + &reply_get_mute_off_1, |
4622 | + test_reply_get_mute_off); |
4623 | + |
4624 | + g_test_add_data_func("/testgrilreply/call-volume: " |
4625 | + "on GET_MUTE Test 1", |
4626 | + &reply_get_mute_on_1, |
4627 | + test_reply_get_mute_on); |
4628 | + |
4629 | + g_test_add_data_func("/testgrilreply/devinfo: " |
4630 | + "valid BASEBAND_VERSION Test 1", |
4631 | + &reply_baseband_version_valid_1, |
4632 | + test_reply_baseband_version_valid); |
4633 | + |
4634 | + g_test_add_data_func("/testgrilreply/devinfo: " |
4635 | + "valid GET_IMEI Test 1", |
4636 | + &reply_get_imei_valid_1, |
4637 | + test_reply_get_imei_valid); |
4638 | + |
4639 | #endif |
4640 | |
4641 | return g_test_run(); |
4642 | |
4643 | === modified file 'unit/test-grilrequest.c' |
4644 | --- unit/test-grilrequest.c 2013-11-05 16:28:08 +0000 |
4645 | +++ unit/test-grilrequest.c 2013-12-04 21:58:23 +0000 |
4646 | @@ -38,7 +38,7 @@ |
4647 | |
4648 | struct request_test_data { |
4649 | gconstpointer request; |
4650 | - guchar *parcel_data; |
4651 | + const guchar *parcel_data; |
4652 | gsize parcel_size; |
4653 | }; |
4654 | |
4655 | @@ -189,11 +189,11 @@ |
4656 | /* sim_read_binary tests */ |
4657 | |
4658 | static const guchar req_sim_read_binary_parcel_valid_1[] = { |
4659 | -0xb0, 0x00, 0x00, 0x00, 0xe2, 0x2f, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, |
4660 | -0x33, 0x00, 0x46, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, |
4661 | -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, |
4662 | -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, |
4663 | -0x00, 0x00, 0x00, 0x00, |
4664 | + 0xb0, 0x00, 0x00, 0x00, 0xe2, 0x2f, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, |
4665 | + 0x33, 0x00, 0x46, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, |
4666 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, |
4667 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, |
4668 | + 0x00, 0x00, 0x00, 0x00, |
4669 | }; |
4670 | |
4671 | static const unsigned char sim_read_binary_path_valid_1[] = {0x3F, 0x00}; |
4672 | @@ -217,11 +217,11 @@ |
4673 | /* sim_read_record tests */ |
4674 | |
4675 | static const guchar req_sim_read_record_parcel_valid_1[] = { |
4676 | -0xb2, 0x00, 0x00, 0x00, 0xe2, 0x2f, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, |
4677 | -0x33, 0x00, 0x46, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, |
4678 | -0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, |
4679 | -0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, |
4680 | -0x00, 0x00, 0x00, 0x00, |
4681 | + 0xb2, 0x00, 0x00, 0x00, 0xe2, 0x2f, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, |
4682 | + 0x33, 0x00, 0x46, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, |
4683 | + 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, |
4684 | + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, |
4685 | + 0x00, 0x00, 0x00, 0x00, |
4686 | }; |
4687 | |
4688 | static const unsigned char sim_read_record_path_valid_1[] = {0x3F, 0x00}; |
4689 | @@ -245,7 +245,7 @@ |
4690 | /* read_imsi tests */ |
4691 | |
4692 | static const guchar req_read_imsi_parcel_valid_1[] = { |
4693 | -0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
4694 | + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
4695 | }; |
4696 | |
4697 | static const char read_imsi_aid_str_1[] = ""; |
4698 | @@ -266,9 +266,9 @@ |
4699 | }; |
4700 | |
4701 | static const guchar req_pin_send_parcel_valid_1[] = { |
4702 | -0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, |
4703 | -0x33, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
4704 | -0x00, 0x00, 0x00, 0x00, |
4705 | + 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, |
4706 | + 0x33, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
4707 | + 0x00, 0x00, 0x00, 0x00, |
4708 | }; |
4709 | |
4710 | static const struct request_test_pin_send_data pin_send_record_valid_test_1 = { |
4711 | @@ -281,11 +281,11 @@ |
4712 | /* pin_change_state tests */ |
4713 | |
4714 | static const guchar req_pin_change_state_valid_1[] = { |
4715 | -0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x53, 0x00, |
4716 | -0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, |
4717 | -0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, 0x33, 0x00, 0x34, 0x00, |
4718 | -0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, |
4719 | -0xFF, 0xFF, 0xFF, 0xFF, |
4720 | + 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x53, 0x00, |
4721 | + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, |
4722 | + 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, 0x33, 0x00, 0x34, 0x00, |
4723 | + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, |
4724 | + 0xFF, 0xFF, 0xFF, 0xFF, |
4725 | }; |
4726 | |
4727 | static const struct req_pin_change_state req_pin_change_state_valid1 = { |
4728 | @@ -312,11 +312,11 @@ |
4729 | }; |
4730 | |
4731 | static const guchar req_pin_send_puk_parcel_valid_1[] = { |
4732 | -0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, |
4733 | -0x33, 0x00, 0x34, 0x00, 0x35, 0x00, 0x36, 0x00, 0x37, 0x00, 0x38, 0x00, |
4734 | -0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, |
4735 | -0x33, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
4736 | -0x00, 0x00, 0x00, 0x00, |
4737 | + 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, |
4738 | + 0x33, 0x00, 0x34, 0x00, 0x35, 0x00, 0x36, 0x00, 0x37, 0x00, 0x38, 0x00, |
4739 | + 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, |
4740 | + 0x33, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
4741 | + 0x00, 0x00, 0x00, 0x00, |
4742 | }; |
4743 | |
4744 | static const struct request_test_pin_send_puk_data pin_send_puk_valid_test_1 = { |
4745 | @@ -338,10 +338,10 @@ |
4746 | }; |
4747 | |
4748 | static const guchar req_change_passwd_parcel_valid_1[] = { |
4749 | -0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, |
4750 | -0x33, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, |
4751 | -0x35, 0x00, 0x36, 0x00, 0x37, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, |
4752 | -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
4753 | + 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, |
4754 | + 0x33, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, |
4755 | + 0x35, 0x00, 0x36, 0x00, 0x37, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, |
4756 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
4757 | }; |
4758 | |
4759 | static const struct request_test_change_passwd_data change_passwd_valid_test_1 = { |
4760 | @@ -352,12 +352,174 @@ |
4761 | .parcel_size = sizeof(req_change_passwd_parcel_valid_1), |
4762 | }; |
4763 | |
4764 | +/* sms_cmgs tests */ |
4765 | + |
4766 | +static const unsigned char req_sms_cmgs_pdu_valid_1[] = { |
4767 | + 0x00, 0x11, 0x00, 0x09, 0x81, 0x36, 0x54, 0x39, 0x80, 0xf5, 0x00, 0x00, |
4768 | + 0xa7, 0x0a, 0xc8, 0x37, 0x3b, 0x0c, 0x6a, 0xd7, 0xdd, 0xe4, 0x37 |
4769 | +}; |
4770 | + |
4771 | +static const guchar req_sms_cmgs_parcel_valid_1[] = { |
4772 | + 0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, |
4773 | + 0x31, 0x00, 0x31, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x39, 0x00, |
4774 | + 0x38, 0x00, 0x31, 0x00, 0x33, 0x00, 0x36, 0x00, 0x35, 0x00, 0x34, 0x00, |
4775 | + 0x33, 0x00, 0x39, 0x00, 0x38, 0x00, 0x30, 0x00, 0x46, 0x00, 0x35, 0x00, |
4776 | + 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x41, 0x00, 0x37, 0x00, |
4777 | + 0x30, 0x00, 0x41, 0x00, 0x43, 0x00, 0x38, 0x00, 0x33, 0x00, 0x37, 0x00, |
4778 | + 0x33, 0x00, 0x42, 0x00, 0x30, 0x00, 0x43, 0x00, 0x36, 0x00, 0x41, 0x00, |
4779 | + 0x44, 0x00, 0x37, 0x00, 0x44, 0x00, 0x44, 0x00, 0x45, 0x00, 0x34, 0x00, |
4780 | + 0x33, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00 |
4781 | +}; |
4782 | + |
4783 | +static const struct req_sms_cmgs req_sms_cmgs_valid1 = { |
4784 | + .pdu = req_sms_cmgs_pdu_valid_1, |
4785 | + .pdu_len = sizeof(req_sms_cmgs_pdu_valid_1), |
4786 | + .tpdu_len = sizeof(req_sms_cmgs_pdu_valid_1) - 1, |
4787 | +}; |
4788 | + |
4789 | +static const struct request_test_data sms_cmgs_valid_test_1 = { |
4790 | + .request = &req_sms_cmgs_valid1, |
4791 | + .parcel_data = (guchar *) &req_sms_cmgs_parcel_valid_1, |
4792 | + .parcel_size = sizeof(req_sms_cmgs_parcel_valid_1), |
4793 | +}; |
4794 | + |
4795 | +/* sms_acknowledge tests */ |
4796 | + |
4797 | +static const guchar req_sms_acknowledge_parcel_valid_1[] = { |
4798 | + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
4799 | +}; |
4800 | + |
4801 | +static const struct request_test_data sms_acknowledge_valid_test_1 = { |
4802 | + .request = NULL, |
4803 | + .parcel_data = (guchar *) &req_sms_acknowledge_parcel_valid_1, |
4804 | + .parcel_size = sizeof(req_sms_acknowledge_parcel_valid_1), |
4805 | +}; |
4806 | + |
4807 | +/* set_smsc_address tests */ |
4808 | + |
4809 | +static const guchar req_set_smsc_address_valid_parcel1[] = { |
4810 | + 0x0e, 0x00, 0x00, 0x00, 0x22, 0x00, 0x2b, 0x00, 0x33, 0x00, 0x34, 0x00, |
4811 | + 0x36, 0x00, 0x30, 0x00, 0x37, 0x00, 0x30, 0x00, 0x30, 0x00, 0x33, 0x00, |
4812 | + 0x31, 0x00, 0x31, 0x00, 0x30, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00 |
4813 | +}; |
4814 | + |
4815 | +static const struct ofono_phone_number smsc_address_valid1 = { |
4816 | + .type = 145, |
4817 | + .number = "34607003110" |
4818 | +}; |
4819 | + |
4820 | +static const struct request_test_data smsc_address_valid_test_1 = { |
4821 | + .request = &smsc_address_valid1, |
4822 | + .parcel_data = (guchar *) &req_set_smsc_address_valid_parcel1, |
4823 | + .parcel_size = sizeof(req_set_smsc_address_valid_parcel1), |
4824 | +}; |
4825 | + |
4826 | +/* dial tests */ |
4827 | + |
4828 | +struct request_test_dial_data { |
4829 | + const struct ofono_phone_number ph; |
4830 | + enum ofono_clir_option clir; |
4831 | + const guchar *parcel_data; |
4832 | + size_t parcel_size; |
4833 | +}; |
4834 | + |
4835 | +static const guchar req_dial_parcel_valid_1[] = { |
4836 | + 0x09, 0x00, 0x00, 0x00, 0x39, 0x00, 0x31, 0x00, 0x37, 0x00, 0x35, 0x00, |
4837 | + 0x32, 0x00, 0x35, 0x00, 0x35, 0x00, 0x35, 0x00, 0x35, 0x00, 0x00, 0x00, |
4838 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
4839 | +}; |
4840 | + |
4841 | +static const struct request_test_dial_data dial_valid_test_1 = { |
4842 | + .ph = { .number = "917525555", .type = 129 }, |
4843 | + .clir = OFONO_CLIR_OPTION_DEFAULT, |
4844 | + .parcel_data = req_dial_parcel_valid_1, |
4845 | + .parcel_size = sizeof(req_dial_parcel_valid_1), |
4846 | +}; |
4847 | + |
4848 | +/* hangup tests */ |
4849 | + |
4850 | +static const guchar req_hangup_parcel_valid_1[] = { |
4851 | + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 |
4852 | +}; |
4853 | + |
4854 | +static unsigned hangup_call_id_valid_1 = 1; |
4855 | + |
4856 | +static const struct request_test_data set_hangup_valid_test_1 = { |
4857 | + .request = &hangup_call_id_valid_1, |
4858 | + .parcel_data = req_hangup_parcel_valid_1, |
4859 | + .parcel_size = sizeof(req_hangup_parcel_valid_1), |
4860 | +}; |
4861 | + |
4862 | +/* dtmf tests */ |
4863 | + |
4864 | +static const guchar req_dtmf_parcel_valid_1[] = { |
4865 | + 0x01, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00 |
4866 | +}; |
4867 | + |
4868 | +static char dtmf_char_valid_1 = '4'; |
4869 | + |
4870 | +static const struct request_test_data dtmf_valid_test_1 = { |
4871 | + .request = &dtmf_char_valid_1, |
4872 | + .parcel_data = req_dtmf_parcel_valid_1, |
4873 | + .parcel_size = sizeof(req_dtmf_parcel_valid_1), |
4874 | +}; |
4875 | + |
4876 | +/* separate_conn tests */ |
4877 | + |
4878 | +static const guchar req_separate_conn_parcel_valid_1[] = { |
4879 | + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 |
4880 | +}; |
4881 | + |
4882 | +static unsigned separate_conn_call_id_valid_1 = 1; |
4883 | + |
4884 | +static const struct request_test_data separate_conn_valid_test_1 = { |
4885 | + .request = &separate_conn_call_id_valid_1, |
4886 | + .parcel_data = req_separate_conn_parcel_valid_1, |
4887 | + .parcel_size = sizeof(req_separate_conn_parcel_valid_1), |
4888 | +}; |
4889 | + |
4890 | +/* set_supp_svc_notif tests */ |
4891 | + |
4892 | +static const guchar req_set_supp_svc_notif_parcel_valid_1[] = { |
4893 | + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 |
4894 | +}; |
4895 | + |
4896 | +static const struct request_test_data set_supp_svc_notif_valid_test_1 = { |
4897 | + .request = NULL, |
4898 | + .parcel_data = req_set_supp_svc_notif_parcel_valid_1, |
4899 | + .parcel_size = sizeof(req_set_supp_svc_notif_parcel_valid_1), |
4900 | +}; |
4901 | + |
4902 | +/* set_mute tests */ |
4903 | + |
4904 | +static const int mute_off = 0; |
4905 | +static const int mute_on = 1; |
4906 | + |
4907 | +static const guchar req_set_mute_valid_parcel1[] = { |
4908 | + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
4909 | +}; |
4910 | + |
4911 | +static const struct request_test_data set_mute_valid_test_1 = { |
4912 | + .request = &mute_off, |
4913 | + .parcel_data = (guchar *) &req_set_mute_valid_parcel1, |
4914 | + .parcel_size = sizeof(req_set_mute_valid_parcel1), |
4915 | +}; |
4916 | + |
4917 | +static const guchar req_set_mute_valid_parcel2[] = { |
4918 | + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 |
4919 | +}; |
4920 | + |
4921 | +static const struct request_test_data set_mute_valid_test_2 = { |
4922 | + .request = &mute_on, |
4923 | + .parcel_data = (guchar *) &req_set_mute_valid_parcel2, |
4924 | + .parcel_size = sizeof(req_set_mute_valid_parcel2), |
4925 | +}; |
4926 | |
4927 | /* |
4928 | * The following hexadecimal data represents a serialized Binder parcel |
4929 | * instance containing a valid RIL_REQUEST_RADIO_POWER 'OFF' message. |
4930 | */ |
4931 | -static const guchar req_power_off_valid_parcel1[8] = { |
4932 | +static const guchar req_power_off_valid_parcel1[] = { |
4933 | 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
4934 | }; |
4935 | |
4936 | @@ -365,7 +527,7 @@ |
4937 | * The following hexadecimal data represents a serialized Binder parcel |
4938 | * instance containing a valid RIL_REQUEST_RADIO_POWER 'ON' message. |
4939 | */ |
4940 | -static const guchar req_power_on_valid_parcel2[8] = { |
4941 | +static const guchar req_power_on_valid_parcel2[] = { |
4942 | 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 |
4943 | }; |
4944 | |
4945 | @@ -375,13 +537,13 @@ |
4946 | static const struct request_test_data power_valid_test_1 = { |
4947 | .request = &power_off, |
4948 | .parcel_data = (guchar *) &req_power_off_valid_parcel1, |
4949 | - .parcel_size = 8, |
4950 | + .parcel_size = sizeof(req_power_off_valid_parcel1), |
4951 | }; |
4952 | |
4953 | static const struct request_test_data power_valid_test_2 = { |
4954 | .request = &power_on, |
4955 | .parcel_data = (guchar *) &req_power_on_valid_parcel2, |
4956 | - .parcel_size = 8, |
4957 | + .parcel_size = sizeof(req_power_on_valid_parcel2), |
4958 | }; |
4959 | |
4960 | static void test_deactivate_data_call_invalid(gconstpointer data) |
4961 | @@ -600,6 +762,131 @@ |
4962 | parcel_free(&rilp); |
4963 | } |
4964 | |
4965 | +static void test_request_sms_cmgs(gconstpointer data) |
4966 | +{ |
4967 | + const struct request_test_data *test_data = data; |
4968 | + const struct req_sms_cmgs *req = test_data->request; |
4969 | + struct parcel rilp; |
4970 | + |
4971 | + g_ril_request_sms_cmgs(NULL, req, &rilp); |
4972 | + |
4973 | + g_assert(!memcmp(rilp.data, test_data->parcel_data, |
4974 | + test_data->parcel_size)); |
4975 | + |
4976 | + parcel_free(&rilp); |
4977 | +} |
4978 | + |
4979 | +static void test_request_sms_acknowledge(gconstpointer data) |
4980 | +{ |
4981 | + const struct request_test_data *test_data = data; |
4982 | + struct parcel rilp; |
4983 | + |
4984 | + g_ril_request_sms_acknowledge(NULL, &rilp); |
4985 | + |
4986 | + g_assert(!memcmp(rilp.data, test_data->parcel_data, |
4987 | + test_data->parcel_size)); |
4988 | + |
4989 | + parcel_free(&rilp); |
4990 | +} |
4991 | + |
4992 | +static void test_request_set_smsc_address(gconstpointer data) |
4993 | +{ |
4994 | + const struct request_test_data *test_data = data; |
4995 | + const struct ofono_phone_number *number = test_data->request; |
4996 | + struct parcel rilp; |
4997 | + |
4998 | + g_ril_request_set_smsc_address(NULL, number, &rilp); |
4999 | + |
5000 | + g_assert(!memcmp(rilp.data, test_data->parcel_data, |
PASSED: Continuous integration, rev:6845 jenkins. qa.ubuntu. com/job/ phablet- team-ofono- ubuntu- ci/15/ jenkins. qa.ubuntu. com/job/ phablet- team-ofono- ubuntu- trusty- amd64-ci/ 8 jenkins. qa.ubuntu. com/job/ phablet- team-ofono- ubuntu- trusty- armhf-ci/ 8 jenkins. qa.ubuntu. com/job/ phablet- team-ofono- ubuntu- trusty- armhf-ci/ 8/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ phablet- team-ofono- ubuntu- trusty- i386-ci/ 8
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/phablet- team-ofono- ubuntu- ci/15/rebuild
http://