Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Commit

Permalink
get supported_channels and sent to son_slave
Browse files Browse the repository at this point in the history
  • Loading branch information
itayx committed Apr 1, 2020
1 parent 7d562e4 commit f2aaf0b
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion agent/src/beerocks/slave/ap_manager_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,27 @@ get_radio_supported_channels_string(std::shared_ptr<bwl::ap_wlan_hal> &ap_wlan_h
return os.str();
}

static std::string
get_radio_supported_channels_string(beerocks::message::sWifiChannel supported_channels[])
{
std::ostringstream os;
for (uint i = 0;
i < beerocks::message::SUPPORTED_CHANNELS_LENGTH && supported_channels[i].channel != 0;
i++) {
auto val = supported_channels[i];
if (val.channel > 0) {
os << " ch = " << int(val.channel) << " |"
<< " tx_pow = " << int(val.tx_pow) << " |"
<< " bandwidth = " << int(val.channel_bandwidth) << " |"
<< " dfs = " << int(val.is_dfs_channel) << " |"
<< " noise = " << int(val.noise) << " [dbm] |"
<< " bss_overlap = " << int(val.bss_overlap) << std::endl;
}
}

return os.str();
}

static void
copy_vaps_info(std::shared_ptr<bwl::ap_wlan_hal> &ap_wlan_hal,
std::list<son::ap_manager_thread::backhaul_vap_list_element_t> &backhaul_vaps_list,
Expand Down Expand Up @@ -1450,6 +1471,11 @@ void ap_manager_thread::handle_hostapd_attached()
{
LOG(DEBUG) << "handling enabled hostapd";

ap_wlan_hal->read_supported_channels();
beerocks::message::sWifiChannel
hw_supported_channels[beerocks::message::SUPPORTED_CHANNELS_LENGTH];
copy_radio_supported_channels(ap_wlan_hal, hw_supported_channels);

if (acs_enabled) {
LOG(DEBUG) << "retrieving ACS report";
int read_acs_attempt = 0;
Expand Down Expand Up @@ -1498,6 +1524,15 @@ void ap_manager_thread::handle_hostapd_attached()
// Copy the channels supported by the AP
copy_radio_supported_channels(ap_wlan_hal, notification->params().supported_channels);

auto supported_channels_list = &std::get<1>(notification->supported_channels_list(0));
for (uint i = 0;
i < beerocks::message::SUPPORTED_CHANNELS_LENGTH && hw_supported_channels[i].channel != 0;
i++) {
if (hw_supported_channels[i].channel == 0)
continue;
supported_channels_list[i] = hw_supported_channels[i];
}

LOG(INFO) << "send ACTION_APMANAGER_JOINED_NOTIFICATION";
LOG(INFO) << " mac = " << ap_wlan_hal->get_radio_mac();
LOG(INFO) << " ant_num = " << ap_wlan_hal->get_radio_info().ant_num;
Expand All @@ -1507,7 +1542,9 @@ void ap_manager_thread::handle_hostapd_attached()
LOG(INFO) << " current bw = " << ap_wlan_hal->get_radio_info().bandwidth;
LOG(INFO) << " supported_channels = " << std::endl
<< get_radio_supported_channels_string(ap_wlan_hal);

LOG(INFO) << " hw_supported_channels = " << std::endl
<< get_radio_supported_channels_string(
&std::get<1>(notification->supported_channels_list(0)));
// Send CMDU
message_com::send_cmdu(slave_socket, cmdu_tx);
}
Expand Down

0 comments on commit f2aaf0b

Please sign in to comment.