Update plugin
[platform/core/telephony/tel-plugin-at_standard.git] / src / at_modem.c
1 /*
2  * tel-plugin-at_standard
3  *
4  * Copyright (c) 2012 Intel Corporation. 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 #include <stdio.h>
19 #include <stdlib.h>
20 #include <string.h>
21 #include <unistd.h>
22 #include <glib.h>
23
24 #include <tcore.h>
25 #include <server.h>
26 #include <plugin.h>
27 #include <core_object.h>
28 #include <co_modem.h>
29
30 #include "user_request.h"
31
32 #include "at_modem.h"
33
34 static TReturn get_imei(CoreObject *co, UserRequest *ur)
35 {
36         return TCORE_RETURN_ENOSYS;
37 }
38
39 static TReturn get_version(CoreObject *co, UserRequest *ur)
40 {
41         return TCORE_RETURN_ENOSYS;
42 }
43
44 static TReturn set_flight_mode(CoreObject *co, UserRequest *ur)
45 {
46         return TCORE_RETURN_ENOSYS;
47 }
48
49 static struct tcore_modem_operations modem_ops = {
50         .power_on = NULL,
51         .power_off = NULL,
52         .power_reset = NULL,
53         .set_flight_mode = set_flight_mode,
54         .get_imei = get_imei,
55         .get_version = get_version,
56         .get_sn = NULL,
57         .dun_pin_ctrl = NULL,
58         .get_flight_mode = NULL,
59 };
60
61 gboolean at_modem_init(TcorePlugin *cp)
62 {
63         CoreObject *co;
64         Server *server;
65
66         co = tcore_modem_new(cp, &modem_ops, NULL);
67         if (co == NULL)
68                 return FALSE;
69
70         server = tcore_plugin_ref_server(cp);
71         tcore_server_add_template_object(server, co);
72
73         return TRUE;
74 }
75
76 void at_modem_exit(TcorePlugin *cp)
77 {
78         CoreObject *co;
79
80         if (cp == NULL)
81                 return;
82
83         co = tcore_plugin_ref_core_object(cp, CORE_OBJECT_TYPE_MODEM);
84         if (co == NULL)
85                 return;
86
87         tcore_object_free(co);
88 }