4 * Copyright (c) 2014 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.
28 #include <tapi_common.h>
29 #include <ITapiNetwork.h>
30 #include <TapiUtility.h>
35 static char data_net_set_plmn_mode_manual_act[MENU_DATA_SIZE + 1] = "4";
36 static char data_net_set_plmn_mode_manual_plmn[MENU_DATA_SIZE + 1] = "45001";
37 static char data_net_set_preferred_plmn_mode[MENU_DATA_SIZE + 1] = "1";
38 static char data_net_set_preferred_plmn_plmn[MENU_DATA_SIZE + 1] = "45001";
39 static char data_net_set_preferred_plmn_type[MENU_DATA_SIZE + 1] = "4";
40 static char data_net_set_preferred_plmn_ef_index[MENU_DATA_SIZE + 1] = "0";
42 static char data_net_set_mode_mode[MENU_DATA_SIZE + 1] = "3";
44 static void on_prop_signal_dbm (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
49 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_SIGNALSTRENGTH_DBM);
51 msg (" - sig_dbm = %d", *sig_dbm);
54 static void on_prop_signal_level (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
56 int *sig_level = data;
59 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_SIGNALSTRENGTH_LEVEL);
61 msg (" - sig_level = %d", *sig_level);
64 static void on_prop_lac (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
69 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_LAC);
71 msg (" - lac = %d", *lac);
74 static void on_prop_plmn (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
77 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_PLMN);
79 msg (" - plmn = %s", (char *)data);
82 static void on_prop_cellid (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
87 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_CELLID);
89 msg (" - cell_id = %d", *cell_id);
92 static void on_prop_service_type (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
94 int *service_type = data;
97 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_SERVICE_TYPE);
99 msg (" - service_type = %d", *service_type);
102 static void on_prop_act (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
107 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_ACT);
109 msg (" - access technology = %d", *act);
112 static void on_prop_ps_type (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
117 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_PS_TYPE);
119 msg (" - ps_type = %d", *ps_type);
122 static void on_prop_circuit_status (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
124 int *circuit_status = data;
127 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_CIRCUIT_STATUS);
129 msg (" - circuit_status = %d", *circuit_status);
132 static void on_prop_packet_status (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
134 int *packet_status = data;
137 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_PACKET_STATUS);
139 msg (" - packet_status = %d", *packet_status);
142 static void on_prop_roaming_status (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
144 guchar *roaming_status = data;
147 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_ROAMING_STATUS);
149 msg (" - roaming_status = %d", *roaming_status);
152 static void on_prop_name_option (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
157 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_NAME_OPTION);
159 msg (" - name_option = %d", *option);
162 static void on_prop_network_name (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
165 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_NETWORK_NAME);
167 msg (" - network_name = %s", (char *)data);
170 static void on_prop_spn_name (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
173 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_SPN_NAME);
175 msg (" - spn_name = %s", (char *)data);
178 static void on_noti_registration_status(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
180 TelNetworkRegistrationStatus_t *noti = data;
183 msgb ("event(%s) receive !!", TAPI_NOTI_NETWORK_REGISTRATION_STATUS);
185 msg (" - circuit status = %d", noti->cs);
186 msg (" - packet status = %d", noti->ps);
187 msg (" - service type = %d", noti->type);
188 msg (" - is roaming = %d", noti->is_roaming);
191 static void on_noti_cell_info(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
193 struct tel_noti_network_cell_info *noti = data;
196 msgb ("event(%s) receive !!", TAPI_NOTI_NETWORK_CELLINFO);
198 msg (" - lac = %d", noti->lac);
199 msg (" - cell_id = %d", noti->cell_id);
202 static void on_noti_change(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
204 struct tel_noti_network_change *noti = data;
207 msgb ("event(%s) receive !!", TAPI_NOTI_NETWORK_CHANGE);
209 msg (" - plmn = %s", noti->plmn);
210 msg (" - act = %d", noti->act);
213 static void on_noti_time_info(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
215 struct tel_noti_network_time_info *noti = data;
218 msgb ("event(%s) receive !!", TAPI_NOTI_NETWORK_TIMEINFO);
220 msg (" - plmn = %s", noti->plmn);
221 msg (" - year = %d", noti->year);
222 msg (" - month = %d", noti->month);
223 msg (" - day = %d", noti->day);
224 msg (" - hour = %d", noti->hour);
225 msg (" - minute = %d", noti->minute);
226 msg (" - second = %d", noti->second);
227 msg (" - wday = %d", noti->wday);
228 msg (" - gmtoff = %d", noti->gmtoff);
229 msg (" - dstoff = %d", noti->dstoff);
230 msg (" - isdst = %d", noti->isdst);
233 static void on_noti_identity(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
235 struct tel_noti_network_identity *noti = data;
238 msgb ("event(%s) receive !!", TAPI_NOTI_NETWORK_IDENTITY);
240 msg (" - plmn = %s", noti->plmn);
241 msg (" - short_name = %s", noti->short_name);
242 msg (" - full_name = %s", noti->full_name);
245 static void on_noti_signal_strength(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
247 struct tel_noti_network_signal_strength *noti = data;
250 msgb ("event(%s) receive !!", TAPI_NOTI_NETWORK_SIGNALSTRENGTH);
252 msg (" - dbm = %d", noti->dbm);
255 static void on_noti_default_data_subs(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
257 struct tel_noti_network_default_data_subs *noti = data;
260 msgb ("event(%s) receive !!", TAPI_NOTI_NETWORK_DEFAULT_DATA_SUBSCRIPTION);
263 msg (" - 'default' Data Subscription = %s",
264 ((noti->default_subs == TAPI_NETWORK_DEFAULT_DATA_SUBS_SIM1) ? "SIM 1"
265 : ((noti->default_subs == TAPI_NETWORK_DEFAULT_DATA_SUBS_SIM2) ? "SIM 2"
269 static void on_noti_default_subs(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
271 struct tel_noti_network_default_subs *noti = data;
274 msgb ("event(%s) receive !!", TAPI_NOTI_NETWORK_DEFAULT_SUBSCRIPTION);
277 msg (" - 'default' Subscription = %s",
278 ((noti->default_subs == TAPI_NETWORK_DEFAULT_SUBS_SIM1) ? "SIM 1"
279 : ((noti->default_subs == TAPI_NETWORK_DEFAULT_SUBS_SIM2) ? "SIM 2"
283 static void on_net_search(TapiHandle *handle, int result, void *data, void *user_data)
285 TelNetworkPlmnList_t *list = data;
289 msgb ("tel_search_network() response receive");
290 msg (" - result = 0x%x", result);
297 msg (" - count = %d", list->networks_count);
299 for (i = 0; i < list->networks_count; i++) {
300 msg (" - [%d] plmn=%s, act=%d, type=%d, name=%s",
302 list->network_list[i].plmn,
303 list->network_list[i].access_technology,
304 list->network_list[i].type_of_plmn,
305 list->network_list[i].network_name);
309 static void on_net_set_plmn_mode_automatic(TapiHandle *handle, int result, void *data, void *user_data)
312 msgb ("tel_select_network_automatic() response receive");
313 msg (" - result = 0x%x", result);
316 static void on_net_set_plmn_mode_manual(TapiHandle *handle, int result, void *data, void *user_data)
319 msgb ("tel_select_network_manual() response receive");
320 msg (" - result = 0x%x", result);
323 static void on_net_get_plmn_mode(TapiHandle *handle, int result, void *data, void *user_data)
328 msgb ("tel_get_network_selection_mode() response receive");
329 msg (" - result = 0x%x", result);
332 msg (" - mode = %d", *mode);
335 static void on_net_set_preferred_plmn(TapiHandle *handle, int result, void *data, void *user_data)
338 msgb ("tel_set_preferred_plmn() response receive");
339 msg (" - result = 0x%x", result);
342 static void on_net_get_preferred_plmn(TapiHandle *handle, int result, void *data, void *user_data)
344 TelNetworkPreferredPlmnList_t *info = data;
348 msgb ("tel_get_preferred_plmn() response receive");
349 msg (" - result = 0x%x", result);
356 msg (" - count = %d", info->NumOfPrefPlmns);
358 for (i = 0; i < info->NumOfPrefPlmns; i++) {
359 msg (" - [%d] plmn=%s, type=%d, ef_index=%d, name=%s",
361 info->PrefPlmnRecord[i].Plmn,
362 info->PrefPlmnRecord[i].SystemType,
363 info->PrefPlmnRecord[i].Index,
364 info->PrefPlmnRecord[i].network_name);
368 static void on_net_set_cancel_manual_search(TapiHandle *handle, int result, void *data, void *user_data)
371 msgb ("tel_cancel_network_manual_search() response receive");
372 msg (" - result = 0x%x", result);
375 static void on_net_get_serving_network(TapiHandle *handle, int result, void *data, void *user_data)
377 TelNetworkServing_t *info = data;
380 msgb ("tel_get_network_serving() response receive");
381 msg (" - result = 0x%x", result);
388 msg (" - plmn = %s", info->plmn);
389 msg (" - access technology = %d", info->act);
390 msg (" - lac = %d", info->info.lac);
393 static void on_net_set_mode(TapiHandle *handle, int result, void *data, void *user_data)
396 msgb ("tel_set_network_mode() response receive");
397 msg (" - result = 0x%x", result);
400 static void on_net_get_mode(TapiHandle *handle, int result, void *data, void *user_data)
405 msgb ("tel_get_network_mode() response receive");
406 msg (" - result = 0x%x", result);
409 msg (" - mode = %d", *mode);
412 static void on_net_get_neighboring_cell_info(TapiHandle *handle, int result, void *data, void *user_data)
414 TelNetworkNeighboringCellInfo_t *info = data;
418 msgb ("tel_get_neighboring_cell_info() response receive");
419 msg (" - result = 0x%x", result);
424 msg ("info=%p",info);
426 msg ("act=%d",info->serving.act);
427 msg ("mcc=%d",info->serving.mcc);
428 msg ("mnc=%d\n",info->serving.mnc);
430 if(info->serving.act <= TAPI_NETWORK_SYSTEM_EGPRS) {
431 msg ("geran.cell_id=%d",info->serving.cell.geran.cell_id);
432 msg ("geran.lac=%d",info->serving.cell.geran.lac);
433 msg ("geran.bcch=%d",info->serving.cell.geran.bcch);
434 msg ("geran.bsic=%d",info->serving.cell.geran.bsic);
435 msg ("geran.rxlev=%d\n",info->serving.cell.geran.rxlev);
437 else if(info->serving.act <= TAPI_NETWORK_SYSTEM_GSM_AND_UMTS) {
438 msg ("umts.cell_id=%d",info->serving.cell.umts.cell_id);
439 msg ("umts.lac=%d",info->serving.cell.umts.lac);
440 msg ("umts.arfcn=%d",info->serving.cell.umts.arfcn);
441 msg ("umts.psc=%d",info->serving.cell.umts.psc);
442 msg ("umts.rscp=%d\n",info->serving.cell.umts.rscp);
444 else if(info->serving.act == TAPI_NETWORK_SYSTEM_LTE) {
445 msg ("lte.cell_id=%d",info->serving.cell.lte.cell_id);
446 msg ("lte.lac=%d",info->serving.cell.lte.lac);
447 msg ("lte.earfcn=%d",info->serving.cell.lte.earfcn);
448 msg ("lte.tac=%d",info->serving.cell.lte.tac);
449 msg ("lte.rssi=%d\n",info->serving.cell.lte.rssi);
451 msg ("geran_list_count=%d",info->geran_list_count);
452 for(i=0; i<info->geran_list_count; i++) {
453 msg ("[%d] cell_id=%d, lac=%d, bcch=%d, bsic=%d, rxlev=%d,",i,
454 info->geran_list[i].cell_id, info->geran_list[i].lac, info->geran_list[i].bcch,
455 info->geran_list[i].bsic, info->geran_list[i].rxlev);
458 msg ("umts_list_count=%d",info->umts_list_count);
459 for(j=0; j<info->umts_list_count; j++) {
460 msg ("[%d] cell_id=%d, lac=%d, arfcn=%d, psc=%d, rscp=%d,",j,
461 info->umts_list[j].cell_id, info->umts_list[j].lac, info->umts_list[j].arfcn,
462 info->umts_list[j].psc, info->umts_list[j].rscp);
466 static void on_net_set_default_data_subscription(TapiHandle *handle, int result, void *data, void *user_data)
469 msgb ("tel_set_network_default_data_subscription() response receive");
470 msg (" - result = 0x%x", result);
473 static void on_net_set_default_subscription(TapiHandle *handle, int result, void *data, void *user_data)
475 msg("on_net_set_default_subscription() - result : 0x%x", result);
478 static int run_net_search (MManager *mm, struct menu_data *menu)
480 TapiHandle *handle = menu_manager_ref_user_data(mm);
483 msg ("call tel_search_network()");
485 result = tel_search_network (handle, on_net_search, NULL);
486 if (result != TAPI_API_SUCCESS) {
487 msg ("failed. (result = %d)", result);
493 static int run_net_set_plmn_mode_automatic (MManager *mm, struct menu_data *menu)
495 TapiHandle *handle = menu_manager_ref_user_data(mm);
498 msg ("call tel_select_network_automatic()");
500 result = tel_select_network_automatic (handle, on_net_set_plmn_mode_automatic, NULL);
501 if (result != TAPI_API_SUCCESS) {
502 msg ("failed. (result = %d)", result);
508 static int run_net_set_plmn_mode_manual (MManager *mm, struct menu_data *menu)
510 TapiHandle *handle = menu_manager_ref_user_data(mm);
515 msg ("call tel_select_network_manual()");
517 plmn = data_net_set_plmn_mode_manual_plmn;
518 act = atoi(data_net_set_plmn_mode_manual_act);
520 result = tel_select_network_manual (handle, plmn, act, on_net_set_plmn_mode_manual, NULL);
521 if (result != TAPI_API_SUCCESS) {
522 msg ("failed. (result = %d)", result);
528 static int run_net_get_plmn_mode (MManager *mm, struct menu_data *menu)
530 TapiHandle *handle = menu_manager_ref_user_data(mm);
533 msg ("call tel_get_network_selection_mode()");
535 result = tel_get_network_selection_mode (handle, on_net_get_plmn_mode, NULL);
536 if (result != TAPI_API_SUCCESS) {
537 msg ("failed. (result = %d)", result);
543 static int run_net_set_preferred_plmn (MManager *mm, struct menu_data *menu)
545 TapiHandle *handle = menu_manager_ref_user_data(mm);
548 TelNetworkPreferredPlmnInfo_t info;
550 msg ("call tel_set_network_preferred_plmn()");
552 memset(&info, 0, sizeof(TelNetworkPreferredPlmnInfo_t));
554 operation = atoi(data_net_set_preferred_plmn_mode);
555 info.Index = atoi(data_net_set_preferred_plmn_ef_index);
556 info.SystemType = atoi(data_net_set_preferred_plmn_type);
557 strncpy(info.Plmn, data_net_set_preferred_plmn_plmn, 6);
559 result = tel_set_network_preferred_plmn (handle, operation, &info, on_net_set_preferred_plmn, NULL);
560 if (result != TAPI_API_SUCCESS) {
561 msg ("failed. (result = %d)", result);
567 static int run_net_get_preferred_plmn (MManager *mm, struct menu_data *menu)
569 TapiHandle *handle = menu_manager_ref_user_data(mm);
572 msg ("call tel_get_network_preferred_plmn()");
574 result = tel_get_network_preferred_plmn (handle, on_net_get_preferred_plmn, NULL);
575 if (result != TAPI_API_SUCCESS) {
576 msg ("failed. (result = %d)", result);
582 static int run_net_set_cancel_manual_search (MManager *mm, struct menu_data *menu)
584 TapiHandle *handle = menu_manager_ref_user_data(mm);
587 msg ("call tel_cancel_network_manual_search()");
589 result = tel_cancel_network_manual_search (handle, on_net_set_cancel_manual_search, NULL);
590 if (result != TAPI_API_SUCCESS) {
591 msg ("failed. (result = %d)", result);
597 static int run_net_get_serving_network (MManager *mm, struct menu_data *menu)
599 TapiHandle *handle = menu_manager_ref_user_data(mm);
602 msg ("call tel_get_network_serving()");
604 result = tel_get_network_serving (handle, on_net_get_serving_network, NULL);
605 if (result != TAPI_API_SUCCESS) {
606 msg ("failed. (result = %d)", result);
612 static int run_net_set_mode (MManager *mm, struct menu_data *menu)
614 TapiHandle *handle = menu_manager_ref_user_data(mm);
618 msg ("call tel_set_network_mode()");
620 mode = atoi(data_net_set_mode_mode);
622 result = tel_set_network_mode (handle, mode, on_net_set_mode, NULL);
623 if (result != TAPI_API_SUCCESS) {
624 msg ("failed. (result = %d)", result);
630 static int run_net_get_mode (MManager *mm, struct menu_data *menu)
632 TapiHandle *handle = menu_manager_ref_user_data(mm);
635 msg ("call tel_get_network_mode()");
637 result = tel_get_network_mode (handle, on_net_get_mode, NULL);
638 if (result != TAPI_API_SUCCESS) {
639 msg ("failed. (result = %d)", result);
645 static int run_net_get_neighboring_cell_info (MManager *mm, struct menu_data *menu)
647 TapiHandle *handle = menu_manager_ref_user_data(mm);
650 msg ("call tel_get_network_neighboring_cell_info()");
652 result = tel_get_network_neighboring_cell_info (handle, on_net_get_neighboring_cell_info, NULL);
653 if (result != TAPI_API_SUCCESS) {
654 msg ("failed. (result = %d)", result);
660 static int run_net_set_default_data_subscription (MManager *mm, struct menu_data *menu)
662 TapiHandle *handle = menu_manager_ref_user_data(mm);
665 msg ("call tel_set_network_default_data_subscription()");
667 result = tel_set_network_default_data_subscription (handle, on_net_set_default_data_subscription, NULL);
668 if (result != TAPI_API_SUCCESS) {
669 msg ("failed. (result = %d)", result);
675 static int run_net_get_default_data_subscription (MManager *mm, struct menu_data *menu)
677 TapiHandle *handle = menu_manager_ref_user_data (mm);
678 TelNetworkDefaultDataSubs_t default_subs = TAPI_NETWORK_DEFAULT_DATA_SUBS_UNKNOWN;
681 msg ("call tel_get_network_default_data_subscription()");
683 result = tel_get_network_default_data_subscription (handle, &default_subs);
684 if (result != TAPI_API_SUCCESS) {
685 msg("api call failed with[0x%x]", result);
689 msg("'default' Data Subscription = %s",
690 ((default_subs == TAPI_NETWORK_DEFAULT_DATA_SUBS_SIM1) ? "SIM 1"
691 : ((default_subs == TAPI_NETWORK_DEFAULT_DATA_SUBS_SIM2) ? "SIM 2"
698 static int run_net_set_default_subscription(MManager *mm, struct menu_data *menu)
700 TapiHandle *handle = menu_manager_ref_user_data(mm);
703 msg("call tel_set_network_default_subscription()");
705 result = tel_set_network_default_subscription(handle, on_net_set_default_subscription, NULL);
706 if (result != TAPI_API_SUCCESS) {
707 msg("failed. (result = %d)", result);
713 static int run_net_get_default_subscription(MManager *mm, struct menu_data *menu)
715 TapiHandle *handle = menu_manager_ref_user_data(mm);
717 TelNetworkDefaultSubs_t default_subs = TAPI_NETWORK_DEFAULT_SUBS_UNKNOWN;
719 msg("call tel_get_network_default_subscription()");
721 result = tel_get_network_default_subscription(handle, &default_subs);
722 if (result != TAPI_API_SUCCESS) {
723 msg("failed. (result = %d)", result);
727 msg("'default' Subscription for CS (Voice) = %s",
728 ((default_subs == TAPI_NETWORK_DEFAULT_SUBS_SIM1) ? "SIM 1"
729 : ((default_subs == TAPI_NETWORK_DEFAULT_SUBS_SIM2) ? "SIM 2"
735 static int show_properties (MManager *mm, struct menu_data *menu)
737 TapiHandle *handle = menu_manager_ref_user_data(mm);
753 tel_get_property_int (handle, TAPI_PROP_NETWORK_LAC , &lac);
754 tel_get_property_int (handle, TAPI_PROP_NETWORK_CELLID, &cellid);
755 tel_get_property_int (handle, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
756 tel_get_property_int (handle, TAPI_PROP_NETWORK_ACT, &act);
757 tel_get_property_string (handle, TAPI_PROP_NETWORK_PLMN, &plmn);
758 tel_get_property_int (handle, TAPI_PROP_NETWORK_PS_TYPE, &ps_type);
759 tel_get_property_int (handle, TAPI_PROP_NETWORK_CIRCUIT_STATUS, &cs);
760 tel_get_property_int (handle, TAPI_PROP_NETWORK_PACKET_STATUS, &ps);
761 tel_get_property_int (handle, TAPI_PROP_NETWORK_SIGNALSTRENGTH_DBM, &sig_dbm);
762 tel_get_property_int (handle, TAPI_PROP_NETWORK_SIGNALSTRENGTH_LEVEL, &sig_level);
763 tel_get_property_int (handle, TAPI_PROP_NETWORK_ROAMING_STATUS, &roam);
764 tel_get_property_int (handle, TAPI_PROP_NETWORK_NAME_OPTION, &option);
765 tel_get_property_string (handle, TAPI_PROP_NETWORK_NETWORK_NAME, &n_name);
766 tel_get_property_string (handle, TAPI_PROP_NETWORK_SPN_NAME, &s_name);
769 " [lac]: 0x%08X [cellid]: 0x%08X\n"
770 " [service_type]: %d [act]: %d [plmn]: \"%s\"\n"
771 " [ps_type]: %d [cs_status]: %d [ps_status]: %d\n"
772 " [sig_dbm]: %d [sig_level]: %d [roaming_status]: %d\n"
773 " [option]: %d [network_name]: \"%s\" [spn_name]: \"%s\"",
777 sig_dbm, sig_level, roam,
778 option, n_name, s_name);
787 static struct menu_data menu_net_search[] = {
788 { "1", "run", NULL, run_net_search, NULL},
792 static struct menu_data menu_net_set_plmn_mode_automatic[] = {
793 { "1", "run", NULL, run_net_set_plmn_mode_automatic, NULL},
797 static struct menu_data menu_net_set_plmn_mode_manual[] = {
798 { "1", "act", NULL, NULL, data_net_set_plmn_mode_manual_act},
799 { "2", "plmn (45001)", NULL, NULL, data_net_set_plmn_mode_manual_plmn},
800 { "3", "run", NULL, run_net_set_plmn_mode_manual, NULL},
804 static struct menu_data menu_net_get_plmn_mode[] = {
805 { "1", "run", NULL, run_net_get_plmn_mode, NULL},
809 static struct menu_data menu_net_set_preferred_plmn[] = {
810 { "1", "mode (1=add, 2=edit, 3=delete)", NULL, NULL, data_net_set_preferred_plmn_mode},
811 { "2", "plmn (45001)", NULL, NULL, data_net_set_preferred_plmn_plmn},
812 { "3", "type (1=GSM, 2=GPRS, 3=EGPRS, 4=UMTS, ...)", NULL, NULL, data_net_set_preferred_plmn_type},
813 { "4", "ef_index (0,...)", NULL, NULL, data_net_set_preferred_plmn_ef_index},
814 { "5", "run", NULL, run_net_set_preferred_plmn, NULL},
818 static struct menu_data menu_net_get_preferred_plmn[] = {
819 { "1", "run", NULL, run_net_get_preferred_plmn, NULL},
824 static struct menu_data menu_net_set_cancel_manual_search[] = {
825 { "1", "run", NULL, run_net_set_cancel_manual_search, NULL},
830 static struct menu_data menu_net_get_serving_network[] = {
831 { "1", "run", NULL, run_net_get_serving_network, NULL},
835 static struct menu_data menu_net_set_mode[] = {
836 { "1", "mode (1=GSM, 2=WCDMA, 4=CDMA, 8=LTE)", NULL, NULL, data_net_set_mode_mode},
837 { "3", "run", NULL, run_net_set_mode, NULL},
841 static struct menu_data menu_net_get_mode[] = {
842 { "1", "run", NULL, run_net_get_mode, NULL},
846 static struct menu_data menu_net_get_neighboring_cell_info[] = {
847 { "1", "run", NULL, run_net_get_neighboring_cell_info, NULL},
851 static struct menu_data menu_net_set_default_data_subscription[] = {
852 { "1", "run", NULL, run_net_set_default_data_subscription, NULL},
856 static struct menu_data menu_net_get_default_data_subscription[] = {
857 { "1", "run", NULL, run_net_get_default_data_subscription, NULL},
861 static struct menu_data menu_net_set_default_subscription[] = {
862 { "1", "run", 0, run_net_set_default_subscription, 0},
866 static struct menu_data menu_net_get_default_subscription[] = {
867 { "1", "run", 0, run_net_get_default_subscription, 0},
871 struct menu_data menu_net[] = {
872 { "1", "Search", menu_net_search, NULL, NULL},
873 { "2a", "SET PLMN Selection mode (Automatic)", menu_net_set_plmn_mode_automatic, NULL, NULL},
874 { "2s", "SET PLMN Selection mode (Manual)", menu_net_set_plmn_mode_manual, NULL, NULL},
875 { "2g", "GET PLMN Selection mode", menu_net_get_plmn_mode, NULL, NULL},
876 { "5s", "SET Preferred PLMN", menu_net_set_preferred_plmn, NULL, NULL},
877 { "5g", "GET Preferred PLMN", menu_net_get_preferred_plmn, NULL, NULL},
878 { "6", "SET Cancel manual search", menu_net_set_cancel_manual_search, NULL, NULL},
879 { "7", "GET Serving network", menu_net_get_serving_network, NULL, NULL},
880 { "8s", "SET Mode", menu_net_set_mode, NULL, NULL},
881 { "8g", "GET Mode", menu_net_get_mode, NULL, NULL},
882 { "9g", "GET Neighboring Cell Info", menu_net_get_neighboring_cell_info, NULL, NULL},
883 { "10", "SET Default Data Subscription", menu_net_set_default_data_subscription, NULL, NULL},
884 { "11", "GET Default Data Subscription", menu_net_get_default_data_subscription, NULL, NULL},
885 { "12", "SET Default Subscription (for Voice)", menu_net_set_default_subscription, 0, 0},
886 { "13", "GET Default Subscription (for Voice)", menu_net_get_default_subscription, 0, 0},
887 { "*", "<Properties>", NULL, show_properties, NULL },
891 void register_network_event (TapiHandle *handle)
896 ret = tel_register_noti_event (handle,
897 TAPI_NOTI_NETWORK_REGISTRATION_STATUS,
898 on_noti_registration_status, NULL);
899 if (ret != TAPI_API_SUCCESS) {
900 msg("event register failed(%d)", ret);
903 ret = tel_register_noti_event (handle,
904 TAPI_NOTI_NETWORK_CELLINFO, on_noti_cell_info, NULL);
905 if (ret != TAPI_API_SUCCESS) {
906 msg("event register failed(%d)", ret);
909 ret = tel_register_noti_event (handle,
910 TAPI_NOTI_NETWORK_CHANGE, on_noti_change, NULL);
911 if (ret != TAPI_API_SUCCESS) {
912 msg("event register failed(%d)", ret);
915 ret = tel_register_noti_event (handle,
916 TAPI_NOTI_NETWORK_TIMEINFO, on_noti_time_info, NULL);
917 if (ret != TAPI_API_SUCCESS) {
918 msg("event register failed(%d)", ret);
921 ret = tel_register_noti_event (handle,
922 TAPI_NOTI_NETWORK_IDENTITY, on_noti_identity, NULL);
923 if (ret != TAPI_API_SUCCESS) {
924 msg("event register failed(%d)", ret);
927 ret = tel_register_noti_event (handle,
928 TAPI_NOTI_NETWORK_SIGNALSTRENGTH, on_noti_signal_strength, NULL);
929 if (ret != TAPI_API_SUCCESS) {
930 msg("event register failed(%d)", ret);
933 ret = tel_register_noti_event (handle,
934 TAPI_NOTI_NETWORK_DEFAULT_DATA_SUBSCRIPTION, on_noti_default_data_subs, NULL);
935 if (ret != TAPI_API_SUCCESS) {
936 msg("event register failed(%d)", ret);
939 ret = tel_register_noti_event (handle,
940 TAPI_NOTI_NETWORK_DEFAULT_SUBSCRIPTION, on_noti_default_subs, NULL);
941 if (ret != TAPI_API_SUCCESS) {
942 msg("event register failed(%d)", ret);
946 ret = tel_register_noti_event (handle,
947 TAPI_PROP_NETWORK_SIGNALSTRENGTH_DBM, on_prop_signal_dbm, NULL);
948 if (ret != TAPI_API_SUCCESS) {
949 msg("event register failed(%d)", ret);
952 ret = tel_register_noti_event (handle,
953 TAPI_PROP_NETWORK_SIGNALSTRENGTH_LEVEL, on_prop_signal_level, NULL);
954 if (ret != TAPI_API_SUCCESS) {
955 msg("event register failed(%d)", ret);
958 ret = tel_register_noti_event (handle,
959 TAPI_PROP_NETWORK_LAC, on_prop_lac, NULL);
960 if (ret != TAPI_API_SUCCESS) {
961 msg("event register failed(%d)", ret);
964 ret = tel_register_noti_event (handle,
965 TAPI_PROP_NETWORK_PLMN, on_prop_plmn, NULL);
966 if (ret != TAPI_API_SUCCESS) {
967 msg("event register failed(%d)", ret);
970 ret = tel_register_noti_event (handle,
971 TAPI_PROP_NETWORK_CELLID, on_prop_cellid, NULL);
972 if (ret != TAPI_API_SUCCESS) {
973 msg("event register failed(%d)", ret);
976 ret = tel_register_noti_event (handle,
977 TAPI_PROP_NETWORK_SERVICE_TYPE, on_prop_service_type, NULL);
978 if (ret != TAPI_API_SUCCESS) {
979 msg("event register failed(%d)", ret);
982 ret = tel_register_noti_event (handle,
983 TAPI_PROP_NETWORK_ACT, on_prop_act, NULL);
984 if (ret != TAPI_API_SUCCESS) {
985 msg("event register failed(%d)", ret);
988 ret = tel_register_noti_event (handle,
989 TAPI_PROP_NETWORK_PS_TYPE, on_prop_ps_type, NULL);
990 if (ret != TAPI_API_SUCCESS) {
991 msg("event register failed(%d)", ret);
994 ret = tel_register_noti_event (handle,
995 TAPI_PROP_NETWORK_CIRCUIT_STATUS, on_prop_circuit_status, NULL);
996 if (ret != TAPI_API_SUCCESS) {
997 msg("event register failed(%d)", ret);
1000 ret = tel_register_noti_event (handle,
1001 TAPI_PROP_NETWORK_PACKET_STATUS, on_prop_packet_status, NULL);
1002 if (ret != TAPI_API_SUCCESS) {
1003 msg("event register failed(%d)", ret);
1006 ret = tel_register_noti_event (handle,
1007 TAPI_PROP_NETWORK_ROAMING_STATUS, on_prop_roaming_status, NULL);
1008 if (ret != TAPI_API_SUCCESS) {
1009 msg("event register failed(%d)", ret);
1012 ret = tel_register_noti_event (handle,
1013 TAPI_PROP_NETWORK_NAME_OPTION, on_prop_name_option, NULL);
1014 if (ret != TAPI_API_SUCCESS) {
1015 msg("event register failed(%d)", ret);
1018 ret = tel_register_noti_event (handle,
1019 TAPI_PROP_NETWORK_NETWORK_NAME, on_prop_network_name, NULL);
1020 if (ret != TAPI_API_SUCCESS) {
1021 msg("event register failed(%d)", ret);
1024 ret = tel_register_noti_event (handle,
1025 TAPI_PROP_NETWORK_SPN_NAME, on_prop_spn_name, NULL);
1026 if (ret != TAPI_API_SUCCESS) {
1027 msg("event register failed(%d)", ret);