Skip to content

RDKB-62699: Add CSI interval parameter to JSON in consumer sample app#867

Open
narendradandu wants to merge 2 commits intordkcentral:developfrom
Aniket0606:csi_raw_hex_data
Open

RDKB-62699: Add CSI interval parameter to JSON in consumer sample app#867
narendradandu wants to merge 2 commits intordkcentral:developfrom
Aniket0606:csi_raw_hex_data

Conversation

@narendradandu
Copy link
Contributor

Reason for change: Added support for the CSI interval parameter by including
it in the JSON used in the consumer sample app.
Test Procedure:

  1. Load the OneWifi build.
  2. Start the consumer sample app with the CSI interval parameter. 3) Capture packets while the app is running.
  3. Stop the consumer sample app.
  4. Verify that a JSON file (csi_samples.json) is generated containing the captured CSI data.

Risks: Low
Priority: P1

Signed-off-by: apatel599@cable.comcast.com

Reason for change: Added support for the CSI interval parameter by including
                   it in the JSON used in the consumer sample app.
Test Procedure:
1) Load the OneWifi build.
2) Start the consumer sample app with the CSI interval parameter.
3) Capture packets while the app is running.
4) Stop the consumer sample app.
5) Verify that a JSON file (csi_samples.json) is generated containing the captured CSI data.

Risks: Low
Priority: P1

Signed-off-by: apatel599@cable.comcast.com
Copilot AI review requested due to automatic review settings January 29, 2026 18:15
@narendradandu narendradandu requested a review from a team as a code owner January 29, 2026 18:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds support for including the CSI (Channel State Information) sampling interval parameter in the JSON output generated by the consumer sample app. The change enables the JSON file to capture the configured sampling interval alongside the CSI data samples.

Changes:

  • Added get_csi_data_interval() helper function to retrieve the CSI interval from global variable or default value
  • Added add_or_update_number() utility function to add or update numeric fields in cJSON objects
  • Modified csi_data_in_json_format() to include the csi_sampling_interval_ms field in the JSON output

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

if (item == NULL) {
cJSON_AddNumberToObject(obj, key, value);
} else {
item->valuedouble = value;
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

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

The add_or_update_number function directly modifies the valuedouble field of a cJSON item. While this works, it's safer to use the standard cJSON API pattern. Consider using cJSON_ReplaceItemInObject to replace the existing item with a new number object, which is the pattern consistently used throughout the codebase (see source/dml/tr_181/sbapi/cosa_wifi_apis.c:1664 and source/platform/common/data_model/wifi_dml_api.c:1815). Alternatively, if using a modern version of cJSON, use cJSON_SetNumberValue. Also note that when directly modifying valuedouble, you should also update valueint for consistency.

Suggested change
item->valuedouble = value;
#ifdef cJSON_SetNumberValue
cJSON_SetNumberValue(item, value);
#else
cJSON *new_item = cJSON_CreateNumber(value);
if (new_item != NULL)
{
cJSON_ReplaceItemInObject(obj, key, new_item);
}
#endif

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants