2 * @file connman_manager.hpp
4 * @brief Connman 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"
32 #include <settingsd/glib_traits.hpp>
33 #include <settingsd/smart_ptr.hpp>
36 #include <json-glib/json-glib.h>
48 * @class connman_manager
50 * @brief Common connman-based settings functionality.
52 * This class implements functionality common to all connman-based
53 * settings, such as bluetooth, wifi, date/time, etc.
66 * Get the properties for a specific technology.
68 * @param[in] technology Connman technology for which properties
69 * are being retrieved.
70 * @param[inout] error Glib error object that contains
71 * additional error information if
72 * non-null if the call completes.
74 * @return @c GVariant containing a dictionary of properties
75 * specific to @a technology.
77 GVariant * get_properties(std::string const & technology,
78 GError *& error) const;
81 * Get connman services and their properties.
83 * @param[inout] error Glib error object that contains
84 * additional error information if
85 * non-null if the call completes.
87 * @return @c GVariant containing a dictionary services and
88 * corresponding properties.
90 GVariant * get_services(GError *& error) const;
92 /// The type held by the @c future containing the async result.
93 typedef smart_ptr<JsonNode> future_value_type;
95 /// The @c future type returned by the @c promise.
96 typedef std::future<future_value_type> future_type;
98 /// The @c promise that provides the async result.
99 typedef std::promise<future_value_type> promise_type;
102 * Smart pointer to the @c promise that provides the async
105 typedef std::shared_ptr<promise_type> shared_promise_type;
107 /// List type for promises to be updated with async result.
108 typedef std::list<shared_promise_type> promise_list_type;
111 * Get a promise that will contain changed connman services when
112 * they become available. The user must obtain the value from
113 * the corresponding future object and release the @c JsonNode*
114 * value contained within that future with @c json_node_free().
116 shared_promise_type get_services_changed_promise();
121 * @brief Struct passed to @c ServicesChanged signal handler.
126 user_data(std::mutex & m, promise_list_type & p)
133 * References to mutex used to synchronize access to the list
138 /// List of promises to be updated with the changed services.
139 promise_list_type & promises;
144 /// The proxy used to access the connman Manager D-Bus API.
147 /// Mutex used to synchronize access to the promises list.
151 * List of promises that will be updated with the
152 * ServicesChanged signal results.
154 promise_list_type promises_;
156 /// User data passed to @c ServicesChanged signal handler.
159 /// ServicesChanged signal subscription ID.
160 guint const subscription_id_;
168 #endif /* IVI_SETTINGS_CONNMAN_MANAGER_HPP */
174 // indent-tabs-mode: nil