Skip to content

RDKBWIFI-442: Beacon measurements collection from the associated STA#1130

Open
Nikita-Hakai wants to merge 7 commits into
rdkcentral:developfrom
Nikita-Hakai:beacon_metrics
Open

RDKBWIFI-442: Beacon measurements collection from the associated STA#1130
Nikita-Hakai wants to merge 7 commits into
rdkcentral:developfrom
Nikita-Hakai:beacon_metrics

Conversation

@Nikita-Hakai

@Nikita-Hakai Nikita-Hakai commented May 13, 2026

Copy link
Copy Markdown
Contributor

Collection of Beacon measurement report from the associated STA

@github-actions github-actions Bot added the community contribution Contributions from community. label May 13, 2026
@Nikita-Hakai Nikita-Hakai force-pushed the beacon_metrics branch 3 times, most recently from 5f0c136 to c5ac862 Compare May 14, 2026 17:27
@Nikita-Hakai Nikita-Hakai marked this pull request as ready for review May 14, 2026 18:00
@Nikita-Hakai Nikita-Hakai requested a review from a team as a code owner May 14, 2026 18:00
Copilot AI review requested due to automatic review settings May 14, 2026 18:00

Copilot AI left a comment

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.

Pull request overview

Adds EasyMesh beacon-query/report plumbing so the EM app can request beacon measurements from associated STAs, process RRM measurement reports, encode/decode beacon report payloads, and translate them into EasyMesh STA info.

Changes:

  • Adds Device.WiFi.EM.BeaconQuery handling and RRM action-frame send/receive paths.
  • Changes beacon report payload storage from a fixed array to dynamically allocated data.
  • Updates beacon report encoding/decoding and EasyMesh translation logic.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
source/webconfig/wifi_webconfig_beacon_report.c Frees prior dynamic beacon report data before decoding a new report.
source/webconfig/wifi_encoder.c Dynamically allocates the hex string used to encode report data.
source/webconfig/wifi_easymesh_translator.c Finds BSS by vap_index and copies beacon report data into EasyMesh STA info.
source/webconfig/wifi_decoder.c Allocates beacon report data from decoded FrameLen and decodes hex report data.
source/core/wifi_ctrl.c Routes radio measurement action frames to the beacon report event subtype.
source/apps/em/wifi_em.h Adds beacon query namespace and EM data fields.
source/apps/em/wifi_em.c Adds beacon query sending, RRM beacon report parsing/publishing, and bus registration.
include/wifi_base.h Adds beacon query params and changes beacon report data to a pointer.
Comments suppressed due to low confidence (4)

source/apps/em/wifi_em.c:935

  • The HAL result is ignored. If wifi_hal_setRMBeaconRequest fails, the function still logs a dialog token and returns success, so the controller gets no indication that the beacon request was not transmitted.
    wifi_hal_setRMBeaconRequest(ap_index, query->sta_mac, params, &out_dialog);
    wifi_util_dbg_print(WIFI_EM, "%s:%d: dialogue token is %d\n", __func__, __LINE__, out_dialog);

source/webconfig/wifi_decoder.c:6284

  • This new allocation is not released by the generic webconfig_data_free cleanup path, which currently only frees u.encoded.raw. Successful beacon-report decodes will therefore leak the report buffer unless this ownership is added to cleanup or freed after translation.
    sta_data->data = (unsigned char *)malloc(sta_data->data_len);
    if (sta_data->data == NULL) {
        wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: failed to allocate %u bytes for report data\n",
            __func__, __LINE__, sta_data->data_len);
        return webconfig_error_decode;

source/webconfig/wifi_decoder.c:6287

  • If ReportData is missing or invalid, decode_param_string returns immediately from the function and bypasses the free for sta_data->data, leaking the buffer allocated above.
    decode_param_string(obj_sta_cfg, "ReportData", param);

source/webconfig/wifi_decoder.c:6289

  • stringtohex only checks that the output buffer is large enough for the input string; it does not require ReportData to contain exactly FrameLen * 2 hex characters. With the new malloc'd buffer, a short hex string leaves the remaining bytes uninitialized and those bytes can be forwarded/encoded as part of the report.
    out_ptr = stringtohex(strlen(param->valuestring), param->valuestring, sta_data->data_len,
        sta_data->data);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/apps/em/wifi_em.c Outdated
Comment thread source/apps/em/wifi_em.c
Comment thread source/apps/em/wifi_em.c
Comment thread source/apps/em/wifi_em.c Outdated
Comment thread source/webconfig/wifi_decoder.c
@Nikita-Hakai Nikita-Hakai changed the title Beacon metrics RDKBWIFI-442: Beacon measurements collection from the associated STA May 14, 2026

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 9 comments.

Comment thread source/webconfig/wifi_decoder.c
Comment thread source/webconfig/wifi_decoder.c Outdated
Comment thread source/webconfig/wifi_encoder.c Outdated
Comment thread source/webconfig/wifi_webconfig_beacon_report.c
Comment thread source/apps/em/wifi_em.c Outdated
Comment thread source/apps/em/wifi_em.c Outdated
Comment thread source/apps/em/wifi_em.c
Comment thread source/apps/em/wifi_em.c
Comment thread source/apps/em/wifi_em.c
Copilot AI review requested due to automatic review settings June 22, 2026 23:01

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Comment thread include/wifi_base.h
Comment thread source/apps/em/wifi_em.c
Comment thread source/webconfig/wifi_decoder.c Outdated
Copilot AI review requested due to automatic review settings June 25, 2026 23:36

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread source/apps/em/wifi_em.c
Comment on lines +3386 to +3391
if (p_data->data_type != bus_data_type_bytes) {
wifi_util_error_print(WIFI_EM, "%s:%d: Invalid Received:%s data type:%x\n",

__func__, __LINE__, event_name, p_data->data_type);
return bus_error_invalid_input;
}
Comment thread source/apps/em/wifi_em.c
Comment on lines +2914 to 2919
free(wb_data->u.decoded.sta_beacon_report.data);
wb_data->u.decoded.sta_beacon_report.data = NULL;

memset(&p_data, 0, sizeof(raw_data_t));

p_data.data_type = bus_data_type_string;
Copilot AI review requested due to automatic review settings July 3, 2026 07:54

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Comment thread source/apps/em/wifi_em.c
Comment on lines +3528 to +3533
//now create map for response and send
if (em_send_action_frame(p_data->raw_data.bytes) != RETURN_OK) {
wifi_util_error_print(WIFI_EM, "%s:%d: Failed to send beacon query action frame\n",
__func__, __LINE__);
return bus_error_general;
}
Comment thread source/apps/em/wifi_em.c
Comment on lines +3500 to +3505
static bus_error_t send_beacon_query(char *event_name, raw_data_t *p_data, void *userData)
{
if (strcmp(event_name, WIFI_EM_BEACON_QUERY) != 0) {
wifi_util_error_print(WIFI_EM, "%s:%d Not EasyMesh beacon query event, %s\n", __func__, __LINE__, event_name);
return bus_error_invalid_namespace;
}
Comment thread source/apps/em/wifi_em.c
Comment on lines +3029 to 3034
free(wb_data->u.decoded.sta_beacon_report.data);
wb_data->u.decoded.sta_beacon_report.data = NULL;

memset(&p_data, 0, sizeof(raw_data_t));

p_data.data_type = bus_data_type_string;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community contribution Contributions from community.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants