diff --git a/wifi/1.0/IWifiChip.hal b/wifi/1.0/IWifiChip.hal index 3c085c345c..051a08859c 100644 --- a/wifi/1.0/IWifiChip.hal +++ b/wifi/1.0/IWifiChip.hal @@ -323,12 +323,27 @@ interface IWifiChip { * @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. * @@ -368,12 +383,27 @@ interface IWifiChip { * @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. * @@ -413,12 +443,27 @@ interface IWifiChip { * @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. * @@ -458,12 +503,27 @@ interface IWifiChip { * @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. * diff --git a/wifi/1.0/default/wifi_chip.cpp b/wifi/1.0/default/wifi_chip.cpp index af194912a3..d70f548783 100644 --- a/wifi/1.0/default/wifi_chip.cpp +++ b/wifi/1.0/default/wifi_chip.cpp @@ -163,6 +163,15 @@ Return WifiChip::getApIface(const hidl_string& ifname, ifname); } +Return 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 WifiChip::createNanIface(createNanIface_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, @@ -186,6 +195,15 @@ Return WifiChip::getNanIface(const hidl_string& ifname, ifname); } +Return 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 WifiChip::createP2pIface(createP2pIface_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, @@ -209,6 +227,15 @@ Return WifiChip::getP2pIface(const hidl_string& ifname, ifname); } +Return 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 WifiChip::createStaIface(createStaIface_cb hidl_status_cb) { return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, @@ -232,6 +259,15 @@ Return WifiChip::getStaIface(const hidl_string& ifname, ifname); } +Return 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 WifiChip::createRttController( const sp& bound_iface, createRttController_cb hidl_status_cb) { return validateAndCall(this, @@ -483,14 +519,21 @@ WifiChip::getApIfaceNamesInternal() { } std::pair> 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> 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 @@ WifiChip::getNanIfaceNamesInternal() { } std::pair> 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> 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 @@ WifiChip::getP2pIfaceNamesInternal() { } std::pair> 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> WifiChip::createStaIfaceInternal() { if (current_mode_id_ != kStaChipModeId || sta_iface_.get()) { return {createWifiStatus(WifiStatusCode::ERROR_NOT_AVAILABLE), {}}; @@ -568,14 +625,21 @@ WifiChip::getStaIfaceNamesInternal() { } std::pair> 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> WifiChip::createRttControllerInternal(const sp& bound_iface) { sp 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 764445fabb..5e7a0c37c9 100644 --- a/wifi/1.0/default/wifi_chip.h +++ b/wifi/1.0/default/wifi_chip.h @@ -83,18 +83,26 @@ class WifiChip : public IWifiChip { Return getApIfaceNames(getApIfaceNames_cb hidl_status_cb) override; Return getApIface(const hidl_string& ifname, getApIface_cb hidl_status_cb) override; + Return removeApIface(const hidl_string& ifname, + removeApIface_cb hidl_status_cb) override; Return createNanIface(createNanIface_cb hidl_status_cb) override; Return getNanIfaceNames(getNanIfaceNames_cb hidl_status_cb) override; Return getNanIface(const hidl_string& ifname, getNanIface_cb hidl_status_cb) override; + Return removeNanIface(const hidl_string& ifname, + removeNanIface_cb hidl_status_cb) override; Return createP2pIface(createP2pIface_cb hidl_status_cb) override; Return getP2pIfaceNames(getP2pIfaceNames_cb hidl_status_cb) override; Return getP2pIface(const hidl_string& ifname, getP2pIface_cb hidl_status_cb) override; + Return removeP2pIface(const hidl_string& ifname, + removeP2pIface_cb hidl_status_cb) override; Return createStaIface(createStaIface_cb hidl_status_cb) override; Return getStaIfaceNames(getStaIfaceNames_cb hidl_status_cb) override; Return getStaIface(const hidl_string& ifname, getStaIface_cb hidl_status_cb) override; + Return removeStaIface(const hidl_string& ifname, + removeStaIface_cb hidl_status_cb) override; Return createRttController( const sp& bound_iface, createRttController_cb hidl_status_cb) override; @@ -131,19 +139,23 @@ class WifiChip : public IWifiChip { std::pair> createApIfaceInternal(); std::pair> getApIfaceNamesInternal(); std::pair> getApIfaceInternal( - const hidl_string& ifname); + const std::string& ifname); + WifiStatus removeApIfaceInternal(const std::string& ifname); std::pair> createNanIfaceInternal(); std::pair> getNanIfaceNamesInternal(); std::pair> getNanIfaceInternal( - const hidl_string& ifname); + const std::string& ifname); + WifiStatus removeNanIfaceInternal(const std::string& ifname); std::pair> createP2pIfaceInternal(); std::pair> getP2pIfaceNamesInternal(); std::pair> getP2pIfaceInternal( - const hidl_string& ifname); + const std::string& ifname); + WifiStatus removeP2pIfaceInternal(const std::string& ifname); std::pair> createStaIfaceInternal(); std::pair> getStaIfaceNamesInternal(); std::pair> getStaIfaceInternal( - const hidl_string& ifname); + const std::string& ifname); + WifiStatus removeStaIfaceInternal(const std::string& ifname); std::pair> createRttControllerInternal( const sp& bound_iface); std::pair>