Fix TIVI-{1191,1192,2108} by implementing a connman 'Agent'.
[profile/ivi/settings-daemon.git] / plugins / connman / connman.hpp
1 /**
2  * @file connman.hpp
3  *
4  * @brief Connman-based settings plugin header.
5  *
6  * @author Ossama Othman @<ossama.othman@@intel.com@>
7  *
8  * @copyright @par
9  * Copyright 2013 Intel Corporation All Rights Reserved.
10  * @par
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation;
14  * version 2.1 of the License.
15  * @par
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Lesser General Public License for more details.
20  * @par
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this library; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
24  * Boston, MA  02110-1301  USA
25  */
26
27
28 #ifndef IVI_SETTINGS_CONNMAN_HPP
29 #define IVI_SETTINGS_CONNMAN_HPP
30
31 #include <gio/gio.h>
32
33
34 namespace ivi
35 {
36   namespace settings
37   {
38     /**
39      * @class connman
40      *
41      * @brief Common connman-based settings functionality.
42      *
43      * This class implements functionality common to all connman-based
44      * settings, such as bluetooth, wifi, date/time, etc.
45      */
46     class connman
47     {
48     public:
49
50       /**
51        * Constructor.
52        *
53        * @param[in] interface  Connman D-Bus interface.
54        * @param[in] path       Connman D-Bus object path.
55        * @param[in] connection Underlying D-Bus connection.
56        */
57       connman(char const * interface,
58               char const * path,
59               GDBusConnection * connection);
60
61       /// Destructor.
62       ~connman();
63
64       /**
65        * Set @a property to given @a value on the underlying connman
66        * object.
67        *
68        * @param[in] property The name of the property to be set.
69        * @param[in] value    The property value to be set.
70        * @param[inout] error The error object containing information
71        *                     on a failed connman @c SetProperty method
72        *                     call.
73        *
74        * @returns @c nullptr on a failed call to the connman
75        *          @c SetProperty method.
76        */
77       GVariant * set_property(char const * property,
78                               GVariant * value,
79                               GError *& error);
80
81       /// Get pointer to underlying GDBusProxy.
82       GDBusProxy * proxy() const { return proxy_; }
83
84       /// Get pointer to underlying GDBusConnection.
85       GDBusConnection *
86       connection() const
87       {
88         return g_dbus_proxy_get_connection(G_DBUS_PROXY(proxy_));
89       }
90
91       /// Convenience function to get D-Bus interface name.
92       char const *
93       interface_name() const
94       {
95         return g_dbus_proxy_get_interface_name(proxy_);
96       }
97
98       /// Convenience function to get D-Bus object path.
99       char const *
100       object_path() const
101       {
102         return g_dbus_proxy_get_object_path(proxy_);
103       }
104
105     private:
106
107       /// The proxy used to access the Connman D-Bus API.
108       GDBusProxy * proxy_;
109
110     };
111
112   }
113 }
114
115
116 #endif  /* IVI_SETTINGS_CONNMAN_HPP */
117
118
119 // Local Variables:
120 // mode:c++
121 // c-basic-offset:2
122 // indent-tabs-mode: nil
123 // End: