lte_handler() added to nRF9160 mqtt_simple example

Hello,

been trying to add lte_lc_connect_async(lte_handler) to mqtt_simple,
just like the way it is in sample aws_iot.
Instead getting a failed response.

*** Booting Zephyr OS build v2.7.99-ncs1-1  ***
[00:00:00.623,260] <inf> mqtt_simple: The MQTT simple sample started
[00:00:00.623,291] <inf> mqtt_simple: Disabling PSM and eDRX
[00:00:00.624,114] <inf> mqtt_simple: LTE Link Connecting...
[00:00:00.670,135] <inf> mqtt_simple: LTE Link Connected!
[00:00:00.670,349] <err> mqtt_simple: getaddrinfo failed: -11
[00:00:00.670,349] <err> mqtt_simple: Failed to initialize broker connection
[00:00:00.670,349] <err> mqtt_simple: client_init: -10

Now not sure if this is possible to do at all,
or if there is some other setting missing?

steps:
- switched lte_lc_init_and_connect() for lte_lc_connect_async(lte_handler) in modem_configure(void)
- added static void lte_handler(const struct lte_lc_evt *const evt) {} just above modem_configure(void)
- added at the top,
BUILD_ASSERT(!IS_ENABLED(CONFIG_LTE_AUTO_INIT_AND_CONNECT),
"This sample does not support LTE auto-init and connect");

Broker test.mosquitto.org works fine in mqtt_simple when using lte_lc_init_and_connect() in v1.9.1.

thank-you,

Related