From 87dae5d1cf920b79248b53f1e98c3a98483c04c0 Mon Sep 17 00:00:00 2001 From: Suvendhu Hansa Date: Thu, 7 Dec 2023 13:16:43 +0000 Subject: [PATCH] =?UTF-8?q?Support=20more=20than=20255=20results=20in=20Ne?= =?UTF-8?q?ighboringWiFiDiagnostic=E2=80=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libbbfdm/dmtree/tr181/wifi.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/libbbfdm/dmtree/tr181/wifi.c b/libbbfdm/dmtree/tr181/wifi.c index 0b499605..749261cb 100644 --- a/libbbfdm/dmtree/tr181/wifi.c +++ b/libbbfdm/dmtree/tr181/wifi.c @@ -3533,7 +3533,7 @@ static int operate_WiFi_NeighboringWiFiDiagnostic(char *refparam, struct dmctx * if (res) { json_object *radios = NULL, *arrobj = NULL; int i = 0; - uint8_t index = 1; + uint32_t index = 1; dmjson_foreach_obj_in_array(res, arrobj, radios, i, 1, "radios") { json_object *scan_res = NULL, *obj = NULL; @@ -3554,6 +3554,15 @@ static int operate_WiFi_NeighboringWiFiDiagnostic(char *refparam, struct dmctx * if (!DM_STRLEN(radio_name)) continue; + char *isup = dmjson_get_value(radios, 1, "isup"); + if (!DM_STRLEN(isup)) + continue; + + bool ifup = false; + string_to_bool(isup, &ifup); + if (!ifup) + continue; + snprintf(object, sizeof(object), "wifi.radio.%s", radio_name); adm_entry_get_reference_param(ctx, "Device.WiFi.Radio.*.Name", radio_name, &radio[1]); @@ -3577,8 +3586,10 @@ static int operate_WiFi_NeighboringWiFiDiagnostic(char *refparam, struct dmctx * if (!json_object_object_get_ex(scan_res,"accesspoints", &obj)) continue; - uint8_t len = obj ? json_object_array_length(obj) : 0; - for (uint8_t j = 0; j < len; j++ ) { + uint32_t len = obj ? json_object_array_length(obj) : 0; + for (uint32_t j = 0; j < len; j++ ) { + if (index == 0) + break; json_object *array_obj = json_object_array_get_idx(obj, j); ssid[1] = dmjson_get_value(array_obj, 1, "ssid");