Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Unified Diff: chromeos_network.cc

Issue 1695032: Added DisconnectFromNetwork and SetPassphrase. (Closed) Base URL: ssh://git@chromiumos-git//cros.git
Patch Set: Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos_network.h ('k') | load.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos_network.cc
diff --git a/chromeos_network.cc b/chromeos_network.cc
index aafab04855857c6e97d4405c86693eed88539d8e..51623642dfdbe51bd9bc9a389318b8c46efca67a 100644
--- a/chromeos_network.cc
+++ b/chromeos_network.cc
@@ -31,6 +31,7 @@ static const char* kConnmanProfileInterface = "org.moblin.connman.Profile";
static const char* kGetPropertiesFunction = "GetProperties";
static const char* kSetPropertyFunction = "SetProperty";
static const char* kConnectFunction = "Connect";
+static const char* kDisconnectFunction = "Disconnect";
static const char* kRequestScanFunction = "RequestScan";
static const char* kGetWifiServiceFunction = "GetWifiService";
static const char* kEnableTechnologyFunction = "EnableTechnology";
@@ -931,6 +932,27 @@ bool ChromeOSConnectToNetwork(const char* service_path,
}
extern "C"
+bool ChromeOSDisconnectFromNetwork(const char* service_path) {
+ dbus::Proxy service_proxy(dbus::GetSystemBusConnection(),
+ kConnmanServiceName,
+ service_path,
+ kConnmanServiceInterface);
+
+ // Now try disconnecting.
+ glib::ScopedError error;
+ if (!::dbus_g_proxy_call(service_proxy.gproxy(),
+ kDisconnectFunction,
+ &Resetter(&error).lvalue(),
+ G_TYPE_INVALID,
+ G_TYPE_INVALID)) {
+ LOG(WARNING) << "DisconnectFromNetwork failed: "
+ << (error->message ? error->message : "Unknown Error.");
+ return false;
+ }
+ return true;
+}
+
+extern "C"
bool ChromeOSDeleteRememberedService(const char* service_path) {
dbus::BusConnection bus = dbus::GetSystemBusConnection();
dbus::Proxy manager_proxy(bus,
@@ -1181,4 +1203,30 @@ bool ChromeOSSetAutoConnect(const char* service_path, bool auto_connect) {
return true;
}
+extern "C"
+bool ChromeOSSetPassphrase(const char* service_path, const char* passphrase) {
+ dbus::Proxy service_proxy(dbus::GetSystemBusConnection(),
+ kConnmanServiceName,
+ service_path,
+ kConnmanServiceInterface);
+
+ glib::Value value_passphrase(passphrase);
+ glib::ScopedError error;
+ if (!::dbus_g_proxy_call(service_proxy.gproxy(),
+ kSetPropertyFunction,
+ &Resetter(&error).lvalue(),
+ G_TYPE_STRING,
+ kPassphraseProperty,
+ G_TYPE_VALUE,
+ &value_passphrase,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID)) {
+ LOG(WARNING) << "SetPassphrase failed: "
+ << (error->message ? error->message : "Unknown Error.");
+ return false;
+ }
+
+ return true;
+}
+
} // namespace chromeos
« no previous file with comments | « chromeos_network.h ('k') | load.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698