Atmodem implementation
[platform/core/telephony/tel-plugin-atmodem.git] / src / atmodem_common.c
1 /*
2  * tel-plugin-atmodem
3  *
4  * Copyright (c) 2013 Samsung Electronics Co. Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18
19 #include <stdio.h>
20 #include <string.h>
21 #include <stdlib.h>
22
23 #include <glib.h>
24
25 #include <log.h>
26 #include <tcore.h>
27
28 #include "atmodem_common.h"
29
30 void on_send_atmodem_request(TcorePending *p,
31         TelReturn send_status, void *user_data)
32 {
33         dbg("Send - [%s]",
34                 (send_status == TEL_RETURN_SUCCESS ? "OK" : "NOK"));
35 }
36
37 AtmodemRespCbData *atmodem_create_resp_cb_data(TcoreObjectResponseCallback cb,
38         void *cb_data, void *data, guint data_len)
39 {
40         AtmodemRespCbData *resp_cb_data;
41
42         resp_cb_data = tcore_malloc0(sizeof(AtmodemRespCbData) + data_len);
43         resp_cb_data->cb = cb;
44         resp_cb_data->cb_data = cb_data;
45         if ((data != NULL) && (data_len > 0))
46                 memcpy(resp_cb_data->data, data, data_len);
47
48         return resp_cb_data;
49 }
50
51 void atmodem_destroy_resp_cb_data(AtmodemRespCbData *resp_cb_data)
52 {
53         if (resp_cb_data)
54                 tcore_free(resp_cb_data);
55 }