2 * Telephony test application
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.
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";
38 static char data_net_set_service_domain_domain[MENU_DATA_SIZE + 1] = "1";
40 static char data_net_set_band_mode[MENU_DATA_SIZE + 1] = "1";
41 static char data_net_set_band_band[MENU_DATA_SIZE + 1] = "5";
43 static char data_net_set_preferred_plmn_mode[MENU_DATA_SIZE + 1] = "1";
44 static char data_net_set_preferred_plmn_plmn[MENU_DATA_SIZE + 1] = "45001";
45 static char data_net_set_preferred_plmn_type[MENU_DATA_SIZE + 1] = "4";
46 static char data_net_set_preferred_plmn_ef_index[MENU_DATA_SIZE + 1] = "0";
48 static char data_net_set_mode_mode[MENU_DATA_SIZE + 1] = "3";
50 static void on_prop_signal_dbm (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
55 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_SIGNALSTRENGTH_DBM);
57 msg (" - sig_dbm = %d", *sig_dbm);
60 static void on_prop_signal_level (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
62 int *sig_level = data;
65 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_SIGNALSTRENGTH_LEVEL);
67 msg (" - sig_level = %d", *sig_level);
70 static void on_prop_lac (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
75 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_LAC);
77 msg (" - lac = %d", *lac);
80 static void on_prop_plmn (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
83 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_PLMN);
85 msg (" - plmn = %s", (char *)data);
88 static void on_prop_cellid (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
93 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_CELLID);
95 msg (" - cell_id = %d", *cell_id);
98 static void on_prop_service_type (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
100 int *service_type = data;
103 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_SERVICE_TYPE);
105 msg (" - service_type = %d", *service_type);
108 static void on_prop_act (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
113 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_ACT);
115 msg (" - access technology = %d", *act);
118 static void on_prop_ps_type (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
123 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_PS_TYPE);
125 msg (" - ps_type = %d", *ps_type);
128 static void on_prop_circuit_status (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
130 int *circuit_status = data;
133 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_CIRCUIT_STATUS);
135 msg (" - circuit_status = %d", *circuit_status);
138 static void on_prop_packet_status (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
140 int *packet_status = data;
143 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_PACKET_STATUS);
145 msg (" - packet_status = %d", *packet_status);
148 static void on_prop_roaming_status (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
150 guchar *roaming_status = data;
153 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_ROAMING_STATUS);
155 msg (" - roaming_status = %d", *roaming_status);
158 static void on_prop_name_option (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
163 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_NAME_OPTION);
165 msg (" - name_option = %s", option);
168 static void on_prop_network_name (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
171 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_NETWORK_NAME);
173 msg (" - network_name = %s", (char *)data);
176 static void on_prop_spn_name (TapiHandle *handle, const char *noti_id, void *data, void *user_data)
179 msgp ("property(%s) receive !!", TAPI_PROP_NETWORK_SPN_NAME);
181 msg (" - spn_name = %s", (char *)data);
184 static void on_noti_registration_status(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
186 struct tel_noti_network_registration_status *noti = data;
189 msgb ("event(%s) receive !!", TAPI_NOTI_NETWORK_REGISTRATION_STATUS);
191 msg (" - circuit status = %d", noti->cs);
192 msg (" - packet status = %d", noti->ps);
193 msg (" - service type = %d", noti->type);
194 msg (" - is roaming = %d", noti->is_roaming);
197 static void on_noti_cell_info(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
199 struct tel_noti_network_cell_info *noti = data;
202 msgb ("event(%s) receive !!", TAPI_NOTI_NETWORK_CELLINFO);
204 msg (" - lac = %d", noti->lac);
205 msg (" - cell_id = %d", noti->cell_id);
208 static void on_noti_change(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
210 struct tel_noti_network_change *noti = data;
213 msgb ("event(%s) receive !!", TAPI_NOTI_NETWORK_CHANGE);
215 msg (" - plmn = %s", noti->plmn);
216 msg (" - act = %d", noti->act);
217 msg (" - lac = %d", noti->lac);
220 static void on_noti_time_info(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
222 struct tel_noti_network_time_info *noti = data;
225 msgb ("event(%s) receive !!", TAPI_NOTI_NETWORK_TIMEINFO);
227 msg (" - plmn = %s", noti->plmn);
228 msg (" - year = %d", noti->year);
229 msg (" - month = %d", noti->month);
230 msg (" - day = %d", noti->day);
231 msg (" - hour = %d", noti->hour);
232 msg (" - minute = %d", noti->minute);
233 msg (" - second = %d", noti->second);
234 msg (" - wday = %d", noti->wday);
235 msg (" - gmtoff = %d", noti->gmtoff);
236 msg (" - dstoff = %d", noti->dstoff);
237 msg (" - isdst = %d", noti->isdst);
240 static void on_noti_identity(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
242 struct tel_noti_network_identity *noti = data;
245 msgb ("event(%s) receive !!", TAPI_NOTI_NETWORK_IDENTITY);
247 msg (" - plmn = %s", noti->plmn);
248 msg (" - short_name = %s", noti->short_name);
249 msg (" - full_name = %s", noti->full_name);
252 static void on_noti_signal_strength(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
254 struct tel_noti_network_signal_strength *noti = data;
257 msgb ("event(%s) receive !!", TAPI_NOTI_NETWORK_SIGNALSTRENGTH);
259 msg (" - dbm = %d", noti->dbm);
262 static void on_net_search(TapiHandle *handle, int result, void *data, void *user_data)
264 TelNetworkPlmnList_t *list = data;
268 msgb ("tel_search_network() response receive");
269 msg (" - result = 0x%x", result);
276 msg (" - count = %d", list->networks_count);
278 for (i = 0; i < list->networks_count; i++) {
279 msg (" - [%d] plmn=%s, act=%d, type=%d, name=%s",
281 list->network_list[i].plmn,
282 list->network_list[i].access_technology,
283 list->network_list[i].type_of_plmn,
284 list->network_list[i].network_name);
288 static void on_net_set_plmn_mode_automatic(TapiHandle *handle, int result, void *data, void *user_data)
291 msgb ("tel_select_network_automatic() response receive");
292 msg (" - result = 0x%x", result);
295 static void on_net_set_plmn_mode_manual(TapiHandle *handle, int result, void *data, void *user_data)
298 msgb ("tel_select_network_manual() response receive");
299 msg (" - result = 0x%x", result);
302 static void on_net_get_plmn_mode(TapiHandle *handle, int result, void *data, void *user_data)
307 msgb ("tel_get_network_selection_mode() response receive");
308 msg (" - result = 0x%x", result);
311 msg (" - mode = %d", *mode);
314 static void on_net_set_service_domain(TapiHandle *handle, int result, void *data, void *user_data)
317 msgb ("tel_set_network_service_domain() response receive");
318 msg (" - result = 0x%x", result);
321 static void on_net_get_service_domain(TapiHandle *handle, int result, void *data, void *user_data)
326 msgb ("tel_get_network_service_domain() response receive");
327 msg (" - result = 0x%x", result);
330 msg (" - domain = %d", *domain);
333 static void on_net_set_band(TapiHandle *handle, int result, void *data, void *user_data)
336 msgb ("tel_set_network_band() response receive");
337 msg (" - result = 0x%x", result);
340 static void on_net_get_band(TapiHandle *handle, int result, void *data, void *user_data)
345 msgb ("tel_get_network_band() response receive");
346 msg (" - result = 0x%x", result);
349 msg (" - band = %d", *band);
352 static void on_net_set_preferred_plmn(TapiHandle *handle, int result, void *data, void *user_data)
355 msgb ("tel_set_preferred_plmn() response receive");
356 msg (" - result = 0x%x", result);
359 static void on_net_get_preferred_plmn(TapiHandle *handle, int result, void *data, void *user_data)
361 TelNetworkPreferredPlmnList_t *info = data;
365 msgb ("tel_get_preferred_plmn() response receive");
366 msg (" - result = 0x%x", result);
373 msg (" - count = %d", info->NumOfPrefPlmns);
375 for (i = 0; i < info->NumOfPrefPlmns; i++) {
376 msg (" - [%d] plmn=%s, type=%d, ef_index=%d, name=%s",
378 info->PrefPlmnRecord[i].Plmn,
379 info->PrefPlmnRecord[i].SystemType,
380 info->PrefPlmnRecord[i].Index,
381 info->PrefPlmnRecord[i].network_name);
385 static void on_net_set_cancel_manual_search(TapiHandle *handle, int result, void *data, void *user_data)
388 msgb ("tel_cancel_network_manual_search() response receive");
389 msg (" - result = 0x%x", result);
392 static void on_net_get_serving_network(TapiHandle *handle, int result, void *data, void *user_data)
394 TelNetworkServing_t *info = data;
397 msgb ("tel_get_network_serving() response receive");
398 msg (" - result = 0x%x", result);
405 msg (" - plmn = %s", info->plmn);
406 msg (" - access technology = %d", info->act);
407 msg (" - lac = %d", info->lac);
410 static void on_net_set_mode(TapiHandle *handle, int result, void *data, void *user_data)
413 msgb ("tel_set_network_mode() response receive");
414 msg (" - result = 0x%x", result);
417 static void on_net_get_mode(TapiHandle *handle, int result, void *data, void *user_data)
422 msgb ("tel_get_network_mode() response receive");
423 msg (" - result = 0x%x", result);
426 msg (" - mode = %d", *mode);
429 static void on_net_get_neighboring_cell_info(TapiHandle *handle, int result, void *data, void *user_data)
431 TelNetworkNeighboringCellInfo_t *info = data;
435 msgb ("tel_get_neighboring_cell_info() response receive");
436 msg (" - result = 0x%x", result);
441 msg ("info=%p",info);
443 msg ("act=%d",info->serving.act);
444 msg ("mcc=%d",info->serving.mcc);
445 msg ("mnc=%d\n",info->serving.mnc);
447 if(info->serving.act <= TAPI_NETWORK_SYSTEM_EGPRS) {
448 msg ("geran.cell_id=%d",info->serving.cell.geran.cell_id);
449 msg ("geran.lac=%d",info->serving.cell.geran.lac);
450 msg ("geran.bcch=%d",info->serving.cell.geran.bcch);
451 msg ("geran.bsic=%d",info->serving.cell.geran.bsic);
452 msg ("geran.rxlev=%d\n",info->serving.cell.geran.rxlev);
454 else if(info->serving.act <= TAPI_NETWORK_SYSTEM_GSM_AND_UMTS) {
455 msg ("umts.cell_id=%d",info->serving.cell.umts.cell_id);
456 msg ("umts.lac=%d",info->serving.cell.umts.lac);
457 msg ("umts.arfcn=%d",info->serving.cell.umts.arfcn);
458 msg ("umts.psc=%d",info->serving.cell.umts.psc);
459 msg ("umts.rscp=%d\n",info->serving.cell.umts.rscp);
461 else if(info->serving.act == TAPI_NETWORK_SYSTEM_LTE) {
462 msg ("lte.cell_id=%d",info->serving.cell.lte.cell_id);
463 msg ("lte.lac=%d",info->serving.cell.lte.lac);
464 msg ("lte.earfcn=%d",info->serving.cell.lte.earfcn);
465 msg ("lte.tac=%d",info->serving.cell.lte.tac);
466 msg ("lte.rssi=%d\n",info->serving.cell.lte.rssi);
468 msg ("geran_list_count=%d",info->geran_list_count);
469 for(i=0; i<info->geran_list_count; i++) {
470 msg ("[%d] cell_id=%d, lac=%d, bcch=%d, bsic=%d, rxlev=%d,",i,
471 info->geran_list[i].cell_id, info->geran_list[i].lac, info->geran_list[i].bcch,
472 info->geran_list[i].bsic, info->geran_list[i].rxlev);
475 msg ("umts_list_count=%d",info->umts_list_count);
476 for(j=0; j<info->umts_list_count; j++) {
477 msg ("[%d] cell_id=%d, lac=%d, arfcn=%d, psc=%d, rscp=%d,",j,
478 info->umts_list[j].cell_id, info->umts_list[j].lac, info->umts_list[j].arfcn,
479 info->umts_list[j].psc, info->umts_list[j].rscp);
483 static int run_net_search (MManager *mm, struct menu_data *menu)
485 TapiHandle *handle = menu_manager_ref_user_data(mm);
488 msg ("call tel_search_network()");
490 result = tel_search_network (handle, on_net_search, NULL);
491 if (result != TAPI_API_SUCCESS) {
492 msg ("failed. (result = %d)", result);
498 static int run_net_set_plmn_mode_automatic (MManager *mm, struct menu_data *menu)
500 TapiHandle *handle = menu_manager_ref_user_data(mm);
503 msg ("call tel_select_network_automatic()");
505 result = tel_select_network_automatic (handle, on_net_set_plmn_mode_automatic, NULL);
506 if (result != TAPI_API_SUCCESS) {
507 msg ("failed. (result = %d)", result);
513 static int run_net_set_plmn_mode_manual (MManager *mm, struct menu_data *menu)
515 TapiHandle *handle = menu_manager_ref_user_data(mm);
520 msg ("call tel_select_network_manual()");
522 plmn = data_net_set_plmn_mode_manual_plmn;
523 act = atoi(data_net_set_plmn_mode_manual_act);
525 result = tel_select_network_manual (handle, plmn, act, on_net_set_plmn_mode_manual, NULL);
526 if (result != TAPI_API_SUCCESS) {
527 msg ("failed. (result = %d)", result);
533 static int run_net_get_plmn_mode (MManager *mm, struct menu_data *menu)
535 TapiHandle *handle = menu_manager_ref_user_data(mm);
538 msg ("call tel_get_network_selection_mode()");
540 result = tel_get_network_selection_mode (handle, on_net_get_plmn_mode, NULL);
541 if (result != TAPI_API_SUCCESS) {
542 msg ("failed. (result = %d)", result);
548 static int run_net_set_service_domain (MManager *mm, struct menu_data *menu)
550 TapiHandle *handle = menu_manager_ref_user_data(mm);
554 msg ("call tel_set_network_service_domain()");
556 domain = atoi(data_net_set_service_domain_domain);
558 result = tel_set_network_service_domain (handle, domain, on_net_set_service_domain, NULL);
559 if (result != TAPI_API_SUCCESS) {
560 msg ("failed. (result = %d)", result);
566 static int run_net_get_service_domain (MManager *mm, struct menu_data *menu)
568 TapiHandle *handle = menu_manager_ref_user_data(mm);
571 msg ("call tel_get_network_service_domain()");
573 result = tel_get_network_service_domain (handle, on_net_get_service_domain, NULL);
574 if (result != TAPI_API_SUCCESS) {
575 msg ("failed. (result = %d)", result);
581 static int run_net_set_band (MManager *mm, struct menu_data *menu)
583 TapiHandle *handle = menu_manager_ref_user_data(mm);
588 msg ("call tel_set_network_band()");
590 mode = atoi(data_net_set_band_mode);
591 band = atoi(data_net_set_band_band);
593 result = tel_set_network_band (handle, mode, band, on_net_set_band, NULL);
594 if (result != TAPI_API_SUCCESS) {
595 msg ("failed. (result = %d)", result);
601 static int run_net_get_band (MManager *mm, struct menu_data *menu)
603 TapiHandle *handle = menu_manager_ref_user_data(mm);
606 msg ("call tel_get_network_band()");
608 result = tel_get_network_band (handle, on_net_get_band, NULL);
609 if (result != TAPI_API_SUCCESS) {
610 msg ("failed. (result = %d)", result);
616 static int run_net_set_preferred_plmn (MManager *mm, struct menu_data *menu)
618 TapiHandle *handle = menu_manager_ref_user_data(mm);
621 TelNetworkPreferredPlmnInfo_t info;
623 msg ("call tel_set_network_preferred_plmn()");
625 memset(&info, 0, sizeof(TelNetworkPreferredPlmnInfo_t));
627 operation = atoi(data_net_set_preferred_plmn_mode);
628 info.Index = atoi(data_net_set_preferred_plmn_ef_index);
629 info.SystemType = atoi(data_net_set_preferred_plmn_type);
630 strncpy(info.Plmn, data_net_set_preferred_plmn_plmn, 6);
632 result = tel_set_network_preferred_plmn (handle, operation, &info, on_net_set_preferred_plmn, NULL);
633 if (result != TAPI_API_SUCCESS) {
634 msg ("failed. (result = %d)", result);
640 static int run_net_get_preferred_plmn (MManager *mm, struct menu_data *menu)
642 TapiHandle *handle = menu_manager_ref_user_data(mm);
645 msg ("call tel_get_network_preferred_plmn()");
647 result = tel_get_network_preferred_plmn (handle, on_net_get_preferred_plmn, NULL);
648 if (result != TAPI_API_SUCCESS) {
649 msg ("failed. (result = %d)", result);
655 static int run_net_set_cancel_manual_search (MManager *mm, struct menu_data *menu)
657 TapiHandle *handle = menu_manager_ref_user_data(mm);
660 msg ("call tel_cancel_network_manual_search()");
662 result = tel_cancel_network_manual_search (handle, on_net_set_cancel_manual_search, NULL);
663 if (result != TAPI_API_SUCCESS) {
664 msg ("failed. (result = %d)", result);
670 static int run_net_get_serving_network (MManager *mm, struct menu_data *menu)
672 TapiHandle *handle = menu_manager_ref_user_data(mm);
675 msg ("call tel_get_network_serving()");
677 result = tel_get_network_serving (handle, on_net_get_serving_network, NULL);
678 if (result != TAPI_API_SUCCESS) {
679 msg ("failed. (result = %d)", result);
685 static int run_net_set_mode (MManager *mm, struct menu_data *menu)
687 TapiHandle *handle = menu_manager_ref_user_data(mm);
691 msg ("call tel_set_network_mode()");
693 mode = atoi(data_net_set_mode_mode);
695 result = tel_set_network_mode (handle, mode, on_net_set_mode, NULL);
696 if (result != TAPI_API_SUCCESS) {
697 msg ("failed. (result = %d)", result);
703 static int run_net_get_mode (MManager *mm, struct menu_data *menu)
705 TapiHandle *handle = menu_manager_ref_user_data(mm);
708 msg ("call tel_get_network_mode()");
710 result = tel_get_network_mode (handle, on_net_get_mode, NULL);
711 if (result != TAPI_API_SUCCESS) {
712 msg ("failed. (result = %d)", result);
718 static int run_net_get_neighboring_cell_info (MManager *mm, struct menu_data *menu)
720 TapiHandle *handle = menu_manager_ref_user_data(mm);
723 msg ("call tel_get_network_neighboring_cell_info()");
725 result = tel_get_network_neighboring_cell_info (handle, on_net_get_neighboring_cell_info, NULL);
726 if (result != TAPI_API_SUCCESS) {
727 msg ("failed. (result = %d)", result);
733 static int show_properties (MManager *mm, struct menu_data *menu)
735 TapiHandle *handle = menu_manager_ref_user_data(mm);
751 tel_get_property_int (handle, TAPI_PROP_NETWORK_LAC , &lac);
752 tel_get_property_int (handle, TAPI_PROP_NETWORK_CELLID, &cellid);
753 tel_get_property_int (handle, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
754 tel_get_property_int (handle, TAPI_PROP_NETWORK_ACT, &act);
755 tel_get_property_string (handle, TAPI_PROP_NETWORK_PLMN, &plmn);
756 tel_get_property_int (handle, TAPI_PROP_NETWORK_PS_TYPE, &ps_type);
757 tel_get_property_int (handle, TAPI_PROP_NETWORK_CIRCUIT_STATUS, &cs);
758 tel_get_property_int (handle, TAPI_PROP_NETWORK_PACKET_STATUS, &ps);
759 tel_get_property_int (handle, TAPI_PROP_NETWORK_SIGNALSTRENGTH_DBM, &sig_dbm);
760 tel_get_property_int (handle, TAPI_PROP_NETWORK_SIGNALSTRENGTH_LEVEL, &sig_level);
761 tel_get_property_int (handle, TAPI_PROP_NETWORK_ROAMING_STATUS, &roam);
762 tel_get_property_string (handle, TAPI_PROP_NETWORK_NAME_OPTION, &option);
763 tel_get_property_string (handle, TAPI_PROP_NETWORK_NETWORK_NAME, &n_name);
764 tel_get_property_string (handle, TAPI_PROP_NETWORK_SPN_NAME, &s_name);
767 " [lac]: 0x%08X [cellid]: 0x%08X\n"
768 " [service_type]: %d [act]: %d [plmn]: \"%s\"\n"
769 " [ps_type]: %d [cs_status]: %d [ps_status]: %d\n"
770 " [sig_dbm]: %d [sig_level]: %d [roaming_status]: %d\n"
771 " [option]: \"%s\" [network_name]: \"%s\" [spn_name]: \"%s\"",
775 sig_dbm, sig_level, roam,
776 option, n_name, s_name);
786 static struct menu_data menu_net_search[] = {
787 { "1", "run", NULL, run_net_search, NULL},
791 static struct menu_data menu_net_set_plmn_mode_automatic[] = {
792 { "1", "run", NULL, run_net_set_plmn_mode_automatic, NULL},
796 static struct menu_data menu_net_set_plmn_mode_manual[] = {
797 { "1", "act", NULL, NULL, data_net_set_plmn_mode_manual_act},
798 { "2", "plmn (45001)", NULL, NULL, data_net_set_plmn_mode_manual_plmn},
799 { "3", "run", NULL, run_net_set_plmn_mode_manual, NULL},
803 static struct menu_data menu_net_get_plmn_mode[] = {
804 { "1", "run", NULL, run_net_get_plmn_mode, NULL},
809 static struct menu_data menu_net_set_service_domain[] = {
810 { "1", "domain (1=combined, 2=cs, 3=ps)", NULL, NULL, data_net_set_service_domain_domain},
811 { "2", "run", NULL, run_net_set_service_domain, NULL},
815 static struct menu_data menu_net_get_service_domain[] = {
816 { "1", "run", NULL, run_net_get_service_domain, NULL},
821 static struct menu_data menu_net_set_band[] = {
822 { "1", "mode (1=preferred, 2=only)", NULL, NULL, data_net_set_band_mode},
823 { "2", "band (1=GSM850, 2=GSM900_1800, 3=GSM1900, 4=GSM, 5=WCDMA, 6=WCDMA850, ...)", NULL, NULL, data_net_set_band_band},
824 { "3", "run", NULL, run_net_set_band, NULL},
828 static struct menu_data menu_net_get_band[] = {
829 { "1", "run", NULL, run_net_get_band, NULL},
834 static struct menu_data menu_net_set_preferred_plmn[] = {
835 { "1", "mode (1=add, 2=edit, 3=delete)", NULL, NULL, data_net_set_preferred_plmn_mode},
836 { "2", "plmn (45001)", NULL, NULL, data_net_set_preferred_plmn_plmn},
837 { "3", "type (1=GSM, 2=GPRS, 3=EGPRS, 4=UMTS, ...)", NULL, NULL, data_net_set_preferred_plmn_type},
838 { "4", "ef_index (0,...)", NULL, NULL, data_net_set_preferred_plmn_ef_index},
839 { "5", "run", NULL, run_net_set_preferred_plmn, NULL},
843 static struct menu_data menu_net_get_preferred_plmn[] = {
844 { "1", "run", NULL, run_net_get_preferred_plmn, NULL},
849 static struct menu_data menu_net_set_cancel_manual_search[] = {
850 { "1", "run", NULL, run_net_set_cancel_manual_search, NULL},
855 static struct menu_data menu_net_get_serving_network[] = {
856 { "1", "run", NULL, run_net_get_serving_network, NULL},
860 static struct menu_data menu_net_set_mode[] = {
861 { "1", "mode (1=GSM, 2=WCDMA, 4=CDMA, 8=LTE)", NULL, NULL, data_net_set_mode_mode},
862 { "3", "run", NULL, run_net_set_mode, NULL},
866 static struct menu_data menu_net_get_mode[] = {
867 { "1", "run", NULL, run_net_get_mode, NULL},
871 static struct menu_data menu_net_get_neighboring_cell_info[] = {
872 { "1", "run", NULL, run_net_get_neighboring_cell_info, NULL},
876 struct menu_data menu_net[] = {
877 { "1", "Search", menu_net_search, NULL, NULL},
878 { "2a", "SET PLMN Selection mode (Automatic)", menu_net_set_plmn_mode_automatic, NULL, NULL},
879 { "2s", "SET PLMN Selection mode (Manual)", menu_net_set_plmn_mode_manual, NULL, NULL},
880 { "2g", "GET PLMN Selection mode", menu_net_get_plmn_mode, NULL, NULL},
881 { "3s", "SET Service Domain", menu_net_set_service_domain, NULL, NULL},
882 { "3g", "GET Service Domain", menu_net_get_service_domain, NULL, NULL},
883 { "4s", "SET Band", menu_net_set_band, NULL, NULL},
884 { "4g", "GET Band", menu_net_get_band, NULL, NULL},
885 { "5s", "SET Preferred PLMN", menu_net_set_preferred_plmn, NULL, NULL},
886 { "5g", "GET Preferred PLMN", menu_net_get_preferred_plmn, NULL, NULL},
887 { "6", "SET Cancel manual search", menu_net_set_cancel_manual_search, NULL, NULL},
888 { "7", "GET Serving network", menu_net_get_serving_network, NULL, NULL},
889 { "8s", "SET Mode", menu_net_set_mode, NULL, NULL},
890 { "8g", "GET Mode", menu_net_get_mode, NULL, NULL},
891 { "9g", "GET Neighboring Cell Info", menu_net_get_neighboring_cell_info, NULL, NULL},
892 { "*", "<Properties>", NULL, show_properties, NULL },
896 void register_network_event (TapiHandle *handle)
901 ret = tel_register_noti_event (handle,
902 TAPI_NOTI_NETWORK_REGISTRATION_STATUS,
903 on_noti_registration_status, NULL);
904 if (ret != TAPI_API_SUCCESS) {
905 msg("event register failed(%d)", ret);
908 ret = tel_register_noti_event (handle,
909 TAPI_NOTI_NETWORK_CELLINFO, on_noti_cell_info, NULL);
910 if (ret != TAPI_API_SUCCESS) {
911 msg("event register failed(%d)", ret);
914 ret = tel_register_noti_event (handle,
915 TAPI_NOTI_NETWORK_CHANGE, on_noti_change, NULL);
916 if (ret != TAPI_API_SUCCESS) {
917 msg("event register failed(%d)", ret);
920 ret = tel_register_noti_event (handle,
921 TAPI_NOTI_NETWORK_TIMEINFO, on_noti_time_info, NULL);
922 if (ret != TAPI_API_SUCCESS) {
923 msg("event register failed(%d)", ret);
926 ret = tel_register_noti_event (handle,
927 TAPI_NOTI_NETWORK_IDENTITY, on_noti_identity, NULL);
928 if (ret != TAPI_API_SUCCESS) {
929 msg("event register failed(%d)", ret);
932 ret = tel_register_noti_event (handle,
933 TAPI_NOTI_NETWORK_SIGNALSTRENGTH, on_noti_signal_strength, NULL);
934 if (ret != TAPI_API_SUCCESS) {
935 msg("event register failed(%d)", ret);
939 ret = tel_register_noti_event (handle,
940 TAPI_PROP_NETWORK_SIGNALSTRENGTH_DBM, on_prop_signal_dbm, NULL);
941 if (ret != TAPI_API_SUCCESS) {
942 msg("event register failed(%d)", ret);
945 ret = tel_register_noti_event (handle,
946 TAPI_PROP_NETWORK_SIGNALSTRENGTH_LEVEL, on_prop_signal_level, NULL);
947 if (ret != TAPI_API_SUCCESS) {
948 msg("event register failed(%d)", ret);
951 ret = tel_register_noti_event (handle,
952 TAPI_PROP_NETWORK_LAC, on_prop_lac, NULL);
953 if (ret != TAPI_API_SUCCESS) {
954 msg("event register failed(%d)", ret);
957 ret = tel_register_noti_event (handle,
958 TAPI_PROP_NETWORK_PLMN, on_prop_plmn, NULL);
959 if (ret != TAPI_API_SUCCESS) {
960 msg("event register failed(%d)", ret);
963 ret = tel_register_noti_event (handle,
964 TAPI_PROP_NETWORK_CELLID, on_prop_cellid, NULL);
965 if (ret != TAPI_API_SUCCESS) {
966 msg("event register failed(%d)", ret);
969 ret = tel_register_noti_event (handle,
970 TAPI_PROP_NETWORK_SERVICE_TYPE, on_prop_service_type, NULL);
971 if (ret != TAPI_API_SUCCESS) {
972 msg("event register failed(%d)", ret);
975 ret = tel_register_noti_event (handle,
976 TAPI_PROP_NETWORK_ACT, on_prop_act, NULL);
977 if (ret != TAPI_API_SUCCESS) {
978 msg("event register failed(%d)", ret);
981 ret = tel_register_noti_event (handle,
982 TAPI_PROP_NETWORK_PS_TYPE, on_prop_ps_type, NULL);
983 if (ret != TAPI_API_SUCCESS) {
984 msg("event register failed(%d)", ret);
987 ret = tel_register_noti_event (handle,
988 TAPI_PROP_NETWORK_CIRCUIT_STATUS, on_prop_circuit_status, NULL);
989 if (ret != TAPI_API_SUCCESS) {
990 msg("event register failed(%d)", ret);
993 ret = tel_register_noti_event (handle,
994 TAPI_PROP_NETWORK_PACKET_STATUS, on_prop_packet_status, NULL);
995 if (ret != TAPI_API_SUCCESS) {
996 msg("event register failed(%d)", ret);
999 ret = tel_register_noti_event (handle,
1000 TAPI_PROP_NETWORK_ROAMING_STATUS, on_prop_roaming_status, NULL);
1001 if (ret != TAPI_API_SUCCESS) {
1002 msg("event register failed(%d)", ret);
1005 ret = tel_register_noti_event (handle,
1006 TAPI_PROP_NETWORK_NAME_OPTION, on_prop_name_option, NULL);
1007 if (ret != TAPI_API_SUCCESS) {
1008 msg("event register failed(%d)", ret);
1011 ret = tel_register_noti_event (handle,
1012 TAPI_PROP_NETWORK_NETWORK_NAME, on_prop_network_name, NULL);
1013 if (ret != TAPI_API_SUCCESS) {
1014 msg("event register failed(%d)", ret);
1017 ret = tel_register_noti_event (handle,
1018 TAPI_PROP_NETWORK_SPN_NAME, on_prop_spn_name, NULL);
1019 if (ret != TAPI_API_SUCCESS) {
1020 msg("event register failed(%d)", ret);