2 * tel-plugin-socket-communicator
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Ja-young Gu <jygu@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
25 #include <glib-object.h>
31 #include <communicator.h>
32 #include <core_object.h>
34 #include <user_request.h>
39 #include "tapi_common.h"
40 #include "module_req.h"
42 static gchar* _convert_access_result_to_string(enum tel_sim_access_result rt)
44 gchar *string_rt = NULL;
46 case SIM_ACCESS_SUCCESS :
49 case SIM_ACCESS_CARD_ERROR :
50 string_rt = "card_error\0";
52 case SIM_ACCESS_FILE_NOT_FOUND :
53 string_rt = "file_not_found\0";
55 case SIM_ACCESS_CONDITION_NOT_SATISFIED :
56 string_rt = "condition_not_satisfied\0";
58 case SIM_ACCESS_FAILED :
59 string_rt = "failed\0";
62 dbg("error - rt[%d] is not handled");
63 string_rt = "failed\0";
69 gboolean scomm_service_reqeust_sim(unsigned int ch_id, Communicator *c, TcorePlugin *plugin, tapi_service_command_e cmd, gchar *data, void **outparam)
71 GSList *co_list = NULL;
72 CoreObject *co_sim = NULL;
73 UserRequest *ur = NULL;
74 struct tcore_user_info ui = { 0, 0, 0, NULL,0,0, NULL };
76 gboolean result = TRUE;
80 struct _tapi_service_object out_o = {0,};
81 struct _sipc_marshal_object *in_o = NULL;
83 co_list = tcore_plugin_get_core_objects_bytype(plugin, CORE_OBJECT_TYPE_SIM);
85 dbg("err-no sim core object list in current plugin");
90 co_sim = (CoreObject *)co_list->data;
92 dbg("err-no sim core object in current plugin");
97 g_slist_free(co_list);
99 dbg("request cmd[0x%x]",cmd);
102 out_o.mo = sipc_util_marshal_object_create();
104 if ( cmd !=TAPI_SERVICE_SIM_GET_SIMINITINFO
105 && cmd != TAPI_SERVICE_SIM_GET_TYPE
106 && cmd != TAPI_SERVICE_SIM_GET_IMSI ) {
107 ur = tcore_user_request_new(c, tcore_plugin_get_description(plugin)->name);
109 dbg("err - ur creation failed");
114 ui.channel_id = ch_id;
116 tcore_user_request_set_user_info(ur, &ui);
118 in_o = sipc_util_marshal_object_deserializer(data);
120 dbg("err - data deserializer failed, in_o is null");
127 case TAPI_SERVICE_SIM_GET_SIMINITINFO : {
128 enum tel_sim_status sim_status = SIM_STATUS_UNKNOWN;
129 gboolean sim_changed = FALSE;
130 sim_status = tcore_sim_get_status(co_sim);
131 sipc_util_marshal_object_add_data(out_o.mo, "status", &sim_status,
132 SIPC_MARSHAL_DATA_INT_TYPE);
133 sipc_util_marshal_object_add_data(out_o.mo, "new_sim", &sim_changed,
134 SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
138 case TAPI_SERVICE_SIM_GET_TYPE : {
139 enum tel_sim_type type = SIM_TYPE_UNKNOWN;
141 type = tcore_sim_get_type(co_sim);
143 case SIM_TYPE_UNKNOWN:
161 sipc_util_marshal_object_add_data(out_o.mo, "type", stype,
162 SIPC_MARSHAL_DATA_STRING_TYPE);
166 case TAPI_SERVICE_SIM_GET_IMSI : {
167 struct tel_sim_imsi *n_imsi = NULL;
168 n_imsi = tcore_sim_get_imsi(co_sim);
169 if (n_imsi != NULL) {
170 dbg("n_imsi->plmn[%s]", n_imsi->plmn);
171 sipc_util_marshal_object_add_data(out_o.mo, "mcc", n_imsi->plmn,
172 SIPC_MARSHAL_DATA_STRING_TYPE);
173 sipc_util_marshal_object_add_data(out_o.mo, "mnc", n_imsi->plmn + 3,
174 SIPC_MARSHAL_DATA_STRING_TYPE);
175 sipc_util_marshal_object_add_data(out_o.mo, "msin", n_imsi->msin,
176 SIPC_MARSHAL_DATA_STRING_TYPE);
181 case TAPI_SERVICE_SIM_GET_ECC :
182 tcore_user_request_set_command(ur, TREQ_SIM_GET_ECC);
185 case TAPI_SERVICE_SIM_GET_ICCID :
186 tcore_user_request_set_command(ur, TREQ_SIM_GET_ICCID);
189 case TAPI_SERVICE_SIM_GET_LANGUAGE :
190 tcore_user_request_set_command(ur, TREQ_SIM_GET_LANGUAGE);
193 case TAPI_SERVICE_SIM_SET_LANGUAGE : {
194 struct treq_sim_set_language set_language = { 0, };
195 gchar *g_language = NULL;
196 g_language = sipc_util_marshal_object_get_string(in_o, "language");
197 dbg("tmp - g_language[%s]",g_language);
199 if (!g_strcmp0(g_language, "de")) {
200 set_language.language = SIM_LANG_GERMAN;
201 } else if (!g_strcmp0(g_language, "en")) {
202 set_language.language = SIM_LANG_ENGLISH;
203 } else if (!g_strcmp0(g_language, "it")) {
204 set_language.language = SIM_LANG_ITALIAN;
205 } else if (!g_strcmp0(g_language, "fr")) {
206 set_language.language = SIM_LANG_FRENCH;
207 } else if (!g_strcmp0(g_language, "es")) {
208 set_language.language = SIM_LANG_SPANISH;
209 } else if (!g_strcmp0(g_language, "nl")) {
210 set_language.language = SIM_LANG_DUTCH;
211 } else if (!g_strcmp0(g_language, "sv")) {
212 set_language.language = SIM_LANG_SWEDISH;
213 } else if (!g_strcmp0(g_language, "da")) {
214 set_language.language = SIM_LANG_DANISH;
215 } else if (!g_strcmp0(g_language, "pt")) {
216 set_language.language = SIM_LANG_PORTUGUESE;
217 } else if (!g_strcmp0(g_language, "fi")) {
218 set_language.language = SIM_LANG_FINNISH;
219 } else if (!g_strcmp0(g_language, "no")) {
220 set_language.language = SIM_LANG_NORWEGIAN;
221 } else if (!g_strcmp0(g_language, "el")) {
222 set_language.language = SIM_LANG_GREEK;
223 } else if (!g_strcmp0(g_language, "tr")) {
224 set_language.language = SIM_LANG_TURKISH;
225 } else if (!g_strcmp0(g_language, "hu")) {
226 set_language.language = SIM_LANG_HUNGARIAN;
227 } else if (!g_strcmp0(g_language, "pl")) {
228 set_language.language = SIM_LANG_POLISH;
229 } else if (!g_strcmp0(g_language, "ko")) {
230 set_language.language = SIM_LANG_KOREAN;
231 } else if (!g_strcmp0(g_language, "zh")) {
232 set_language.language = SIM_LANG_CHINESE;
233 } else if (!g_strcmp0(g_language, "ru")) {
234 set_language.language = SIM_LANG_RUSSIAN;
235 } else if (!g_strcmp0(g_language, "ja")) {
236 set_language.language = SIM_LANG_JAPANESE;
242 tcore_user_request_set_data(ur, sizeof(struct treq_sim_set_language), &set_language);
243 tcore_user_request_set_command(ur, TREQ_SIM_SET_LANGUAGE);
247 case TAPI_SERVICE_SIM_GET_CF :
248 tcore_user_request_set_command(ur, TREQ_SIM_GET_CALLFORWARDING);
251 case TAPI_SERVICE_SIM_SET_CF :
252 /*not defined value yet*/
255 case TAPI_SERVICE_SIM_GET_MW :
256 tcore_user_request_set_command(ur, TREQ_SIM_GET_MESSAGEWAITING);
259 case TAPI_SERVICE_SIM_SET_MW :
260 /*not defined value yet*/
263 case TAPI_SERVICE_SIM_GET_MB :
264 tcore_user_request_set_command(ur, TREQ_SIM_GET_MAILBOX);
267 case TAPI_SERVICE_SIM_SET_MB :
268 /*not defined value yet*/
271 case TAPI_SERVICE_SIM_GET_CPHSINFO :
272 tcore_user_request_set_command(ur, TREQ_SIM_GET_CPHS_INFO);
275 case TAPI_SERVICE_SIM_GET_MSISDN :
276 tcore_user_request_set_command(ur, TREQ_SIM_GET_MSISDN);
279 case TAPI_SERVICE_SIM_GET_OPLMNWACT :
280 tcore_user_request_set_command(ur, TREQ_SIM_GET_OPLMNWACT);
283 case TAPI_SERVICE_SIM_AUTHENTICATION : {
284 struct treq_sim_req_authentication req_auth = { 0, };
285 gchar *g_auth_type = NULL;
286 unsigned int g_autn_length;
287 unsigned char *g_autn_data = NULL;
288 unsigned int g_rand_length;
289 unsigned char *g_rand_data = NULL;
290 g_auth_type = sipc_util_marshal_object_get_string(in_o, "type");
291 g_autn_data = sipc_util_marshal_object_get_string(in_o, "autn_data");
292 g_autn_length = sipc_util_marshal_object_get_int(in_o, "autn_data_length");
293 g_rand_data = sipc_util_marshal_object_get_string(in_o, "rand_data");
294 g_rand_length = sipc_util_marshal_object_get_int(in_o, "rand_data_length");
296 dbg("tmp - g_auth_type[%s]",g_auth_type);
298 dbg("tmp - g_rand_data[%s]",g_rand_data);
300 dbg("tmp - g_autn_data[%s]",g_autn_data);
302 if (!g_strcmp0(g_auth_type, "ims")) {
303 req_auth.auth_type = SIM_AUTH_TYPE_IMS;
304 } else if (!g_strcmp0(g_auth_type, "gsm")) {
305 req_auth.auth_type = SIM_AUTH_TYPE_GSM;
306 } else if (!g_strcmp0(g_auth_type, "3g")) {
307 req_auth.auth_type = SIM_AUTH_TYPE_3G;
313 req_auth.autn_length = g_autn_length;
314 if(req_auth.autn_length)
315 memcpy(req_auth.autn_data, g_autn_data, req_auth.autn_length);
316 req_auth.rand_length = g_rand_length;
317 if(req_auth.rand_length)
318 memcpy(req_auth.rand_data, g_rand_data, req_auth.rand_length);
320 tcore_user_request_set_data(ur, sizeof(struct treq_sim_req_authentication), &req_auth);
321 tcore_user_request_set_command(ur, TREQ_SIM_REQ_AUTHENTICATION);
325 case TAPI_SERVICE_SIM_VERIFYSEC : {
326 struct treq_sim_verify_pins verify_pins = { 0, };
327 gchar *g_pin_type = NULL;
328 unsigned int g_pin_length;
329 unsigned char *g_pin = NULL;
330 g_pin_type = sipc_util_marshal_object_get_string(in_o, "type");
331 g_pin = sipc_util_marshal_object_get_string(in_o, "pw");
332 g_pin_length = strlen(g_pin);
334 dbg("tmp - g_pin_type[%s]",g_pin_type);
335 dbg("tmp - g_pin_length[%d]",g_pin_length);
337 dbg("tmp - g_pin[%s]",g_pin);
339 if (!g_strcmp0(g_pin_type, "pin1")) {
340 verify_pins.pin_type = SIM_PTYPE_PIN1;
341 } else if (!g_strcmp0(g_pin_type, "pin2")) {
342 verify_pins.pin_type = SIM_PTYPE_PIN2;
343 } else if (!g_strcmp0(g_pin_type, "admin")) {
344 verify_pins.pin_type = SIM_PTYPE_ADM;
345 } else if (!g_strcmp0(g_pin_type, "sim")) {
346 verify_pins.pin_type = SIM_PTYPE_SIM;
352 verify_pins.pin_length = g_pin_length;
353 memcpy(verify_pins.pin, g_pin, verify_pins.pin_length);
355 tcore_user_request_set_data(ur, sizeof(struct treq_sim_verify_pins), &verify_pins);
356 tcore_user_request_set_command(ur, TREQ_SIM_VERIFY_PINS);
360 case TAPI_SERVICE_SIM_VERIFYPUK : {
361 struct treq_sim_verify_puks verify_puks = { 0, };
362 gchar *g_puk_type = NULL;
363 unsigned int g_puk_length;
364 unsigned char *g_puk = NULL;
365 unsigned int g_pin_length;
366 unsigned char *g_pin = NULL;
367 g_puk_type = sipc_util_marshal_object_get_string(in_o, "type");
368 g_puk = sipc_util_marshal_object_get_string(in_o, "puk");
369 g_puk_length = strlen(g_puk);
370 g_pin = sipc_util_marshal_object_get_string(in_o, "pin");
371 g_pin_length = strlen(g_pin);
373 dbg("tmp - g_puk_type[%s]",g_puk_type);
375 dbg("tmp - g_puk[%s]",g_puk);
377 dbg("tmp - g_pin[%s]",g_pin);
379 if (!g_strcmp0(g_puk_type, "puk1")) {
380 verify_puks.puk_type = SIM_PTYPE_PUK1;
381 } else if (!g_strcmp0(g_puk_type, "puk2")) {
382 verify_puks.puk_type = SIM_PTYPE_PUK2;
388 verify_puks.puk_length = g_puk_length;
389 memcpy(verify_puks.puk, g_puk, verify_puks.puk_length);
390 verify_puks.pin_length = g_pin_length;
391 memcpy(verify_puks.pin, g_pin, verify_puks.pin_length);
393 tcore_user_request_set_data(ur, sizeof(struct treq_sim_verify_puks), &verify_puks);
394 tcore_user_request_set_command(ur, TREQ_SIM_VERIFY_PUKS);
398 case TAPI_SERVICE_SIM_CHANGEPIN : {
399 struct treq_sim_change_pins change_pins = { 0, };
400 gchar *g_type = NULL;
401 unsigned int g_old_pw_length;
402 unsigned char *g_old_pw = NULL;
403 unsigned int g_new_pw_length;
404 unsigned char *g_new_pw = NULL;
405 g_type = sipc_util_marshal_object_get_string(in_o, "type");
406 g_old_pw = sipc_util_marshal_object_get_string(in_o, "old_pw");
407 g_old_pw_length = strlen(g_old_pw);
408 g_new_pw = sipc_util_marshal_object_get_string(in_o, "new_pw");
409 g_new_pw_length = strlen(g_new_pw);
411 dbg("tmp - g_type[%s]",g_type);
413 dbg("tmp - g_old_pw[%s]",g_old_pw);
415 dbg("tmp - g_new_pw[%s]",g_new_pw);
417 if (!g_strcmp0(g_type, "pin1")) {
418 change_pins.type = SIM_PTYPE_PIN1;
419 } else if (!g_strcmp0(g_type, "pin2")) {
420 change_pins.type = SIM_PTYPE_PIN2;
426 change_pins.old_pin_length = g_old_pw_length;
427 memcpy(change_pins.old_pin, g_old_pw, change_pins.old_pin_length);
428 change_pins.new_pin_length = g_new_pw_length;
429 memcpy(change_pins.new_pin, g_new_pw, change_pins.new_pin_length);
431 tcore_user_request_set_data(ur, sizeof(struct treq_sim_change_pins), &change_pins);
432 tcore_user_request_set_command(ur, TREQ_SIM_CHANGE_PINS);
436 case TAPI_SERVICE_SIM_DISABLE_FACILITY : {
437 struct treq_sim_disable_facility dis_facility = { 0, };
438 gchar *g_dis_type = NULL;
439 unsigned int g_dis_pw_length;
440 unsigned char *g_dis_pw = NULL;
441 g_dis_type = sipc_util_marshal_object_get_string(in_o, "type");
442 g_dis_pw = sipc_util_marshal_object_get_string(in_o, "pw");
443 g_dis_pw_length = strlen(g_dis_pw);
445 dbg("tmp - g_dis_type[%s]",g_dis_type);
447 dbg("tmp - g_dis_pw[%s]",g_dis_pw);
449 if (!g_strcmp0(g_dis_type, "ps")) {
450 dis_facility.type = SIM_FACILITY_PS;
451 } else if (!g_strcmp0(g_dis_type, "sc")) {
452 dis_facility.type = SIM_FACILITY_SC;
453 } else if (!g_strcmp0(g_dis_type, "fd")) {
454 dis_facility.type = SIM_FACILITY_FD;
455 } else if (!g_strcmp0(g_dis_type, "pn")) {
456 dis_facility.type = SIM_FACILITY_PN;
457 } else if (!g_strcmp0(g_dis_type, "pu")) {
458 dis_facility.type = SIM_FACILITY_PU;
459 } else if (!g_strcmp0(g_dis_type, "pp")) {
460 dis_facility.type = SIM_FACILITY_PP;
461 } else if (!g_strcmp0(g_dis_type, "pc")) {
462 dis_facility.type = SIM_FACILITY_PC;
468 dis_facility.password_length = g_dis_pw_length;
469 memcpy(dis_facility.password, g_dis_pw, dis_facility.password_length);
471 tcore_user_request_set_data(ur, sizeof(struct treq_sim_disable_facility), &dis_facility);
472 tcore_user_request_set_command(ur, TREQ_SIM_DISABLE_FACILITY);
476 case TAPI_SERVICE_SIM_ENABLE_FACILITY : {
477 struct treq_sim_enable_facility en_facility = { 0, };
478 gchar *g_en_type = NULL;
479 unsigned int g_en_pw_length;
480 unsigned char *g_en_pw = NULL;
481 g_en_type = sipc_util_marshal_object_get_string(in_o, "type");
482 g_en_pw = sipc_util_marshal_object_get_string(in_o, "pw");
483 g_en_pw_length = strlen(g_en_pw);
485 dbg("tmp - g_en_type[%s]",g_en_type);
487 dbg("tmp - g_en_pw[%s]",g_en_pw);
489 if (!g_strcmp0(g_en_type, "ps")) {
490 en_facility.type = SIM_FACILITY_PS;
491 } else if (!g_strcmp0(g_en_type, "sc")) {
492 en_facility.type = SIM_FACILITY_SC;
493 } else if (!g_strcmp0(g_en_type, "fd")) {
494 en_facility.type = SIM_FACILITY_FD;
495 } else if (!g_strcmp0(g_en_type, "pn")) {
496 en_facility.type = SIM_FACILITY_PN;
497 } else if (!g_strcmp0(g_en_type, "pu")) {
498 en_facility.type = SIM_FACILITY_PU;
499 } else if (!g_strcmp0(g_en_type, "pp")) {
500 en_facility.type = SIM_FACILITY_PP;
501 } else if (!g_strcmp0(g_en_type, "pc")) {
502 en_facility.type = SIM_FACILITY_PC;
508 en_facility.password_length = g_en_pw_length;
509 memcpy(en_facility.password, g_en_pw, en_facility.password_length);
511 tcore_user_request_set_data(ur, sizeof(struct treq_sim_enable_facility), &en_facility);
512 tcore_user_request_set_command(ur, TREQ_SIM_ENABLE_FACILITY);
516 case TAPI_SERVICE_SIM_GET_FACILITY : {
517 struct treq_sim_get_facility_status facility = { 0, };
518 gchar *g_facility_type = NULL;
519 g_facility_type = sipc_util_marshal_object_get_string(in_o, "type");
520 dbg("tmp - g_facility_type[%s]",g_facility_type);
522 if (!g_strcmp0(g_facility_type, "ps")) {
523 facility.type = SIM_FACILITY_PS;
524 } else if (!g_strcmp0(g_facility_type, "sc")) {
525 facility.type = SIM_FACILITY_SC;
526 } else if (!g_strcmp0(g_facility_type, "fd")) {
527 facility.type = SIM_FACILITY_FD;
528 } else if (!g_strcmp0(g_facility_type, "pn")) {
529 facility.type = SIM_FACILITY_PN;
530 } else if (!g_strcmp0(g_facility_type, "pu")) {
531 facility.type = SIM_FACILITY_PU;
532 } else if (!g_strcmp0(g_facility_type, "pp")) {
533 facility.type = SIM_FACILITY_PP;
534 } else if (!g_strcmp0(g_facility_type, "pc")) {
535 facility.type = SIM_FACILITY_PC;
541 tcore_user_request_set_data(ur, sizeof(struct treq_sim_get_facility_status), &facility);
542 tcore_user_request_set_command(ur, TREQ_SIM_GET_FACILITY_STATUS);
546 case TAPI_SERVICE_SIM_APDU : {
547 struct treq_sim_transmit_apdu send_apdu ={ 0, };
549 gchar *g_apdu = NULL;
550 g_apdu_length = sipc_util_marshal_object_get_int(in_o, "apdu_length");
551 g_apdu = sipc_util_marshal_object_get_string(in_o, "apdu");
553 send_apdu.apdu_length = (unsigned int)g_apdu_length;
554 memcpy(send_apdu.apdu, g_apdu, send_apdu.apdu_length);
556 tcore_user_request_set_data(ur, sizeof(struct treq_sim_transmit_apdu), &send_apdu);
557 tcore_user_request_set_command(ur, TREQ_SIM_TRANSMIT_APDU);
561 case TAPI_SERVICE_SIM_ATR :
562 tcore_user_request_set_command(ur, TREQ_SIM_GET_ATR);
566 dbg("not handled command [%d] here",cmd);
571 sipc_util_marshal_object_destory(in_o);
572 sipc_util_marshal_object_add_data(out_o.mo, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
574 dbg("result = %d", result);
576 tmp = sipc_util_marshal_object_serializer(out_o.mo);
577 tmp_len = strlen(tmp);
578 *outparam = g_new0(char, tmp_len+1);
579 memcpy(*outparam, tmp, tmp_len);
580 sipc_util_marshal_object_destory(out_o.mo);
583 if ( cmd !=TAPI_SERVICE_SIM_GET_SIMINITINFO
584 && cmd != TAPI_SERVICE_SIM_GET_TYPE
585 && cmd != TAPI_SERVICE_SIM_GET_IMSI ) {
586 if (result == FALSE) {
587 tcore_user_request_unref(ur);
591 ret = tcore_communicator_dispatch_request(c, ur);
592 if (ret != TCORE_RETURN_SUCCESS) {
593 dbg("error - dispatch result[%d]", ret);
600 gboolean scomm_service_response_sim(Communicator *comm, UserRequest *ur, enum tcore_response_command command,
601 unsigned int data_len, const void *data)
603 const struct tresp_sim_verify_pins *resp_verify_pins = data;
604 const struct tresp_sim_verify_puks *resp_verify_puks = data;
605 const struct tresp_sim_change_pins *resp_change_pins = data;
606 const struct tresp_sim_get_facility_status *resp_get_facility = data;
607 const struct tresp_sim_disable_facility *resp_dis_facility = data;
608 const struct tresp_sim_enable_facility *resp_en_facility = data;
609 const struct tresp_sim_transmit_apdu *resp_apdu = data;
610 const struct tresp_sim_get_atr *resp_get_atr = data;
611 const struct tresp_sim_read *resp_read = data;
612 const struct tresp_sim_req_authentication *resp_auth = data;
613 const struct tresp_sim_set_language *resp_set_language = data;
616 gchar *out_d= NULL, *serial_d = NULL;
617 gchar *entry_key = NULL;
618 struct custom_data *ctx = NULL;
619 const struct tcore_user_info *ui;
620 sipc_server_t *s = NULL;
621 struct _tapi_header hdr;
622 struct _sipc_marshal_object* out_o = NULL;
623 struct _sipc_marshal_object* entry_o = NULL;
625 memset(&hdr, 0, sizeof(struct _tapi_header));
627 ctx = tcore_communicator_ref_user_data(comm);
629 dbg("user_data is NULL");
633 ui = tcore_user_request_ref_user_info(ur);
636 dbg("application channel id(%d), Command = [0x%x], data_len = %d", ui->channel_id, command, data_len);
637 hdr.cmd = (tapi_service_command_e)ui->client_cmd;
639 out_o = sipc_util_marshal_object_create();
642 case TRESP_SIM_VERIFY_PINS: {
644 dbg("resp comm - TRESP_SIM_VERIFY_PINS");
646 if (resp_verify_pins->pin_type == SIM_PTYPE_PIN1) {
648 } else if (resp_verify_pins->pin_type == SIM_PTYPE_PIN2) {
650 } else if (resp_verify_pins->pin_type == SIM_PTYPE_ADM) {
652 } else if (resp_verify_pins->pin_type == SIM_PTYPE_SIM) {
655 dbg("error - [%d] is not handled case in here", resp_verify_pins->pin_type);
657 dbg("gtype[%s]",gtype);
658 sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_verify_pins->result, SIPC_MARSHAL_DATA_INT_TYPE);
659 sipc_util_marshal_object_add_data(out_o, "type", (void*)gtype, SIPC_MARSHAL_DATA_STRING_TYPE);
660 sipc_util_marshal_object_add_data(out_o, "remain_count", (void*)&resp_verify_pins->retry_count, SIPC_MARSHAL_DATA_INT_TYPE);
664 case TRESP_SIM_VERIFY_PUKS: {
666 dbg("resp comm - TRESP_SIM_VERIFY_PUKS");
668 if (resp_verify_puks->pin_type == SIM_PTYPE_PUK1) {
670 } else if (resp_verify_puks->pin_type == SIM_PTYPE_PUK2) {
673 dbg("error - [%d] is not handled case in here", resp_verify_puks->pin_type);
675 dbg("gtype[%s]",gtype);
676 sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_verify_puks->result, SIPC_MARSHAL_DATA_INT_TYPE);
677 sipc_util_marshal_object_add_data(out_o, "type", (void*)gtype, SIPC_MARSHAL_DATA_STRING_TYPE);
678 sipc_util_marshal_object_add_data(out_o, "remain_count", (void*)&resp_verify_puks->retry_count, SIPC_MARSHAL_DATA_INT_TYPE);
682 case TRESP_SIM_CHANGE_PINS: {
684 dbg("resp comm - TRESP_SIM_CHANGE_PINS");
686 if (resp_change_pins->pin_type == SIM_PTYPE_PIN1) {
688 } else if (resp_change_pins->pin_type == SIM_PTYPE_PIN2) {
691 dbg("error - [%d] is not handled case in here", resp_change_pins->pin_type);
693 dbg("gtype[%s]",gtype);
694 sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_change_pins->result, SIPC_MARSHAL_DATA_INT_TYPE);
695 sipc_util_marshal_object_add_data(out_o, "type", (void*)gtype, SIPC_MARSHAL_DATA_STRING_TYPE);
696 sipc_util_marshal_object_add_data(out_o, "remain_count", (void*)&resp_change_pins->retry_count, SIPC_MARSHAL_DATA_INT_TYPE);
700 case TRESP_SIM_GET_FACILITY_STATUS: {
702 gchar *gstatus = NULL;
703 dbg("resp comm - TRESP_SIM_GET_FACILITY_STATUS");
705 if (resp_get_facility->type == SIM_FACILITY_PS) {
707 } else if (resp_get_facility->type == SIM_FACILITY_SC) {
709 } else if (resp_get_facility->type == SIM_FACILITY_FD) {
711 } else if (resp_get_facility->type == SIM_FACILITY_PN) {
713 } else if (resp_get_facility->type == SIM_FACILITY_PU) {
715 } else if (resp_get_facility->type == SIM_FACILITY_PP) {
717 } else if (resp_get_facility->type == SIM_FACILITY_PC) {
720 dbg("error - [%d] is not handled case in here", resp_get_facility->type);
722 dbg("ftype[%s]",ftype);
723 sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_get_facility->result, SIPC_MARSHAL_DATA_INT_TYPE);
724 sipc_util_marshal_object_add_data(out_o, "type", (void*)ftype, SIPC_MARSHAL_DATA_STRING_TYPE);
726 if (resp_get_facility->result == SIM_PUK_REQUIRED) {
727 gstatus = "blocked\0";
728 } else if (resp_get_facility->result == SIM_CARD_ERROR) {
729 gstatus = "permanent_blocked\0";
730 } else if (resp_get_facility->result == SIM_PIN_OPERATION_SUCCESS) {
731 if ( resp_get_facility->b_enable )
732 gstatus = "enabled\0";
734 gstatus = "disabled\0";
736 gstatus = "unknown\0";
738 dbg("gstatus[%s]",gstatus);
739 sipc_util_marshal_object_add_data(out_o, "status", (void*)gstatus, SIPC_MARSHAL_DATA_STRING_TYPE);
743 case TRESP_SIM_DISABLE_FACILITY: {
745 dbg("resp comm - TRESP_SIM_DISABLE_FACILITY");
746 if (resp_dis_facility->type == SIM_FACILITY_PS) {
748 } else if (resp_dis_facility->type == SIM_FACILITY_SC) {
750 } else if (resp_dis_facility->type == SIM_FACILITY_FD) {
752 } else if (resp_dis_facility->type == SIM_FACILITY_PN) {
754 } else if (resp_dis_facility->type == SIM_FACILITY_PU) {
756 } else if (resp_dis_facility->type == SIM_FACILITY_PP) {
758 } else if (resp_dis_facility->type == SIM_FACILITY_PC) {
761 dbg("error - [%d] is not handled case in here", resp_dis_facility->type);
763 dbg("ftype[%s]",ftype);
764 sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_dis_facility->result, SIPC_MARSHAL_DATA_INT_TYPE);
765 sipc_util_marshal_object_add_data(out_o, "type", (void*)ftype, SIPC_MARSHAL_DATA_STRING_TYPE);
766 sipc_util_marshal_object_add_data(out_o, "remain_count", (void*)&resp_dis_facility->retry_count, SIPC_MARSHAL_DATA_INT_TYPE);
770 case TRESP_SIM_ENABLE_FACILITY: {
772 dbg("resp comm - TRESP_SIM_ENABLE_FACILITY");
773 if (resp_en_facility->type == SIM_FACILITY_PS) {
775 } else if (resp_en_facility->type == SIM_FACILITY_SC) {
777 } else if (resp_en_facility->type == SIM_FACILITY_FD) {
779 } else if (resp_en_facility->type == SIM_FACILITY_PN) {
781 } else if (resp_en_facility->type == SIM_FACILITY_PU) {
783 } else if (resp_en_facility->type == SIM_FACILITY_PP) {
785 } else if (resp_en_facility->type == SIM_FACILITY_PC) {
788 dbg("error - [%d] is not handled case in here", resp_en_facility->type);
790 dbg("ftype[%s]",ftype);
791 sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_en_facility->result, SIPC_MARSHAL_DATA_INT_TYPE);
792 sipc_util_marshal_object_add_data(out_o, "type", (void*)ftype, SIPC_MARSHAL_DATA_STRING_TYPE);
793 sipc_util_marshal_object_add_data(out_o, "remain_count", (void*)&resp_en_facility->retry_count, SIPC_MARSHAL_DATA_INT_TYPE);
797 case TRESP_SIM_TRANSMIT_APDU: {
798 gchar *access_rt = NULL;
799 dbg("resp comm - TRESP_SIM_TRANSMIT_APDU");
800 access_rt = _convert_access_result_to_string(resp_apdu->result);
801 sipc_util_marshal_object_add_data(out_o, "result", (void*)access_rt, SIPC_MARSHAL_DATA_STRING_TYPE);
802 sipc_util_marshal_object_add_data(out_o, "apdu_length", (void*)&resp_apdu->apdu_resp_length, SIPC_MARSHAL_DATA_INT_TYPE);
803 sipc_util_marshal_object_add_data(out_o, "apdu", (void*)&resp_apdu->apdu_resp, SIPC_MARSHAL_DATA_STRING_TYPE);
807 case TRESP_SIM_GET_ATR: {
808 gchar *access_rt = NULL;
809 dbg("resp comm - TRESP_SIM_GET_ATR");
810 access_rt = _convert_access_result_to_string(resp_get_atr->result);
811 sipc_util_marshal_object_add_data(out_o, "result", (void*)access_rt, SIPC_MARSHAL_DATA_STRING_TYPE);
812 sipc_util_marshal_object_add_data(out_o, "atr_length", (void*)&resp_get_atr->atr_length, SIPC_MARSHAL_DATA_INT_TYPE);
813 sipc_util_marshal_object_add_data(out_o, "atr", (void*)&resp_get_atr->atr, SIPC_MARSHAL_DATA_STRING_TYPE);
817 case TRESP_SIM_REQ_AUTHENTICATION: {
818 gchar *access_rt = NULL;
819 gchar *auth_rt = NULL;
820 dbg("resp comm - TRESP_SIM_REQ_AUTHENTICATION");
821 access_rt = _convert_access_result_to_string(resp_auth->result);
822 sipc_util_marshal_object_add_data(out_o, "result", (void*)access_rt, SIPC_MARSHAL_DATA_STRING_TYPE);
823 sipc_util_marshal_object_add_data(out_o, "type", (void*)&resp_auth->auth_type, SIPC_MARSHAL_DATA_INT_TYPE);
825 switch (resp_auth->auth_result) {
826 case SIM_AUTH_NO_ERROR:
829 case SIM_AUTH_CANNOT_PERFORM:
830 auth_rt = "can_not_perform\0";
832 case SIM_AUTH_SKIP_RESPONSE:
833 auth_rt = "skip_response\0";
835 case SIM_AUTH_MAK_CODE_FAILURE:
836 auth_rt = "mak_failure\0";
838 case SIM_AUTH_SQN_FAILURE:
839 auth_rt = "sqn_failure\0";
841 case SIM_AUTH_SYNCH_FAILURE:
842 auth_rt = "synch_failure\0";
844 case SIM_AUTH_UNSUPPORTED_CONTEXT:
845 auth_rt = "unsupported_context\0";
848 dbg("[%d] is not handled in here",resp_auth->auth_result );
852 sipc_util_marshal_object_add_data(out_o, "auth_result", (void*)auth_rt, SIPC_MARSHAL_DATA_INT_TYPE);
853 sipc_util_marshal_object_add_data(out_o, "authentication_key_length", (void*)&resp_auth->authentication_key_length, SIPC_MARSHAL_DATA_INT_TYPE);
854 if(resp_auth->authentication_key_length)
855 sipc_util_marshal_object_add_data(out_o, "authentication_key", (void*)&resp_auth->authentication_key, SIPC_MARSHAL_DATA_STRING_TYPE);
856 sipc_util_marshal_object_add_data(out_o, "cipher_length", (void*)&resp_auth->cipher_length, SIPC_MARSHAL_DATA_INT_TYPE);
857 if(resp_auth->cipher_length)
858 sipc_util_marshal_object_add_data(out_o, "cipher_data", (void*)&resp_auth->cipher_data, SIPC_MARSHAL_DATA_STRING_TYPE);
859 sipc_util_marshal_object_add_data(out_o, "integrity_length", (void*)&resp_auth->integrity_length, SIPC_MARSHAL_DATA_INT_TYPE);
860 if(resp_auth->integrity_length)
861 sipc_util_marshal_object_add_data(out_o, "integrity_data", (void*)&resp_auth->integrity_data, SIPC_MARSHAL_DATA_STRING_TYPE);
862 sipc_util_marshal_object_add_data(out_o, "resp_length", (void*)&resp_auth->resp_length, SIPC_MARSHAL_DATA_INT_TYPE);
863 if(resp_auth->resp_length)
864 sipc_util_marshal_object_add_data(out_o, "resp_data", (void*)&resp_auth->resp_data, SIPC_MARSHAL_DATA_STRING_TYPE);
868 case TRESP_SIM_SET_LANGUAGE: {
869 gchar *access_rt = NULL;
870 dbg("resp comm - TRESP_SIM_SET_LANGUAGE");
871 access_rt = _convert_access_result_to_string(resp_read->result);
872 sipc_util_marshal_object_add_data(out_o, "result", (void*)access_rt, SIPC_MARSHAL_DATA_STRING_TYPE);
876 case TRESP_SIM_GET_ECC: {
877 gchar *access_rt = NULL;
878 dbg("resp comm - TRESP_SIM_GET_ECC");
879 access_rt = _convert_access_result_to_string(resp_read->result);
880 sipc_util_marshal_object_add_data(out_o, "result", (void*)access_rt, SIPC_MARSHAL_DATA_STRING_TYPE);
881 sipc_util_marshal_object_add_data(out_o, "count", (void*)&resp_read->data.ecc.ecc_count, SIPC_MARSHAL_DATA_INT_TYPE);
883 dbg("tmp - resp_read->data.ecc.ecc_count[%d]",resp_read->data.ecc.ecc_count);
885 for(i=0;i < resp_read->data.ecc.ecc_count; i++){
886 gchar *entry_key = NULL;
887 gchar *gcategory = NULL;
888 entry_o = sipc_util_marshal_object_create();
889 dbg("tmp - resp_read->data.ecc.ecc[%d].ecc_string[%s]",i, resp_read->data.ecc.ecc[i].ecc_string);
890 dbg("tmp - resp_read->data.ecc.ecc[%d].ecc_num[%s]",i, resp_read->data.ecc.ecc[i].ecc_num);
891 dbg("tmp - resp_read->data.ecc.ecc[%d].ecc_category[%d]",i, resp_read->data.ecc.ecc[i].ecc_category);
892 sipc_util_marshal_object_add_data(entry_o, "name", (void*)&resp_read->data.ecc.ecc[i].ecc_string, SIPC_MARSHAL_DATA_STRING_TYPE);
893 sipc_util_marshal_object_add_data(entry_o, "number", (void*)&resp_read->data.ecc.ecc[i].ecc_num, SIPC_MARSHAL_DATA_STRING_TYPE);
895 switch (resp_read->data.ecc.ecc[i].ecc_category) {
897 gcategory = "police\0";
899 case SIM_ECC_AMBULANCE:
900 gcategory = "ambulance\0";
902 case SIM_ECC_FIREBRIGADE :
903 gcategory = "firebrigade\0";
905 case SIM_ECC_MARAINEGUARD :
906 gcategory = "maraineguard\0";
908 case SIM_ECC_MOUTAINRESCUE :
909 gcategory = "mountainrescue\0";
913 gcategory = "spare\0";
916 sipc_util_marshal_object_add_data(entry_o, "category", (void*)gcategory, SIPC_MARSHAL_DATA_STRING_TYPE);
917 entry_key = g_strdup_printf("%d", i);
918 sipc_util_marshal_object_add_data(out_o, entry_key, entry_o, SIPC_MARSHAL_DATA_OBJECT_TYPE);
923 case TRESP_SIM_GET_LANGUAGE: {
924 gchar *access_rt = NULL;
925 char *language_tb[] = { "de", "en", "it", "fr", "es", "nl", "sv", "da", "pt", "fi", "no", "el",
926 "tr", "hu", "pl", "ko", "zh", "ru", "ja" };
927 dbg("resp comm - TRESP_SIM_GET_LANGUAGE");
928 access_rt = _convert_access_result_to_string(resp_read->result);
929 dbg("tmp - access_rt[%s]",access_rt);
930 dbg("tmp - resp_read->data.language.language[0][%d]",resp_read->data.language.language[0]);
931 sipc_util_marshal_object_add_data(out_o, "result", (void*)access_rt, SIPC_MARSHAL_DATA_STRING_TYPE);
932 dbg("tmp-language[%s]",language_tb[resp_read->data.language.language[0]]);
933 sipc_util_marshal_object_add_data(out_o, "language", (void*)language_tb[resp_read->data.language.language[0]] , SIPC_MARSHAL_DATA_STRING_TYPE);
937 case TRESP_SIM_GET_ICCID: {
938 gchar *access_rt = NULL;
939 dbg("resp comm - TRESP_SIM_GET_ICCID");
940 access_rt = _convert_access_result_to_string(resp_read->result);
941 sipc_util_marshal_object_add_data(out_o, "result", (void*)access_rt, SIPC_MARSHAL_DATA_STRING_TYPE);
942 sipc_util_marshal_object_add_data(out_o, "iccid", (void*)&resp_read->data.iccid.iccid , SIPC_MARSHAL_DATA_STRING_TYPE);
946 case TRESP_SIM_GET_MAILBOX: {
947 gchar *access_rt = NULL;
948 dbg("resp comm - TRESP_SIM_GET_MAILBOX");
949 access_rt = _convert_access_result_to_string(resp_read->result);
950 sipc_util_marshal_object_add_data(out_o, "result", (void*)access_rt, SIPC_MARSHAL_DATA_STRING_TYPE);
952 if(resp_read->data.mailbox.voice1.DiallingnumLength){
954 entry_o = sipc_util_marshal_object_create();
955 sipc_util_marshal_object_add_data(entry_o, "type", "voice1", SIPC_MARSHAL_DATA_STRING_TYPE);
956 sipc_util_marshal_object_add_data(entry_o, "name", (void*)&resp_read->data.mailbox.voice1.AlphaId, SIPC_MARSHAL_DATA_STRING_TYPE);
957 sipc_util_marshal_object_add_data(entry_o, "number", (void*)&resp_read->data.mailbox.voice1.DiallingNum , SIPC_MARSHAL_DATA_STRING_TYPE);
958 sipc_util_marshal_object_add_data(entry_o, "ton", (void*)&resp_read->data.mailbox.voice1.TypeOfNumber , SIPC_MARSHAL_DATA_INT_TYPE);
959 sipc_util_marshal_object_add_data(entry_o, "npi", (void*)&resp_read->data.mailbox.voice1.NumberingPlanIdent , SIPC_MARSHAL_DATA_INT_TYPE);
960 entry_key = g_strdup_printf("%d", count);
961 sipc_util_marshal_object_add_data(out_o, entry_key, entry_o, SIPC_MARSHAL_DATA_OBJECT_TYPE);
962 dbg("tmp - resp_read->data.mailbox.voice1.AlphaId[%s]",resp_read->data.mailbox.voice1.AlphaId);
963 dbg("tmp - resp_read->data.mailbox.voice1.DiallingNum[%s]",resp_read->data.mailbox.voice1.DiallingNum);
964 dbg("tmp - resp_read->data.mailbox.voice1.TypeOfNumber[%d]",resp_read->data.mailbox.voice1.TypeOfNumber);
965 dbg("tmp - resp_read->data.mailbox.voice1.NumberingPlanIdent[%d]",resp_read->data.mailbox.voice1.NumberingPlanIdent);
968 if(resp_read->data.mailbox.voice2.DiallingnumLength){
970 entry_o = sipc_util_marshal_object_create();
971 sipc_util_marshal_object_add_data(entry_o, "type", "voice2", SIPC_MARSHAL_DATA_STRING_TYPE);
972 sipc_util_marshal_object_add_data(entry_o, "name", (void*)&resp_read->data.mailbox.voice2.AlphaId, SIPC_MARSHAL_DATA_STRING_TYPE);
973 sipc_util_marshal_object_add_data(entry_o, "number", (void*)&resp_read->data.mailbox.voice2.DiallingNum , SIPC_MARSHAL_DATA_STRING_TYPE);
974 sipc_util_marshal_object_add_data(entry_o, "ton", (void*)&resp_read->data.mailbox.voice2.TypeOfNumber , SIPC_MARSHAL_DATA_INT_TYPE);
975 sipc_util_marshal_object_add_data(entry_o, "npi", (void*)&resp_read->data.mailbox.voice2.NumberingPlanIdent , SIPC_MARSHAL_DATA_INT_TYPE);
976 entry_key = g_strdup_printf("%d", count);
977 sipc_util_marshal_object_add_data(out_o, entry_key, entry_o, SIPC_MARSHAL_DATA_OBJECT_TYPE);
978 dbg("tmp - resp_read->data.mailbox.voice2.AlphaId[%s]",resp_read->data.mailbox.voice2.AlphaId);
979 dbg("tmp - resp_read->data.mailbox.voice2.DiallingNum[%s]",resp_read->data.mailbox.voice2.DiallingNum);
980 dbg("tmp - resp_read->data.mailbox.voice2.TypeOfNumber[%d]",resp_read->data.mailbox.voice2.TypeOfNumber);
981 dbg("tmp - resp_read->data.mailbox.voice2.NumberingPlanIdent[%d]",resp_read->data.mailbox.voice2.NumberingPlanIdent);
984 if(resp_read->data.mailbox.fax.DiallingnumLength){
986 entry_o = sipc_util_marshal_object_create();
987 sipc_util_marshal_object_add_data(entry_o, "type", "fax", SIPC_MARSHAL_DATA_STRING_TYPE);
988 sipc_util_marshal_object_add_data(entry_o, "name", (void*)&resp_read->data.mailbox.fax.AlphaId, SIPC_MARSHAL_DATA_STRING_TYPE);
989 sipc_util_marshal_object_add_data(entry_o, "number", (void*)&resp_read->data.mailbox.fax.DiallingNum , SIPC_MARSHAL_DATA_STRING_TYPE);
990 sipc_util_marshal_object_add_data(entry_o, "ton", (void*)&resp_read->data.mailbox.fax.TypeOfNumber , SIPC_MARSHAL_DATA_INT_TYPE);
991 sipc_util_marshal_object_add_data(entry_o, "npi", (void*)&resp_read->data.mailbox.fax.NumberingPlanIdent , SIPC_MARSHAL_DATA_INT_TYPE);
992 entry_key = g_strdup_printf("%d", count);
993 sipc_util_marshal_object_add_data(out_o, entry_key, entry_o, SIPC_MARSHAL_DATA_OBJECT_TYPE);
994 dbg("tmp - resp_read->data.mailbox.fax.AlphaId[%s]",resp_read->data.mailbox.fax.AlphaId);
995 dbg("tmp - resp_read->data.mailbox.fax.DiallingNum[%s]",resp_read->data.mailbox.fax.DiallingNum);
996 dbg("tmp - resp_read->data.mailbox.fax.TypeOfNumber[%d]",resp_read->data.mailbox.fax.TypeOfNumber);
997 dbg("tmp - resp_read->data.mailbox.fax.NumberingPlanIdent[%d]",resp_read->data.mailbox.fax.NumberingPlanIdent);
1000 if(resp_read->data.mailbox.video.DiallingnumLength){
1002 entry_o = sipc_util_marshal_object_create();
1003 sipc_util_marshal_object_add_data(entry_o, "type", "video", SIPC_MARSHAL_DATA_STRING_TYPE);
1004 sipc_util_marshal_object_add_data(entry_o, "name", (void*)&resp_read->data.mailbox.video.AlphaId, SIPC_MARSHAL_DATA_STRING_TYPE);
1005 sipc_util_marshal_object_add_data(entry_o, "number", (void*)&resp_read->data.mailbox.video.DiallingNum , SIPC_MARSHAL_DATA_STRING_TYPE);
1006 sipc_util_marshal_object_add_data(entry_o, "ton", (void*)&resp_read->data.mailbox.video.TypeOfNumber , SIPC_MARSHAL_DATA_INT_TYPE);
1007 sipc_util_marshal_object_add_data(entry_o, "npi", (void*)&resp_read->data.mailbox.video.NumberingPlanIdent , SIPC_MARSHAL_DATA_INT_TYPE);
1008 entry_key = g_strdup_printf("%d", count);
1009 sipc_util_marshal_object_add_data(out_o, entry_key, entry_o, SIPC_MARSHAL_DATA_OBJECT_TYPE);
1010 dbg("tmp - resp_read->data.mailbox.video.AlphaId[%s]",resp_read->data.mailbox.video.AlphaId);
1011 dbg("tmp - resp_read->data.mailbox.video.DiallingNum[%s]",resp_read->data.mailbox.video.DiallingNum);
1012 dbg("tmp - resp_read->data.mailbox.video.TypeOfNumber[%d]",resp_read->data.mailbox.video.TypeOfNumber);
1013 dbg("tmp - resp_read->data.mailbox.video.NumberingPlanIdent[%d]",resp_read->data.mailbox.video.NumberingPlanIdent);
1015 sipc_util_marshal_object_add_data(out_o, "count", (void*)&count, SIPC_MARSHAL_DATA_INT_TYPE);
1016 dbg("tmp - count[%d]", count);
1020 case TRESP_SIM_GET_CALLFORWARDING: {
1021 gchar *access_rt = NULL;
1022 dbg("resp comm - TRESP_SIM_GET_CALLFORWARDING");
1023 access_rt = _convert_access_result_to_string(resp_read->result);
1024 sipc_util_marshal_object_add_data(out_o, "result", (void*)access_rt, SIPC_MARSHAL_DATA_STRING_TYPE);
1025 sipc_util_marshal_object_add_data(out_o, "line1_status", (void*)&resp_read->data.cf.voice1, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
1026 sipc_util_marshal_object_add_data(out_o, "line2_status", (void*)&resp_read->data.cf.voice2, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
1027 dbg("tmp - resp_read->data.cf.voice1[%d]", resp_read->data.cf.voice1);
1028 dbg("tmp - resp_read->data.cf.voice2[%d]", resp_read->data.cf.voice2);
1032 case TRESP_SIM_GET_MESSAGEWAITING: {
1033 gchar *access_rt = NULL;
1034 dbg("resp comm - TRESP_SIM_GET_MESSAGEWAITING");
1035 access_rt = _convert_access_result_to_string(resp_read->result);
1036 sipc_util_marshal_object_add_data(out_o, "result", (void*)access_rt, SIPC_MARSHAL_DATA_STRING_TYPE);
1037 if (resp_read->data.mw.b_cphs) {
1038 sipc_util_marshal_object_add_data(out_o, "line1_count", (void*)&resp_read->data.mw.mw_data_u.cphs_mw.b_voice1, SIPC_MARSHAL_DATA_INT_TYPE);
1039 sipc_util_marshal_object_add_data(out_o, "line2_count", (void*)&resp_read->data.mw.mw_data_u.cphs_mw.b_voice2, SIPC_MARSHAL_DATA_INT_TYPE);
1040 sipc_util_marshal_object_add_data(out_o, "fax_count", (void*)&resp_read->data.mw.mw_data_u.cphs_mw.b_fax, SIPC_MARSHAL_DATA_INT_TYPE);
1041 sipc_util_marshal_object_add_data(out_o, "video_count", (void*)&resp_read->data.mw.mw_data_u.cphs_mw.b_data, SIPC_MARSHAL_DATA_INT_TYPE);
1042 dbg("tmp - resp_read->data.mw.mw_data_u.cphs_mw.b_voice1[%d]", resp_read->data.mw.mw_data_u.cphs_mw.b_voice1);
1043 dbg("tmp - resp_read->data.mw.mw_data_u.cphs_mw.b_voice2[%d]", resp_read->data.mw.mw_data_u.cphs_mw.b_voice2);
1044 dbg("tmp - resp_read->data.mw.mw_data_u.cphs_mw.b_fax[%d]", resp_read->data.mw.mw_data_u.cphs_mw.b_fax);
1045 dbg("tmp - resp_read->data.mw.mw_data_u.cphs_mw.b_data[%d]", resp_read->data.mw.mw_data_u.cphs_mw.b_data);
1047 sipc_util_marshal_object_add_data(out_o, "line1_count", (void*)&resp_read->data.mw.mw_data_u.mw.voice_count, SIPC_MARSHAL_DATA_INT_TYPE);
1048 /* sipc_util_marshal_object_add_data(out_o, "line2_count", (void*)&resp_read->result, SIPC_MARSHAL_DATA_INT_TYPE);*/
1049 sipc_util_marshal_object_add_data(out_o, "fax_count", (void*)&resp_read->data.mw.mw_data_u.mw.fax_count, SIPC_MARSHAL_DATA_INT_TYPE);
1050 sipc_util_marshal_object_add_data(out_o, "video_count", (void*)&resp_read->data.mw.mw_data_u.mw.video_count, SIPC_MARSHAL_DATA_INT_TYPE);
1051 dbg("tmp - resp_read->data.mw.mw_data_u.mw.voice_count[%d]", resp_read->data.mw.mw_data_u.mw.voice_count);
1052 dbg("tmp - resp_read->data.mw.mw_data_u.mw.fax_count[%d]", resp_read->data.mw.mw_data_u.mw.fax_count);
1053 dbg("tmp - resp_read->data.mw.mw_data_u.mw.video_count[%d]", resp_read->data.mw.mw_data_u.mw.video_count);
1055 dbg("tmp - resp_read->data.mw.b_cphs[%d]", resp_read->data.mw.b_cphs);
1059 case TRESP_SIM_GET_CPHS_INFO: {
1060 gchar *access_rt = NULL;
1061 dbg("resp comm - TRESP_SIM_GET_CPHS_INFO");
1062 access_rt = _convert_access_result_to_string(resp_read->result);
1063 sipc_util_marshal_object_add_data(out_o, "result", (void*)access_rt, SIPC_MARSHAL_DATA_STRING_TYPE);
1067 case TRESP_SIM_GET_MSISDN: {
1068 gchar *access_rt = NULL;
1069 dbg("resp comm - TRESP_SIM_GET_MSISDN");
1070 access_rt = _convert_access_result_to_string(resp_read->result);
1071 sipc_util_marshal_object_add_data(out_o, "result", (void*)access_rt, SIPC_MARSHAL_DATA_STRING_TYPE);
1072 sipc_util_marshal_object_add_data(out_o, "count", (void*)&resp_read->data.msisdn_list.count, SIPC_MARSHAL_DATA_INT_TYPE);
1073 dbg("tmp - resp_read->data.msisdn_list.count[%d]", resp_read->data.msisdn_list.count);
1075 for(i=0;i < resp_read->data.msisdn_list.count; i++){
1076 gchar *entry_key = NULL;
1077 entry_o = sipc_util_marshal_object_create();
1078 sipc_util_marshal_object_add_data(entry_o, "name", (void*)&resp_read->data.msisdn_list.msisdn[i].name, SIPC_MARSHAL_DATA_STRING_TYPE);
1079 sipc_util_marshal_object_add_data(entry_o, "number", (void*)&resp_read->data.msisdn_list.msisdn[i].num, SIPC_MARSHAL_DATA_STRING_TYPE);
1080 entry_key = g_strdup_printf("%d", i);
1081 sipc_util_marshal_object_add_data(out_o, entry_key, entry_o, SIPC_MARSHAL_DATA_OBJECT_TYPE);
1082 dbg("tmp - resp_read->data.msisdn_list.msisdn[%d].name[%s]", i, resp_read->data.msisdn_list.msisdn[i].name);
1083 dbg("tmp - resp_read->data.msisdn_list.msisdn[%d].num[%s]", i, resp_read->data.msisdn_list.msisdn[i].num);
1088 case TRESP_SIM_GET_OPLMNWACT: {
1089 gchar *access_rt = NULL;
1090 dbg("resp comm - TRESP_SIM_GET_OPLMNWACT");
1091 access_rt = _convert_access_result_to_string(resp_read->result);
1092 sipc_util_marshal_object_add_data(out_o, "result", (void*)access_rt, SIPC_MARSHAL_DATA_STRING_TYPE);
1093 sipc_util_marshal_object_add_data(out_o, "count", (void*)&resp_read->data.opwa.opwa_count, SIPC_MARSHAL_DATA_INT_TYPE);
1094 dbg("tmp - resp_read->data.opwa.opwa_count[%d]",resp_read->data.opwa.opwa_count);
1096 for(i=0;i < resp_read->data.opwa.opwa_count; i++){
1097 gchar *entry_key = NULL;
1098 entry_o = sipc_util_marshal_object_create();
1099 sipc_util_marshal_object_add_data(entry_o, "plmn", (void*)&resp_read->data.opwa.opwa[i].plmn, SIPC_MARSHAL_DATA_STRING_TYPE);
1100 sipc_util_marshal_object_add_data(entry_o, "b_umts", (void*)&resp_read->data.opwa.opwa[i].b_umts, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
1101 sipc_util_marshal_object_add_data(entry_o, "b_gsm", (void*)&resp_read->data.opwa.opwa[i].b_gsm, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
1102 entry_key = g_strdup_printf("%d", i);
1103 sipc_util_marshal_object_add_data(out_o, entry_key, entry_o, SIPC_MARSHAL_DATA_OBJECT_TYPE);
1104 dbg("resp_read->data.opwa.opwa[%d].plmn[%s]",i, resp_read->data.opwa.opwa[i].plmn);
1105 dbg("resp_read->data.opwa.opwa[%d].b_umts[%d]",i, resp_read->data.opwa.opwa[i].b_umts);
1106 dbg("resp_read->data.opwa.opwa[%d].b_gsm[%d]",i, resp_read->data.opwa.opwa[i].b_gsm);
1112 dbg("not handled command [%d] here",command);
1117 serial_d = sipc_util_marshal_object_serializer(out_o);
1118 hdr.data_len = strlen(serial_d);
1119 sipc_util_marshal_object_destory(out_o);
1122 out_d = g_new0(char, sizeof(struct _tapi_header)+hdr.data_len);
1123 memcpy(out_d, &hdr, sizeof(struct _tapi_header));
1125 memcpy(out_d+sizeof(struct _tapi_header), serial_d, hdr.data_len);
1129 ret = sipc_server_send(s, ui->channel_id, out_d, sizeof(struct _tapi_header)+hdr.data_len, SIPC_SEND_DATA_ASYNC);
1140 gboolean scomm_service_notification_sim(Communicator *comm, CoreObject *source, enum tcore_notification_command command,
1141 unsigned int data_len, const void *data)
1143 const struct tnoti_sim_status *n_sim_status = data;
1145 gchar *out_d = NULL, *serial_d = NULL;
1147 struct custom_data *ctx = NULL;
1149 struct _tapi_header hdr;
1150 struct _sipc_marshal_object* out_o = NULL;
1152 memset(&hdr, 0, sizeof(struct _tapi_header));
1154 ctx = tcore_communicator_ref_user_data(comm);
1156 dbg("user_data is NULL");
1160 dbg("notification !!! (command = 0x%x, data_len = %d)", command, data_len);
1162 out_o = sipc_util_marshal_object_create();
1165 case TNOTI_SIM_STATUS:
1166 dbg("notified sim_status[%d]", n_sim_status->sim_status);
1167 hdr.cmd = TAPI_NOTI_SIM_STATUS;
1168 sipc_util_marshal_object_add_data(out_o, "status", (void*) &n_sim_status->sim_status,
1169 SIPC_MARSHAL_DATA_INT_TYPE);
1170 sipc_util_marshal_object_add_data(out_o, "new_sim", (void*) &n_sim_status->b_changed,
1171 SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
1175 dbg("unknown notification");
1181 serial_d = sipc_util_marshal_object_serializer(out_o);
1182 hdr.data_len = strlen(serial_d);
1183 sipc_util_marshal_object_destory(out_o);
1186 out_d = g_new0(char, sizeof(struct _tapi_header)+hdr.data_len);
1187 memcpy(out_d, &hdr, sizeof(struct _tapi_header));
1189 memcpy(out_d + sizeof(struct _tapi_header), serial_d, hdr.data_len);
1193 ret = sipc_server_broadcast(ctx->sk_server, out_d, sizeof(struct _tapi_header) + hdr.data_len);