Fix the termination issue
[framework/connectivity/data-router.git] / src / dr-modem.c
1 /*
2  * Data-Router
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
7  *               Injun Yang <injun.yang@samsung.com>
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *              http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  */
22
23
24 #include <ITapiPS.h>
25 #include <tapi_common.h>
26 #include <ITapiModem.h>
27 #include "dr-modem.h"
28 #include "dr-usb.h"
29 #include "dr-common.h"
30
31
32
33 extern dr_info_t dr_info;
34 extern TapiHandle *tapi_handle;
35
36
37
38 static void __modem_pin_ctrl_cb(TapiHandle *handle, int result, void *data, void *user_data)
39 {
40         DBG("__modem_pin_ctrl_cb result : %d \n", result);
41         return;
42 }
43
44 int _send_dtr_ctrl_signal(int status)
45 {
46         int result;
47         tapi_ps_btdun_pincontrol pincontrol;
48
49         pincontrol.signal = GPRS_DATA_SIGNAL_DTR;
50         if (status == DTR_ON) {
51                 pincontrol.status = GPRS_SIGNAL_STATUS_ON;
52                 DBG("Send DTR+ to Modem \n");
53         } else {
54                 pincontrol.status = GPRS_SIGNAL_STATUS_OFF;
55                 DBG("Send DTR- to Modem \n");
56         }
57
58         result = tel_control_modem_dun_pin_ctrl(tapi_handle, &pincontrol, __modem_pin_ctrl_cb, NULL);
59         if (result != TAPI_API_SUCCESS) {
60                 ERR("DTR sending failed. [Error : %d]\n", result);
61         }
62
63         return result;
64 }