From a056a6131b897fc30cb5588de13e7179bb532209 Mon Sep 17 00:00:00 2001 From: apatel599 Date: Thu, 4 Dec 2025 20:42:33 +0000 Subject: [PATCH] RDKB-62699:Add CSI interval parameter to JSON in consumer sample app 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 --- .../sampleapps/wifievents_consumer_sample.c | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/source/sampleapps/wifievents_consumer_sample.c b/source/sampleapps/wifievents_consumer_sample.c index 103b269b6..6b1b5f07d 100644 --- a/source/sampleapps/wifievents_consumer_sample.c +++ b/source/sampleapps/wifievents_consumer_sample.c @@ -445,6 +445,25 @@ void client_csi_data_json_elem_add(cJSON *sta_obj, wifi_csi_data_t *csi, json_add_wifi_csi_matrix_info(obj, csi); } +int get_csi_data_interval(void) +{ + if (g_csi_interval) { + return g_csi_interval; + } else { + return DEFAULT_CSI_INTERVAL; + } +} + +void add_or_update_number(cJSON *obj, const char *key, double value) +{ + cJSON *item = cJSON_GetObjectItem(obj, key); + if (item == NULL) { + cJSON_AddNumberToObject(obj, key, value); + } else { + item->valuedouble = value; + } +} + void csi_data_in_json_format(mac_address_t sta_mac, wifi_csi_data_t *csi) { if (g_num_of_samples == -1) { @@ -465,6 +484,9 @@ void csi_data_in_json_format(mac_address_t sta_mac, wifi_csi_data_t *csi) cJSON_AddItemToObject(p_csi_json_obj->main_json_obj, "CSI", p_csi_json_obj->json_csi_obj); } + add_or_update_number(p_csi_json_obj->json_csi_obj, "csi_sampling_interval_ms", + get_csi_data_interval()); + if (p_csi_json_obj->json_sounding_devices == NULL) { p_csi_json_obj->json_sounding_devices = cJSON_CreateArray(); VERIFY_NULL_CHECK(p_csi_json_obj->json_sounding_devices);