4 * @brief Connman-based settings plugin.
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 #include "connman.hpp"
29 #include <settingsd/glib_traits.hpp>
30 #include <settingsd/unique_ptr.hpp>
31 #include <settingsd/dbus_signal_callback.hpp>
38 ivi::settings::connman::connman(char const * interface,
40 GDBusConnection * connection,
41 event_callback const & e)
46 static char const name[] = "net.connman"; // Service
48 GError * error = nullptr;
51 g_dbus_proxy_new_sync (connection,
52 G_DBUS_PROXY_FLAGS_NONE,
53 nullptr, // GDBusInterfaceInfo
57 nullptr, // GCancellable
60 unique_ptr<GError> safe_error(error);
62 if (proxy_ == nullptr) {
63 g_printerr("Unable to create D-Bus proxy for (\"%s\", \"%s\"): %s\n",
68 throw std::runtime_error(error->message);
71 // Listen for changes to properties.
73 g_dbus_connection_signal_subscribe(
80 G_DBUS_SIGNAL_FLAGS_NONE,
86 ivi::settings::connman::~connman()
88 if (proxy_ != nullptr) {
89 g_dbus_connection_signal_unsubscribe(
90 g_dbus_proxy_get_connection(G_DBUS_PROXY(proxy_)),
93 g_object_unref(proxy_);
98 ivi::settings::connman::set_property(char const * property,
102 static gint const timeout = 5000; // milliseconds
104 return g_dbus_proxy_call_sync(proxy_,
105 "SetProperty", // Method name
106 g_variant_new("(sv)",
109 G_DBUS_CALL_FLAGS_NONE,
111 nullptr, // Not cancellable
119 // indent-tabs-mode: nil