Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions source/apps/em/wifi_em.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#define EM_NEIGBOUR_SCAN_PROVIDER_DELAY_SEC 5 // 5 Seconds
#define EM_NEIGBOUR_SCAN_INTERVAL_MSEC 60000 // 60 Seconds
#define EM_DEF_LINK_METRICS_COLLECT_INTERVAL_MSEC 10000 // 10 Seconds
#define EM_BSS_COLOR_DEFAULT 0x3F
#define EM_SCAN_TYPE_ACTIVE 1

static bool is_monitor_done = false;

Expand Down Expand Up @@ -645,6 +647,7 @@ static int em_prepare_scan_response_data(wifi_provider_response_t *provider_resp
wifi_neighbor_ap2_t *wifi_scan_data = NULL;
radio_interface_mapping_t *radio_iface_map = NULL;
char time_str[32] = { 0 };
int dwell_time = provider_response->args.dwell_time;

wifi_mgr_t *wifi_mgr = get_wifimgr_obj();
wifi_platform_property_t *wifi_prop = &wifi_mgr->hal_cap.wifi_prop;
Expand Down Expand Up @@ -744,17 +747,32 @@ static int em_prepare_scan_response_data(wifi_provider_response_t *provider_resp
neighbor->signal_strength = src->ap_SignalStrength;
strncpy(neighbor->channel_bandwidth, src->ap_OperatingChannelBandwidth,
EM_MAX_CHANNEL_BW_LEN);
neighbor->channel_utilization = src->ap_ChannelUtilization;
neighbor->bss_load_element_present = 0;
neighbor->bss_color = 0;
neighbor->bss_color = EM_BSS_COLOR_DEFAULT;
neighbor->bss_load_element_present = 0;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Address indentation


/* Initialize to defaults to avoid stale/uninitialized data */
neighbor->channel_utilization = 0;
neighbor->station_count = 0;
Comment on lines +750 to 755
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These newly added lines introduce tab-based indentation (and some trailing whitespace), while the surrounding code uses spaces. Please normalize indentation to match the file’s existing style to keep diffs clean and avoid mixed-indentation issues.

Copilot uses AI. Check for mistakes.

/*
* Populate channel utilization, Station count
* only if the bss load element is present.
*/
if (src->bss_load_element_present) {
neighbor->bss_load_element_present = src->bss_load_element_present;
neighbor->channel_utilization = src->ap_ChannelUtilization;
neighbor->station_count = src->ap_StaCount;
}
res->num_neighbors++;
wifi_util_dbg_print(WIFI_EM, "%s:%d BSSID: %s SSID: %s\n", __func__, __LINE__,
src->ap_BSSID, src->ap_SSID);
wifi_util_dbg_print(WIFI_EM, "bss_color 0x%x ch_util %d bss_element_presnt %d sta_cnt %d for BSSID: %s SSID: %s\n",
neighbor->bss_color, neighbor->channel_utilization, neighbor->bss_load_element_present,
neighbor->station_count, src->ap_BSSID, src->ap_SSID);
} else {
wifi_util_error_print(WIFI_EM, "%s:%d : Maximum number of neighbors reached.\n",
__func__, __LINE__);
}
res->aggregate_scan_duration = dwell_time;
res->scan_type = EM_SCAN_TYPE_ACTIVE;
}
wifi_util_dbg_print(WIFI_EM, "%s:%d Scan results updated for radio mac : %s\n", __func__,
__LINE__, to_mac_str(radio_mac, mac_str));
Expand Down
2 changes: 2 additions & 0 deletions source/stats/wifi_stats_radio_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,8 @@ int execute_radio_channel_api(wifi_mon_collector_element_t *c_elem, wifi_monitor
}
}

args->dwell_time = dwell_time;

Comment on lines +1063 to +1064
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

args->dwell_time is updated here, but provider responses copy wifi_mon_stats_args_t from provider_elem->mon_stats_config->args (see source/stats/wifi_monitor.c:4656), not from the collector args. As a result, consumers like EasyMesh will still see the original configured dwell time (or even an uninitialized value on the collect-stats path) and AggregateScanDuration can remain incorrect. Consider also propagating the computed dwell_time into each provider element’s mon_stats_config->args.dwell_time (or explicitly setting collect_stats->args.dwell_time when building the event payload).

Copilot uses AI. Check for mistakes.
int buffer_size = sizeof(char) * num_channels * 5;
channel_buff = (char *)malloc(buffer_size);
if (channel_buff != NULL) {
Expand Down
20 changes: 15 additions & 5 deletions source/webconfig/wifi_easymesh_translator.c
Original file line number Diff line number Diff line change
Expand Up @@ -2515,8 +2515,8 @@ webconfig_error_t translate_channel_stats_to_easymesh_channel_info(webconfig_sub
em_scan_result.util = src->utilization;
em_scan_result.noise = src->noise;
em_scan_result.num_neighbors = src->num_neighbors;
em_scan_result.aggr_scan_duration = 0;
em_scan_result.scan_type = 0;
em_scan_result.aggr_scan_duration = src->aggregate_scan_duration;
em_scan_result.scan_type = src->scan_type;

for (j = 0; j < src->num_neighbors && j < EM_MAX_NEIGHBORS; j++) {
neighbor_bss_t *src_neighbor = &src->neighbors[j];
Expand All @@ -2536,9 +2536,19 @@ webconfig_error_t translate_channel_stats_to_easymesh_channel_info(webconfig_sub
} else if (strncmp(src_neighbor->channel_bandwidth, "320", strlen("320")) == 0) {
dst_neighbor->bandwidth = WIFI_CHANNELBANDWIDTH_320MHZ;
}
dst_neighbor->bss_color = 0x8f;
dst_neighbor->channel_util = 00;
dst_neighbor->sta_count = (unsigned short)src_neighbor->station_count;
dst_neighbor->bss_color = src_neighbor->bss_color;
dst_neighbor->bss_load_element_present = src_neighbor->bss_load_element_present;
/*
* Copy BSS Load fields only if present,
* otherwise keep them zero
*/
if (src_neighbor->bss_load_element_present) {
dst_neighbor->channel_util = src_neighbor->channel_utilization;
dst_neighbor->sta_count = (unsigned short)src_neighbor->station_count;
} else {
dst_neighbor->channel_util = 0;
dst_neighbor->sta_count = 0;
}
}
count++;
proto->put_scan_results(proto->data_model, &em_scan_result);
Expand Down
Loading