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 static char data_gprs_dun_signal[MENU_DATA_SIZE + 1] = "dtr";
35 static char data_gprs_dun_status[MENU_DATA_SIZE + 1] = "off";
39 gboolean on_noti_ps_dun_pin_control(tapi_service_object_t *data, void *user_data)
44 msg("TAPI_NOTI_PS_DUN_PIN_CONTROL receive !!");
46 str_signal = tapi_service_object_get_string(data, "signal");
47 status = tapi_service_object_get_boolean(data, "status");
49 msg("signal = %s", str_signal);
50 msg("status = %d", status);
55 gboolean on_noti_ps_external_call(tapi_service_object_t *data, void *user_data)
57 msg("TAPI_NOTI_PS_EXTERNAL_CALL receive !!");
64 static gboolean on_gprs_dun_callback(tapi_service_object_t *data, void *cb_data)
68 msg("TAPI_SERVICE_PS_SET_DUN_PIN_CONTROL response receive");
69 result = tapi_service_object_get_int(data, "result");
71 msg("result = %d (0 = success)", result);
76 static int run_gprs_dun(MManager *mm, struct menu_data *menu)
78 tapi_handle_t *handle = menu_manager_ref_user_data(mm);
79 tapi_service_object_t *in = NULL;
80 gboolean in_status = FALSE;
82 if (!g_strcmp0(data_gprs_dun_status, "on")) {
85 else if (!g_strcmp0(data_gprs_dun_status, "off")) {
89 msg("wrong value in STATUS");
93 msg("SIGNAL = %s", data_gprs_dun_signal);
94 msg("STATUS = %s (convert to boolean = %d)", data_gprs_dun_status, in_status);
95 msg("call [%s] tapi service !!!", menu->title);
97 in = tapi_create_service_object(TAPI_SERVICE_PS_SET_DUN_PIN_CONTROL);
98 tapi_service_object_add_data(in, "signal", data_gprs_dun_signal, TAPI_OBJECT_DATA_TYPE_STRING);
99 tapi_service_object_add_data(in, "status", &in_status, TAPI_OBJECT_DATA_TYPE_BOOLEAN);
101 tel_processing_command_async(handle, in, on_gprs_dun_callback, NULL);
106 struct menu_data menu_gprs_dun[] = {
107 { "1", "SIGNAL (dcd / dtr / dsr / rts / cts / ri)", NULL, NULL, data_gprs_dun_signal},
108 { "2", "STATUS (on / off)", NULL, NULL, data_gprs_dun_status},
109 { "3", "run", NULL, run_gprs_dun, NULL},
113 struct menu_data menu_gprs[] = {
114 { "1", "DUN Pin Control", menu_gprs_dun, NULL, NULL},