2 * @file connman_manager.hpp
4 * @brief Connman Manager-based settings plugin header.
6 * @author Ossama Othman @<ossama.othman@@intel.com@>
9 * Copyright 2013 Intel Corporation All Rights Reserved.
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.
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.
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
27 #ifndef IVI_SETTINGS_CONNMAN_MANAGER_HPP
28 #define IVI_SETTINGS_CONNMAN_MANAGER_HPP
30 #include "connman.hpp"
31 #include "subscription_manager.hpp"
34 #include <settingsd/plugin.hpp>
35 #include <settingsd/event_callback.hpp>
47 * @class connman_manager
49 * @brief D-Bus Connman Manager object bridge.
51 * This class exposes the Connman Manager D-Bus API through the
52 * settings daemon WebSocket API.
54 class connman_manager : public plugin
59 connman_manager(GDBusConnection * connection,
60 event_callback const & e);
66 * @name Settings Plugin API
68 * Interface defined by the @c ivi::settings::plugin abstract
71 * @see settingsd/plugin.hpp
74 virtual std::string const & id() const;
75 virtual void handle_request(std::string request,
76 response_callback response);
80 * Register data that may be needed when handling Connman Agent
83 bool register_connect_data(char const * service_path,
84 std::map<std::string, std::string> && info,
85 response_callback const & response);
88 * Deregister connection data.
90 bool deregister_connect_data(char const * service_path);
93 * Get the properties for a specific technology.
95 * @param[in] technology Connman technology for which properties
96 * are being retrieved.
97 * @param[inout] error Glib error object that contains
98 * additional error information if
99 * non-null if the call completes.
101 * @return @c GVariant containing a dictionary of properties
102 * specific to @a technology.
104 GVariant * get_properties(std::string const & technology,
105 GError *& error) const;
108 * Get connman services and their properties.
110 * @param[inout] response Callback used to send results to the
113 void get_services(response_callback & response) const;
117 signal_data(GDBusConnection * connection,
118 event_callback const & e)
120 , subscriptions(connection, callback)
124 /// Callback through which events will be sent to clients.
125 event_callback callback;
127 /// Signal subscription manager.
128 subscription_manager subscriptions;
134 * Get connman technologies and their properties.
136 * @param[inout] response Callback used to send results to the
139 void get_technologies(response_callback & response) const;
142 * Call the method @a name on the connman Manager object.
144 * @param[in] name The connman Manager object method
146 * @param[in] parameters Method parameters.
147 * @param[inout] error Pointer to error object containing
148 * failure related information. Caller
149 * must deallocate if it is not null.
151 * @return Variant containing result of underlying Connman
152 * Manager D-Bus call. The caller must release the
153 * returned @c GVariant.
155 GVariant * call_method(char const * name,
156 GVariant * parameters,
157 GError *& error) const;
161 * Send response or error to client that initiated the request.
163 void handle_return_value(char const * name,
166 response_callback & response) const;
168 typedef void (*ivi_signal_callback)(GDBusConnection * connection,
169 char const * sender_name,
170 char const * object_path,
171 char const * interface_name,
172 char const * signal_name,
173 GVariant * parameters,
176 /// Subscribe to Connman Manager signal @a name.
177 guint subscribe_to_signal(GDBusConnection * connection,
179 ivi_signal_callback callback,
184 /// The proxy used to access the connman Manager D-Bus API.
187 /// Data passed to signal handlers.
190 /// TechnologyAdded signal subscription ID.
191 guint const technology_added_id_;
193 /// TechnologyRemoved signal subscription ID.
194 guint const technology_removed_id_;
196 /// ServicesChanged signal subscription ID.
197 guint const services_changed_id_;
200 * The connman Agent implemention that handles secure and
201 * hidden network related requests.
211 #endif /* IVI_SETTINGS_CONNMAN_MANAGER_HPP */
217 // indent-tabs-mode: nil