Support 6GHz band for getAvailableChannels() API
This commit adds support for 6GHz band for providing a list of available channels for a specific band. This is used by the system API getAvailableChannels(). Bug: 139354972 Test: Manual Test: ./system/connectivity/wificon/runtests.sh Change-Id: I99c03015b59867e2690477962726d599eeb51c0b
This commit is contained in:
parent
0d4fb9a931
commit
f9bd54d9ad
|
@ -59,6 +59,10 @@ interface IWificond {
|
|||
// Returrns null on failure.
|
||||
@nullable int[] getAvailableDFSChannels();
|
||||
|
||||
// Returns an array of available frequencies for 6GHz channels.
|
||||
// Returrns null on failure.
|
||||
@nullable int[] getAvailable6gChannels();
|
||||
|
||||
// Register a callback to receive interface status updates.
|
||||
//
|
||||
// Multiple callbacks can be registered simultaneously.
|
||||
|
|
|
@ -54,6 +54,9 @@ uint32_t k5GHzFrequencyLowerBound = 5000;
|
|||
// for "vehicular communication systems".
|
||||
uint32_t k5GHzFrequencyUpperBound = 5850;
|
||||
|
||||
uint32_t k6GHzFrequencyLowerBound = 5925;
|
||||
uint32_t k6GHzFrequencyUpperBound = 7125;
|
||||
|
||||
bool IsExtFeatureFlagSet(
|
||||
const std::vector<uint8_t>& ext_feature_flags_bytes,
|
||||
enum nl80211_ext_feature_index ext_feature_flag) {
|
||||
|
@ -419,6 +422,7 @@ bool NetlinkUtils::ParseBandInfo(const NL80211Packet* const packet,
|
|||
vector<uint32_t> frequencies_2g;
|
||||
vector<uint32_t> frequencies_5g;
|
||||
vector<uint32_t> frequencies_dfs;
|
||||
vector<uint32_t> frequencies_6g;
|
||||
for (unsigned int band_index = 0; band_index < bands.size(); band_index++) {
|
||||
NL80211NestedAttr freqs_attr(0);
|
||||
if (!bands[band_index].GetAttribute(NL80211_BAND_ATTR_FREQS, &freqs_attr)) {
|
||||
|
@ -466,11 +470,13 @@ bool NetlinkUtils::ParseBandInfo(const NL80211Packet* const packet,
|
|||
|
||||
// Otherwise, this is a regular 5g frequency.
|
||||
frequencies_5g.push_back(frequency_value);
|
||||
} else if (frequency_value > k6GHzFrequencyLowerBound &&
|
||||
frequency_value < k6GHzFrequencyUpperBound) {
|
||||
frequencies_6g.push_back(frequency_value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
*out_band_info = BandInfo(frequencies_2g, frequencies_5g, frequencies_dfs);
|
||||
*out_band_info = BandInfo(frequencies_2g, frequencies_5g, frequencies_dfs, frequencies_6g);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,16 +52,20 @@ struct BandInfo {
|
|||
BandInfo() = default;
|
||||
BandInfo(std::vector<uint32_t>& band_2g_,
|
||||
std::vector<uint32_t>& band_5g_,
|
||||
std::vector<uint32_t>& band_dfs_)
|
||||
std::vector<uint32_t>& band_dfs_,
|
||||
std::vector<uint32_t>& band_6g_)
|
||||
: band_2g(band_2g_),
|
||||
band_5g(band_5g_),
|
||||
band_dfs(band_dfs_) {}
|
||||
band_dfs(band_dfs_),
|
||||
band_6g(band_6g_){}
|
||||
// Frequencies for 2.4 GHz band.
|
||||
std::vector<uint32_t> band_2g;
|
||||
// Frequencies for 5 GHz band without DFS.
|
||||
std::vector<uint32_t> band_5g;
|
||||
// Frequencies for DFS.
|
||||
std::vector<uint32_t> band_dfs;
|
||||
// Frequencies for 6 GHz band.
|
||||
std::vector<uint32_t> band_6g;
|
||||
};
|
||||
|
||||
struct ScanCapabilities {
|
||||
|
|
24
server.cpp
24
server.cpp
|
@ -296,6 +296,25 @@ Status Server::getAvailableDFSChannels(
|
|||
return Status::ok();
|
||||
}
|
||||
|
||||
Status Server::getAvailable6gChannels(
|
||||
std::unique_ptr<vector<int32_t>>* out_frequencies) {
|
||||
BandInfo band_info;
|
||||
ScanCapabilities scan_capabilities_ignored;
|
||||
WiphyFeatures wiphy_features_ignored;
|
||||
|
||||
if (!netlink_utils_->GetWiphyInfo(wiphy_index_, &band_info,
|
||||
&scan_capabilities_ignored,
|
||||
&wiphy_features_ignored)) {
|
||||
LOG(ERROR) << "Failed to get wiphy info from kernel";
|
||||
out_frequencies->reset(nullptr);
|
||||
return Status::ok();
|
||||
}
|
||||
|
||||
out_frequencies->reset(
|
||||
new vector<int32_t>(band_info.band_6g.begin(), band_info.band_6g.end()));
|
||||
return Status::ok();
|
||||
}
|
||||
|
||||
bool Server::SetupInterface(const std::string& iface_name,
|
||||
InterfaceInfo* interface) {
|
||||
if (!RefreshWiphyIndex(iface_name)) {
|
||||
|
@ -368,6 +387,11 @@ void Server::LogSupportedBands() {
|
|||
ss << " " << band_info.band_dfs[i];
|
||||
}
|
||||
LOG(INFO) << "5Ghz DFS frequencies:"<< ss.str();
|
||||
|
||||
for (unsigned int i = 0; i < band_info.band_6g.size(); i++) {
|
||||
ss << " " << band_info.band_6g[i];
|
||||
}
|
||||
LOG(INFO) << "6Ghz frequencies:"<< ss.str();
|
||||
}
|
||||
|
||||
void Server::BroadcastClientInterfaceReady(
|
||||
|
|
3
server.h
3
server.h
|
@ -63,6 +63,9 @@ class Server : public android::net::wifi::BnWificond {
|
|||
// Returns a vector of available frequencies for DFS channels.
|
||||
android::binder::Status getAvailableDFSChannels(
|
||||
::std::unique_ptr<::std::vector<int32_t>>* out_frequencies) override;
|
||||
// Returns a vector of available frequencies for 6GHz channels.
|
||||
android::binder::Status getAvailable6gChannels(
|
||||
::std::unique_ptr<::std::vector<int32_t>>* out_frequencies) override;
|
||||
|
||||
android::binder::Status createApInterface(
|
||||
const std::string& iface_name,
|
||||
|
|
Loading…
Reference in New Issue