dundee: Add emply plugin
[platform/upstream/connman.git] / plugins / dundee.c
1 /*
2  *
3  *  Connection Manager
4  *
5  *  Copyright (C) 2012  BMW Car IT GmbH. All rights reserved.
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License version 2 as
9  *  published by the Free Software Foundation.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  */
21
22 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25
26 #include <errno.h>
27
28 #define CONNMAN_API_SUBJECT_TO_CHANGE
29 #include <connman/plugin.h>
30 #include <connman/device.h>
31 #include <connman/network.h>
32 #include <connman/dbus.h>
33
34 static DBusConnection *connection;
35
36 static int network_probe(struct connman_network *network)
37 {
38         DBG("network %p", network);
39
40         return 0;
41 }
42
43 static void network_remove(struct connman_network *network)
44 {
45         DBG("network %p", network);
46 }
47
48 static int network_connect(struct connman_network *network)
49 {
50         DBG("network %p", network);
51
52         return 0;
53 }
54
55 static int network_disconnect(struct connman_network *network)
56 {
57         DBG("network %p", network);
58
59         return 0;
60 }
61
62 static struct connman_network_driver network_driver = {
63         .name           = "network",
64         .type           = CONNMAN_NETWORK_TYPE_BLUETOOTH_DUN,
65         .probe          = network_probe,
66         .remove         = network_remove,
67         .connect        = network_connect,
68         .disconnect     = network_disconnect,
69 };
70
71 static int dundee_probe(struct connman_device *device)
72 {
73         DBG("device %p", device);
74
75         return 0;
76 }
77
78 static void dundee_remove(struct connman_device *device)
79 {
80         DBG("device %p", device);
81 }
82
83 static int dundee_enable(struct connman_device *device)
84 {
85         DBG("device %p", device);
86
87         return 0;
88 }
89
90 static int dundee_disable(struct connman_device *device)
91 {
92         DBG("device %p", device);
93
94         return 0;
95 }
96
97 static struct connman_device_driver dundee_driver = {
98         .name           = "dundee",
99         .type           = CONNMAN_DEVICE_TYPE_BLUETOOTH,
100         .probe          = dundee_probe,
101         .remove         = dundee_remove,
102         .enable         = dundee_enable,
103         .disable        = dundee_disable,
104 };
105
106 static int dundee_init(void)
107 {
108         int err;
109
110         connection = connman_dbus_get_connection();
111         if (connection == NULL)
112                 return -EIO;
113
114         err = connman_network_driver_register(&network_driver);
115         if (err < 0)
116                 goto remove;
117
118         err = connman_device_driver_register(&dundee_driver);
119         if (err < 0) {
120                 connman_network_driver_unregister(&network_driver);
121                 goto remove;
122         }
123
124         return 0;
125
126 remove:
127         dbus_connection_unref(connection);
128
129         return err;
130 }
131
132 static void dundee_exit(void)
133 {
134         connman_device_driver_unregister(&dundee_driver);
135         connman_network_driver_unregister(&network_driver);
136
137         dbus_connection_unref(connection);
138 }
139
140 CONNMAN_PLUGIN_DEFINE(dundee, "Dundee plugin", VERSION,
141                 CONNMAN_PLUGIN_PRIORITY_DEFAULT, dundee_init, dundee_exit)