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.
27 #include <glib-object.h>
29 #include <tapi_sipc.h>
34 extern struct menu_data menu_modem[];
35 extern struct menu_data menu_gprs[];
36 extern struct menu_data menu_net[];
37 extern struct menu_data menu_custom[];
39 static struct menu_data menu_xxx[] = {
40 { "1", "XXX", NULL, NULL, NULL},
44 static struct menu_data menu_main[] = {
45 { "1", "Common", menu_xxx, NULL, NULL},
46 { "2", "Modem", menu_modem, NULL, NULL},
47 { "3", "Call", menu_xxx, NULL, NULL},
48 { "4", "SIM", menu_xxx, NULL, NULL},
49 { "5", "SS", menu_xxx, NULL, NULL},
50 { "6", "SMS", menu_xxx, NULL, NULL},
51 { "7", "Network", menu_net, NULL, NULL},
52 { "8", "SAT", menu_xxx, NULL, NULL},
53 { "9", "GPRS", menu_gprs, NULL, NULL},
54 { "a", "SOUND", menu_xxx, NULL, NULL},
55 { "b", "Custom", menu_custom,NULL, NULL},
59 tapi_handle_t *register_client(void)
61 tapi_handle_t *handle;
63 handle = tapi_init("com.xxx.test", "default");
65 printf("fail to register server\n");
69 printf("success to register server\n");
73 void register_event(tapi_handle_t *handle)
78 ret = tapi_register_notification(handle, TAPI_NOTI_PS_DUN_PIN_CONTROL, on_noti_ps_dun_pin_control, NULL);
79 ret = tapi_register_notification(handle, TAPI_NOTI_PS_EXTERNAL_CALL, on_noti_ps_external_call, NULL);
82 ret = tapi_register_notification(handle, TAPI_NOTI_NETWORK_REGISTRATION_STATUS, on_noti_network_registration_status, NULL);
83 ret = tapi_register_notification(handle, TAPI_NOTI_NETWORK_LOCATION_CELLINFO, on_noti_network_location_cellinfo, NULL);
84 ret = tapi_register_notification(handle, TAPI_NOTI_NETWORK_ICON_INFO, on_noti_network_icon_info, NULL);
85 ret = tapi_register_notification(handle, TAPI_NOTI_NETWORK_CHANGE, on_noti_network_change, NULL);
86 ret = tapi_register_notification(handle, TAPI_NOTI_NETWORK_TIMEINFO, on_noti_network_timeinfo, NULL);
89 void deregister_client(tapi_handle_t *handle)
96 rv = tapi_deinit(handle);
98 printf("fail to deregister server\n");
102 printf("success to deregister server\n");
106 int main(int arg, char **argv)
109 GIOChannel *channel = g_io_channel_unix_new(STDIN_FILENO);
111 tapi_handle_t *handle;
113 mainloop = g_main_loop_new(NULL, FALSE);
114 handle = register_client();
116 register_event(handle);
118 printf("******* Integrated TAPI Test Application: Version 0.4 *****\n");
119 printf("******* Buid On: %s %s ********\n", __DATE__, __TIME__);
121 manager = menu_manager_new(menu_main, mainloop);
122 menu_manager_set_user_data(manager, handle);
123 menu_manager_run(manager);
125 g_io_add_watch(channel, (G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL), on_menu_manager_keyboard, manager);
127 g_main_loop_run(mainloop);
129 printf("******* Bye bye *******\n");
131 deregister_client(handle);