binder: Implement iface methods
Implement the following iface methods:
1. Reassociate
2. Reconnect
3. Disconnct
BUG: 30093041
Change-Id: I83a527a06c89f05e693212c536f21494c678843e
TEST: Writing new tests in |wpa_supplicant_binder_test|
Signed-off-by: Roshan Pius <rpius@google.com>
diff --git a/wpa_supplicant/binder/iface.cpp b/wpa_supplicant/binder/iface.cpp
index 280e191..cd4be06 100644
--- a/wpa_supplicant/binder/iface.cpp
+++ b/wpa_supplicant/binder/iface.cpp
@@ -121,6 +121,49 @@
return android::binder::Status::ok();
}
+android::binder::Status Iface::Reassociate()
+{
+ struct wpa_supplicant *wpa_s = retrieveIfacePtr();
+ RETURN_IF_IFACE_INVALID(wpa_s);
+
+ if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
+ return android::binder::Status::fromServiceSpecificError(
+ ERROR_IFACE_DISABLED);
+ }
+ wpas_request_connection(wpa_s);
+ return android::binder::Status::ok();
+}
+
+android::binder::Status Iface::Reconnect()
+{
+ struct wpa_supplicant *wpa_s = retrieveIfacePtr();
+ RETURN_IF_IFACE_INVALID(wpa_s);
+
+ if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
+ return android::binder::Status::fromServiceSpecificError(
+ ERROR_IFACE_DISABLED);
+ }
+ if (!wpa_s->disconnected) {
+ return android::binder::Status::fromServiceSpecificError(
+ ERROR_IFACE_NOT_DISCONNECTED);
+ }
+ wpas_request_connection(wpa_s);
+ return android::binder::Status::ok();
+}
+
+android::binder::Status Iface::Disconnect()
+{
+ struct wpa_supplicant *wpa_s = retrieveIfacePtr();
+ RETURN_IF_IFACE_INVALID(wpa_s);
+
+ if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
+ return android::binder::Status::fromServiceSpecificError(
+ ERROR_IFACE_DISABLED);
+ }
+ wpas_request_disconnection(wpa_s);
+ return android::binder::Status::ok();
+}
+
/**
* Retrieve the underlying |wpa_supplicant| struct pointer for
* this iface.