Hi,
I want to set and catch a timeout event when connecting async to LTE, but I fail to see how this would work.
For lte_lc_connect this is clear:
-
Set
CONFIG_LTE_NETWORK_TIMEOUT(default 600) - Check the return code (ETIMEDOUT for time out)
But for the async variant lte_lc_connect_async , the CONFIG_LTE_NETWORK_TIMEOUT doesn't seem to be used in lte_lc.c.
in lte_connect(false):
...
err = lte_lc_func_mode_set(LTE_LC_FUNC_MODE_NORMAL);
if (err || !blocking) {
goto exit; // Exit when non-blocking and never using the timeout value
}
err = k_sem_take(&link, K_SECONDS(CONFIG_LTE_NETWORK_TIMEOUT));
if (err == -EAGAIN) {
LOG_INF("Network connection attempt timed out");
...
- Is it possible to LTE_NETWORK_TIMEOUT for lte_lc_connect_async?
- If so, how?
- If not, what would be the best solution to avoid the device to search forever?
- We started from asset tracker v2 app which has a dedicated modem_module thread, so we could switch to a sync blocking call for the network connection?
- Or implement or own timeout timer on top of the existing code
Thanks in advance!