From 8dfcef944416c1837df1e697bfe1649b3eaa0971 Mon Sep 17 00:00:00 2001 From: Tommi Kangas Date: Thu, 2 Jan 2025 13:15:53 +0200 Subject: [PATCH] lib: lte_link_control: Skip parsing of unexpected %NCELLMEAS notifications Added check to skip %NCELLMEAS notification parsing when neighbor cell measurement has not been requested by calling lte_lc_neighbor_cell_measurement(). If the neighbor cell measurement is triggered by sending the AT%NCELLMEAS AT command to the modem, LTE LC does not know how the received notification should be parsed, sometimes leading to a parsing error. Signed-off-by: Tommi Kangas --- lib/lte_link_control/modules/ncellmeas.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/lte_link_control/modules/ncellmeas.c b/lib/lte_link_control/modules/ncellmeas.c index 23003b0114b9..b0370874ae93 100644 --- a/lib/lte_link_control/modules/ncellmeas.c +++ b/lib/lte_link_control/modules/ncellmeas.c @@ -667,6 +667,13 @@ static void at_handler_ncellmeas(const char *response) goto exit; } + if (k_sem_count_get(&ncellmeas_idle_sem) > 0) { + /* No need to parse the notification because neighbor cell measurement + * has not been requested. + */ + goto exit; + } + if (ncellmeas_params.search_type > LTE_LC_NEIGHBOR_SEARCH_TYPE_EXTENDED_COMPLETE) { at_handler_ncellmeas_gci(response); goto exit;