Good afternoon Cezary and Oskari,
this commit is now tested as well and does output a json like this:

{
        "intrafrequency_lte_info": {
                "tracking_area_code": 14000,
                "global_cell_id": 10498829,
                "channel": 3350,
                "band": 7,
                "frequency": 2600,
                "duplex": "FDD",
                "serving_cell_id": 460,
                "cells": [
                        {
                                "physical_cell_id": 460,
                                "rsrq": -9.900000,
                                "rsrp": -99.800000,
                                "rssi": -71.600000
                        },
                        {
                                "physical_cell_id": 17,
                                "rsrq": -14.100000,
                                "rsrp": -104.700000,
                                "rssi": -81.600000
                        },
                        {
                                "physical_cell_id": 445,
                                "rsrq": -14.400000,
                                "rsrp": -104.800000,
                                "rssi": -81.500000
                        },
                        {
                                "physical_cell_id": 43,
                                "rsrq": -19.100000,
                                "rsrp": -109.900000,
                                "rssi": -81.700000
                        }
                ]
        }
}

Let me know if this does solve the problem, if one of you found time to test it or if you have other broken json outputs for this subcommand.

Thanks so far
Jan-Niklas


On 3/7/22 13:25, Jan-Niklas Burfeind wrote:
Disclaimer: This particular commit compiled, but has not been tested yet.

On 3/7/22 13:14, Jan-Niklas Burfeind wrote:
Output the cells from --get-cell-location-info in an array "cells".

Signed-off-by: Jan-Niklas Burfeind <[email protected]>
---
Hey Oskari,
I think you original author would be you?
Have you got any suggestions how to name the cells array, or whether there's a cleaner way to fix the json output thats more how you intended it to be in the first place?

Thanks
Aiyion

  commands-nas.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/commands-nas.c b/commands-nas.c
index ff7a6c3..4b86304 100644
--- a/commands-nas.c
+++ b/commands-nas.c
@@ -708,7 +708,7 @@ static void
  cmd_nas_get_cell_location_info_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg)
  {
      struct qmi_nas_get_cell_location_info_response res;
-    void *c, *t, *cell, *freq;
+    void *c, *t, *cell, *cells, *freq;
      int i, j;
      qmi_parse_nas_get_cell_location_info_response(msg, &res);
@@ -769,6 +769,7 @@ cmd_nas_get_cell_location_info_cb(struct qmi_dev *qmi, struct qmi_request *req,
              blobmsg_add_u32(&status, "s_intra_search_threshold",
res.data.intrafrequency_lte_info_v2.s_intra_search_threshold);
          }
+        cells = blobmsg_open_array(&status, "cells");
          for (i = 0; i < res.data.intrafrequency_lte_info_v2.cell_n; i++) {
              cell = blobmsg_open_table(&status, NULL);
print_lte_info(res.data.intrafrequency_lte_info_v2.cell[i].physical_cell_id, @@ -780,6 +781,7 @@ cmd_nas_get_cell_location_info_cb(struct qmi_dev *qmi, struct qmi_request *req, res.data.intrafrequency_lte_info_v2.cell[i].cell_selection_rx_level);
              blobmsg_close_table(&status, cell);
          }
+        blobmsg_close_array(&status, cells);
          blobmsg_close_table(&status, c);
      }
      if (res.set.interfrequency_lte_info) {
@@ -795,6 +797,7 @@ cmd_nas_get_cell_location_info_cb(struct qmi_dev *qmi, struct qmi_request *req, res.data.interfrequency_lte_info.frequency[i].cell_selection_rx_level_high_threshold, res.data.interfrequency_lte_info.frequency[i].cell_selection_rx_level_low_threshold);
              }
+            cells = blobmsg_open_array(&status, "cells");
              for (j = 0; j < res.data.interfrequency_lte_info.frequency[i].cell_n; j++) {
                  cell = blobmsg_open_table(&status, NULL);
print_lte_info(res.data.interfrequency_lte_info.frequency[i].cell[j].physical_cell_id, @@ -806,6 +809,7 @@ cmd_nas_get_cell_location_info_cb(struct qmi_dev *qmi, struct qmi_request *req, res.data.interfrequency_lte_info.frequency[i].cell[j].cell_selection_rx_level);
                  blobmsg_close_table(&status, cell);
              }
+            blobmsg_close_array(&status, cells);
              blobmsg_close_table(&status, freq);
          }
          if (res.data.interfrequency_lte_info.frequency_n > 0)

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to