wifi: Add support for removing iface am: 8b55e6f475 am: bb2dad47bb
am: efcc2b6165
Change-Id: Ic9ef427f6b8d56d2f9fdd98c4bdfc75f1010f31e
diff --git a/wifi/1.0/IWifiChip.hal b/wifi/1.0/IWifiChip.hal
index 3c085c3..051a088 100644
--- a/wifi/1.0/IWifiChip.hal
+++ b/wifi/1.0/IWifiChip.hal
@@ -323,13 +323,28 @@
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
- * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
+ * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
+ * |WifiStatusCode.ERROR_INVALID_ARGS|
* @return iface HIDL interface object representing the iface if
* it exists, null otherwise.
*/
getApIface(string ifname) generates (WifiStatus status, IWifiApIface iface);
/**
+ * Removes the AP Iface with the provided ifname.
+ * Any further calls on the corresponding |IWifiApIface| HIDL interface
+ * object must fail.
+ *
+ * @param ifname Name of the iface.
+ * @return status WifiStatus of the operation.
+ * Possible status codes:
+ * |WifiStatusCode.SUCCESS|,
+ * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
+ * |WifiStatusCode.ERROR_INVALID_ARGS|
+ */
+ removeApIface(string ifname) generates (WifiStatus status);
+
+ /**
* Create a NAN iface on the chip.
*
* Depending on the mode the chip is configured in, the interface creation
@@ -368,13 +383,28 @@
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
- * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
+ * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
+ * |WifiStatusCode.ERROR_INVALID_ARGS|
* @return iface HIDL interface object representing the iface if
* it exists, null otherwise.
*/
getNanIface(string ifname) generates (WifiStatus status, IWifiNanIface iface);
/**
+ * Removes the NAN Iface with the provided ifname.
+ * Any further calls on the corresponding |IWifiNanIface| HIDL interface
+ * object must fail.
+ *
+ * @param ifname Name of the iface.
+ * @return status WifiStatus of the operation.
+ * Possible status codes:
+ * |WifiStatusCode.SUCCESS|,
+ * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
+ * |WifiStatusCode.ERROR_INVALID_ARGS|
+ */
+ removeNanIface(string ifname) generates (WifiStatus status);
+
+ /**
* Create a P2P iface on the chip.
*
* Depending on the mode the chip is configured in, the interface creation
@@ -413,13 +443,28 @@
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
- * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
+ * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
+ * |WifiStatusCode.ERROR_INVALID_ARGS|
* @return iface HIDL interface object representing the iface if
* it exists, null otherwise.
*/
getP2pIface(string ifname) generates (WifiStatus status, IWifiP2pIface iface);
/**
+ * Removes the P2P Iface with the provided ifname.
+ * Any further calls on the corresponding |IWifiP2pIface| HIDL interface
+ * object must fail.
+ *
+ * @param ifname Name of the iface.
+ * @return status WifiStatus of the operation.
+ * Possible status codes:
+ * |WifiStatusCode.SUCCESS|,
+ * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
+ * |WifiStatusCode.ERROR_INVALID_ARGS|
+ */
+ removeP2pIface(string ifname) generates (WifiStatus status);
+
+ /**
* Create an STA iface on the chip.
*
* Depending on the mode the chip is configured in, the interface creation
@@ -458,13 +503,28 @@
* @return status WifiStatus of the operation.
* Possible status codes:
* |WifiStatusCode.SUCCESS|,
- * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|
+ * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
+ * |WifiStatusCode.ERROR_INVALID_ARGS|
* @return iface HIDL interface object representing the iface if
* it exists, null otherwise.
*/
getStaIface(string ifname) generates (WifiStatus status, IWifiStaIface iface);
/**
+ * Removes the STA Iface with the provided ifname.
+ * Any further calls on the corresponding |IWifiStaIface| HIDL interface
+ * object must fail.
+ *
+ * @param ifname Name of the iface.
+ * @return status WifiStatus of the operation.
+ * Possible status codes:
+ * |WifiStatusCode.SUCCESS|,
+ * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|,
+ * |WifiStatusCode.ERROR_INVALID_ARGS|
+ */
+ removeStaIface(string ifname) generates (WifiStatus status);
+
+ /**
* Create a RTTController instance.
*
* RTT controller can be either:
diff --git a/wifi/1.0/default/wifi_chip.cpp b/wifi/1.0/default/wifi_chip.cpp
index af19491..d70f548 100644
--- a/wifi/1.0/default/wifi_chip.cpp
+++ b/wifi/1.0/default/wifi_chip.cpp
@@ -163,6 +163,15 @@
ifname);
}
+Return<void> WifiChip::removeApIface(const hidl_string& ifname,
+ removeApIface_cb hidl_status_cb) {
+ return validateAndCall(this,
+ WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
+ &WifiChip::removeApIfaceInternal,
+ hidl_status_cb,
+ ifname);
+}
+
Return<void> WifiChip::createNanIface(createNanIface_cb hidl_status_cb) {
return validateAndCall(this,
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
@@ -186,6 +195,15 @@
ifname);
}
+Return<void> WifiChip::removeNanIface(const hidl_string& ifname,
+ removeNanIface_cb hidl_status_cb) {
+ return validateAndCall(this,
+ WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
+ &WifiChip::removeNanIfaceInternal,
+ hidl_status_cb,
+ ifname);
+}
+
Return<void> WifiChip::createP2pIface(createP2pIface_cb hidl_status_cb) {
return validateAndCall(this,
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
@@ -209,6 +227,15 @@
ifname);
}
+Return<void> WifiChip::removeP2pIface(const hidl_string& ifname,
+ removeP2pIface_cb hidl_status_cb) {
+ return validateAndCall(this,
+ WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
+ &WifiChip::removeP2pIfaceInternal,
+ hidl_status_cb,
+ ifname);
+}
+
Return<void> WifiChip::createStaIface(createStaIface_cb hidl_status_cb) {
return validateAndCall(this,
WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
@@ -232,6 +259,15 @@
ifname);
}
+Return<void> WifiChip::removeStaIface(const hidl_string& ifname,
+ removeStaIface_cb hidl_status_cb) {
+ return validateAndCall(this,
+ WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
+ &WifiChip::removeStaIfaceInternal,
+ hidl_status_cb,
+ ifname);
+}
+
Return<void> WifiChip::createRttController(
const sp<IWifiIface>& bound_iface, createRttController_cb hidl_status_cb) {
return validateAndCall(this,
@@ -483,14 +519,21 @@
}
std::pair<WifiStatus, sp<IWifiApIface>> WifiChip::getApIfaceInternal(
- const hidl_string& ifname) {
- if (!ap_iface_.get() ||
- (ifname.c_str() != legacy_hal_.lock()->getApIfaceName())) {
+ const std::string& ifname) {
+ if (!ap_iface_.get() || (ifname != legacy_hal_.lock()->getApIfaceName())) {
return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr};
}
return {createWifiStatus(WifiStatusCode::SUCCESS), ap_iface_};
}
+WifiStatus WifiChip::removeApIfaceInternal(const std::string& ifname) {
+ if (!ap_iface_.get() || (ifname != legacy_hal_.lock()->getApIfaceName())) {
+ return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
+ }
+ invalidateAndClear(ap_iface_);
+ return createWifiStatus(WifiStatusCode::SUCCESS);
+}
+
std::pair<WifiStatus, sp<IWifiNanIface>> WifiChip::createNanIfaceInternal() {
// Only 1 of NAN or P2P iface can be active at a time.
if (current_mode_id_ != kStaChipModeId || nan_iface_.get() ||
@@ -512,14 +555,21 @@
}
std::pair<WifiStatus, sp<IWifiNanIface>> WifiChip::getNanIfaceInternal(
- const hidl_string& ifname) {
- if (!nan_iface_.get() ||
- (ifname.c_str() != legacy_hal_.lock()->getNanIfaceName())) {
+ const std::string& ifname) {
+ if (!nan_iface_.get() || (ifname != legacy_hal_.lock()->getNanIfaceName())) {
return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr};
}
return {createWifiStatus(WifiStatusCode::SUCCESS), nan_iface_};
}
+WifiStatus WifiChip::removeNanIfaceInternal(const std::string& ifname) {
+ if (!nan_iface_.get() || (ifname != legacy_hal_.lock()->getNanIfaceName())) {
+ return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
+ }
+ invalidateAndClear(nan_iface_);
+ return createWifiStatus(WifiStatusCode::SUCCESS);
+}
+
std::pair<WifiStatus, sp<IWifiP2pIface>> WifiChip::createP2pIfaceInternal() {
// Only 1 of NAN or P2P iface can be active at a time.
if (current_mode_id_ != kStaChipModeId || p2p_iface_.get() ||
@@ -541,14 +591,21 @@
}
std::pair<WifiStatus, sp<IWifiP2pIface>> WifiChip::getP2pIfaceInternal(
- const hidl_string& ifname) {
- if (!p2p_iface_.get() ||
- (ifname.c_str() != legacy_hal_.lock()->getP2pIfaceName())) {
+ const std::string& ifname) {
+ if (!p2p_iface_.get() || (ifname != legacy_hal_.lock()->getP2pIfaceName())) {
return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr};
}
return {createWifiStatus(WifiStatusCode::SUCCESS), p2p_iface_};
}
+WifiStatus WifiChip::removeP2pIfaceInternal(const std::string& ifname) {
+ if (!p2p_iface_.get() || (ifname != legacy_hal_.lock()->getP2pIfaceName())) {
+ return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
+ }
+ invalidateAndClear(p2p_iface_);
+ return createWifiStatus(WifiStatusCode::SUCCESS);
+}
+
std::pair<WifiStatus, sp<IWifiStaIface>> WifiChip::createStaIfaceInternal() {
if (current_mode_id_ != kStaChipModeId || sta_iface_.get()) {
return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}};
@@ -568,14 +625,21 @@
}
std::pair<WifiStatus, sp<IWifiStaIface>> WifiChip::getStaIfaceInternal(
- const hidl_string& ifname) {
- if (!sta_iface_.get() ||
- (ifname.c_str() != legacy_hal_.lock()->getStaIfaceName())) {
+ const std::string& ifname) {
+ if (!sta_iface_.get() || (ifname != legacy_hal_.lock()->getStaIfaceName())) {
return {createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS), nullptr};
}
return {createWifiStatus(WifiStatusCode::SUCCESS), sta_iface_};
}
+WifiStatus WifiChip::removeStaIfaceInternal(const std::string& ifname) {
+ if (!sta_iface_.get() || (ifname != legacy_hal_.lock()->getStaIfaceName())) {
+ return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
+ }
+ invalidateAndClear(sta_iface_);
+ return createWifiStatus(WifiStatusCode::SUCCESS);
+}
+
std::pair<WifiStatus, sp<IWifiRttController>>
WifiChip::createRttControllerInternal(const sp<IWifiIface>& bound_iface) {
sp<WifiRttController> rtt = new WifiRttController(bound_iface, legacy_hal_);
diff --git a/wifi/1.0/default/wifi_chip.h b/wifi/1.0/default/wifi_chip.h
index 764445f..5e7a0c3 100644
--- a/wifi/1.0/default/wifi_chip.h
+++ b/wifi/1.0/default/wifi_chip.h
@@ -83,18 +83,26 @@
Return<void> getApIfaceNames(getApIfaceNames_cb hidl_status_cb) override;
Return<void> getApIface(const hidl_string& ifname,
getApIface_cb hidl_status_cb) override;
+ Return<void> removeApIface(const hidl_string& ifname,
+ removeApIface_cb hidl_status_cb) override;
Return<void> createNanIface(createNanIface_cb hidl_status_cb) override;
Return<void> getNanIfaceNames(getNanIfaceNames_cb hidl_status_cb) override;
Return<void> getNanIface(const hidl_string& ifname,
getNanIface_cb hidl_status_cb) override;
+ Return<void> removeNanIface(const hidl_string& ifname,
+ removeNanIface_cb hidl_status_cb) override;
Return<void> createP2pIface(createP2pIface_cb hidl_status_cb) override;
Return<void> getP2pIfaceNames(getP2pIfaceNames_cb hidl_status_cb) override;
Return<void> getP2pIface(const hidl_string& ifname,
getP2pIface_cb hidl_status_cb) override;
+ Return<void> removeP2pIface(const hidl_string& ifname,
+ removeP2pIface_cb hidl_status_cb) override;
Return<void> createStaIface(createStaIface_cb hidl_status_cb) override;
Return<void> getStaIfaceNames(getStaIfaceNames_cb hidl_status_cb) override;
Return<void> getStaIface(const hidl_string& ifname,
getStaIface_cb hidl_status_cb) override;
+ Return<void> removeStaIface(const hidl_string& ifname,
+ removeStaIface_cb hidl_status_cb) override;
Return<void> createRttController(
const sp<IWifiIface>& bound_iface,
createRttController_cb hidl_status_cb) override;
@@ -131,19 +139,23 @@
std::pair<WifiStatus, sp<IWifiApIface>> createApIfaceInternal();
std::pair<WifiStatus, std::vector<hidl_string>> getApIfaceNamesInternal();
std::pair<WifiStatus, sp<IWifiApIface>> getApIfaceInternal(
- const hidl_string& ifname);
+ const std::string& ifname);
+ WifiStatus removeApIfaceInternal(const std::string& ifname);
std::pair<WifiStatus, sp<IWifiNanIface>> createNanIfaceInternal();
std::pair<WifiStatus, std::vector<hidl_string>> getNanIfaceNamesInternal();
std::pair<WifiStatus, sp<IWifiNanIface>> getNanIfaceInternal(
- const hidl_string& ifname);
+ const std::string& ifname);
+ WifiStatus removeNanIfaceInternal(const std::string& ifname);
std::pair<WifiStatus, sp<IWifiP2pIface>> createP2pIfaceInternal();
std::pair<WifiStatus, std::vector<hidl_string>> getP2pIfaceNamesInternal();
std::pair<WifiStatus, sp<IWifiP2pIface>> getP2pIfaceInternal(
- const hidl_string& ifname);
+ const std::string& ifname);
+ WifiStatus removeP2pIfaceInternal(const std::string& ifname);
std::pair<WifiStatus, sp<IWifiStaIface>> createStaIfaceInternal();
std::pair<WifiStatus, std::vector<hidl_string>> getStaIfaceNamesInternal();
std::pair<WifiStatus, sp<IWifiStaIface>> getStaIfaceInternal(
- const hidl_string& ifname);
+ const std::string& ifname);
+ WifiStatus removeStaIfaceInternal(const std::string& ifname);
std::pair<WifiStatus, sp<IWifiRttController>> createRttControllerInternal(
const sp<IWifiIface>& bound_iface);
std::pair<WifiStatus, std::vector<WifiDebugRingBufferStatus>>