delete README file
[framework/telephony/tel-plugin-packetservice.git] / src / main.c
1 /*
2  * PacketService Control Module
3  *
4  * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: DongHoo Park <donghoo.park@samsung.com>
7  *
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
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
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.
19  *
20  */
21
22 #include <stdio.h>
23 #include <glib.h>
24 #include <dbus/dbus-glib.h>
25
26 #include <tcore.h>
27 #include <plugin.h>
28
29 #include <ps.h>
30
31 static gboolean on_load()
32 {
33         dbg("PacketService plugin load!");
34         return TRUE;
35 }
36
37 static gboolean on_init(TcorePlugin *p)
38 {
39         gpointer *master;
40         DBusGConnection *conn;
41         GError *error = NULL;
42         gboolean rv=FALSE;
43
44         //get dbus connection
45         conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
46         if (conn == NULL) {
47                 err("fail to get dbus(%s)", error->message);
48                 return FALSE;
49         }
50         dbg("get dbus connection(%p)", conn);
51
52         dbg("plugin pointer (%p)", p);
53         rv = _ps_context_initialize(p);
54         if(rv != TRUE){
55                 dbg("fail to initialize context global variable");
56                 return FALSE;
57         }
58
59         master = _ps_master_create_master(conn, p);
60         rv = _ps_master_create_modems(master);
61
62         dbg("initialized PacketService plugin!");
63         return TRUE;
64 }
65
66 static void on_unload(TcorePlugin *p)
67 {
68         dbg("i'm unload!");
69         return;
70 }
71
72 struct tcore_plugin_define_desc plugin_define_desc =
73 {
74         .name = "PACKETSERVICE",
75         .priority = TCORE_PLUGIN_PRIORITY_MID + 1,
76         .version = 1,
77         .load = on_load,
78         .init = on_init,
79         .unload = on_unload
80 };