-
Notifications
You must be signed in to change notification settings - Fork 139
RDKB-62699: Add CSI interval parameter to JSON in consumer sample app #867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
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
There was a problem hiding this 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 thecsi_sampling_interval_msfield 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; |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
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.
| 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 |
a90a6da to
d57591b
Compare
Reason for change: Added support for the CSI interval parameter by including
it in the JSON used in the consumer sample app.
Test Procedure:
Risks: Low
Priority: P1
Signed-off-by: apatel599@cable.comcast.com