diff options
Diffstat (limited to 'wifi/1.5/default/wifi_chip.cpp')
-rw-r--r-- | wifi/1.5/default/wifi_chip.cpp | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/wifi/1.5/default/wifi_chip.cpp b/wifi/1.5/default/wifi_chip.cpp index f3d20c8f19..f7c21639f6 100644 --- a/wifi/1.5/default/wifi_chip.cpp +++ b/wifi/1.5/default/wifi_chip.cpp @@ -739,6 +739,14 @@ Return<void> WifiChip::setCountryCode(const hidl_array<int8_t, 2>& code, code); } +Return<void> WifiChip::getUsableChannels( + WifiBand band, hidl_bitfield<WifiIfaceMode> ifaceModeMask, + getUsableChannels_cb _hidl_cb) { + return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::getUsableChannelsInternal, _hidl_cb, band, + ifaceModeMask); +} + void WifiChip::QcRemoveAndClearDynamicIfaces() { for (const auto& iface : created_ap_ifaces_) { std::string ifname = iface->getName(); @@ -1075,7 +1083,6 @@ WifiStatus WifiChip::removeApIfaceInternal(const std::string& ifname) { WifiStatus WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal( const std::string& ifname, const std::string& ifInstanceName) { - legacy_hal::wifi_error legacy_status; const auto iface = findUsingName(ap_ifaces_, ifname); if (!iface.get() || ifInstanceName.empty()) { return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS); @@ -1087,13 +1094,13 @@ WifiStatus WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal( if (iface == ifInstanceName) { if (!iface_util_.lock()->removeIfaceFromBridge(it.first, iface)) { - LOG(ERROR) << "Failed to remove interface: " << iface - << " from " << ifname << ", error: " - << legacyErrorToString(legacy_status); + LOG(ERROR) + << "Failed to remove interface: " << ifInstanceName + << " from " << ifname; return createWifiStatus( WifiStatusCode::ERROR_NOT_AVAILABLE); } - legacy_status = + legacy_hal::wifi_error legacy_status = legacy_hal_.lock()->deleteVirtualInterface(iface); if (legacy_status != legacy_hal::WIFI_SUCCESS) { LOG(ERROR) << "Failed to del interface: " << iface @@ -1106,6 +1113,7 @@ WifiStatus WifiChip::removeIfaceInstanceFromBridgedApIfaceInternal( } } br_ifaces_ap_instances_.erase(ifInstanceName); + iface->removeInstance(ifInstanceName); return createWifiStatus(WifiStatusCode::SUCCESS); } @@ -1538,6 +1546,25 @@ WifiStatus WifiChip::setCountryCodeInternal(const std::array<int8_t, 2>& code) { return createWifiStatusFromLegacyError(legacy_status); } +std::pair<WifiStatus, std::vector<WifiUsableChannel>> +WifiChip::getUsableChannelsInternal(WifiBand band, uint32_t ifaceModeMask) { + legacy_hal::wifi_error legacy_status; + std::vector<legacy_hal::wifi_usable_channel> legacy_usable_channels; + std::tie(legacy_status, legacy_usable_channels) = + legacy_hal_.lock()->getUsableChannels( + hidl_struct_util::convertHidlWifiBandToLegacyMacBand(band), + hidl_struct_util::convertHidlWifiIfaceModeToLegacy(ifaceModeMask)); + if (legacy_status != legacy_hal::WIFI_SUCCESS) { + return {createWifiStatusFromLegacyError(legacy_status), {}}; + } + std::vector<WifiUsableChannel> hidl_usable_channels; + if (!hidl_struct_util::convertLegacyWifiUsableChannelsToHidl( + legacy_usable_channels, &hidl_usable_channels)) { + return {createWifiStatus(WifiStatusCode::ERROR_UNKNOWN), {}}; + } + return {createWifiStatus(WifiStatusCode::SUCCESS), hidl_usable_channels}; +} + WifiStatus WifiChip::handleChipConfiguration( /* NONNULL */ std::unique_lock<std::recursive_mutex>* lock, ChipModeId mode_id) { |