How to disable location services in asset tracker with lwm2m

Hi All,

I'm trying to fully disable all location services with the asset tracker in v2.6.1 while using lwm2m (so I have the lwm2m overlay enabled in the build settings).

However, as you can see below, setting CONFIG_LOCATION=n in my prj.conf does not seem enough to disable the location services.

[00:00:13.241,333] <inf> app_event_manager: MODEM_EVT_LTE_CELL_UPDATE
+CSCON: 1
%CESQ: 54,2,17,2
[00:00:13.673,095] <err> net_lwm2m_engine: Failed to enable TLS_DTLS_CID: -22
[00:00:13.673,492] <err> net_lwm2m_engine: Cannot connect UDP (-114)
[00:00:13.673,919] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-114)
[00:00:13.674,255] <err> net_lwm2m_rd_client: sm_do_network_error, retries 0
[00:00:13.674,499] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:350457794446409' with client lifetime 43200 using server object 0
[00:00:13.674,896] <err> net_lwm2m_message_handling: Unable to resolve address
[00:00:13.674,896] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-2)
[00:00:13.675,231] <err> net_lwm2m_rd_client: sm_do_network_error, retries 1
%XTIME: "80","42608151931180","01"
[00:00:14.675,811] <err> net_lwm2m_rd_client: sm_do_network_error, retries 1
[00:00:14.676,055] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:350457794446409' with client lifetime 43200 using server object 0
[00:00:14.676,391] <err> net_lwm2m_message_handling: Unable to resolve address
[00:00:14.676,422] <err> net_lwm2m_rd_client: Cannot init LWM2M engine (-2)
[00:00:14.676,727] <err> net_lwm2m_rd_client: sm_do_network_error, retries 2
+CGEV: ME PDN ACT 0,0
[00:00:15.095,703] <inf> app_event_manager: MODEM_EVT_LTE_CONNECTED
+CNEC_ESM: 50,0
%MDMEV: SEARCH STATUS 2
+CEREG: 5,"56BD","019B5502",7,,,"00001111","11100000"
[00:00:15.297,576] <inf> app_event_manager: MODEM_EVT_LTE_PSM_UPDATE
[00:00:16.676,696] <err> net_lwm2m_rd_client: sm_do_network_error, retries 2
[00:00:16.676,971] <inf> net_lwm2m_rd_client: RD Client started with endpoint 'urn:imei:350457794446409' with client lifetime 43200 using server object 0
[00:00:16.767,211] <err> net_lwm2m_engine: Failed to enable TLS_DTLS_CID: -22
[00:00:17.259,887] <inf> net_lwm2m_engine: Connected, sock id 2
[00:00:17.410,156] <inf> net_lwm2m_rd_client: Registration Done (EP='urn:imei:350457794446409')
[00:00:17.410,919] <inf> app_event_manager: CLOUD_EVT_CONNECTED
[00:00:17.411,773] <inf> app_event_manager: APP_EVT_DATA_GET - Requested data types (MOD_DYN, MOD_STAT, BAT, ENV, LOCATION)
[00:00:17.412,506] <inf> app_event_manager: LOCATION_MODULE_EVT_ACTIVE
[00:00:17.415,313] <inf> app_event_manager: LOCATION_MODULE_EVT_AGNSS_NEEDED
[00:00:17.417,419] <inf> app_event_manager: SENSOR_EVT_ENVIRONMENTAL_DATA_READY
[00:00:17.518,798] <inf> app_event_manager: SENSOR_EVT_FUEL_GAUGE_READY
+CEREG: 5,"56BD","019B5502",7,,,"00001111","00101101"
[00:00:17.529,266] <inf> app_event_manager: MODEM_EVT_LTE_PSM_UPDATE
[00:00:17.592,864] <inf> app_event_manager: MODEM_EVT_MODEM_STATIC_DATA_READY
[00:00:17.595,489] <inf> net_lwm2m_obj_gnss_assistance: Requesting A-GNSS data, mask 0x000001ff
[00:00:17.595,611] <inf> net_lwm2m_location_assist: Send A-GNSS request
[00:00:17.598,205] <inf> net_lwm2m_message_handling: Send op to server (/dp)
[00:00:17.634,460] <inf> app_event_manager: MODEM_EVT_MODEM_DYNAMIC_DATA_READY
[00:00:17.713,470] <inf> net_lwm2m_message_handling: Send done!
%CESQ: 54,2,12,1
+CSCON: 0
%XT3412: 46799999
%CESQ: 57,2,18,2
[00:00:53.133,392] <inf> lwm2m_rai: RAI enabled
%CESQ: 255,0,255,0

When I look at the build results, it seems that CONFIG_LOCATION is still set to "y" so it must be forced by some other variable that I'm unaware of.

What would be the correct way to disable all location services?

Parents
  • Hello,

    If you set CONFIG_LOCATION=n in your prj.conf, and it is still set in the application, then you should get a warning during build where is says that the config option was set to CONFIG_LOCATION=y during building, I suggest to look at the build output to understand why it was still set to y.

    Kenneth

  • Thank you for the reply. I do indeed see that warning in the build output, but it doesn't really help me to narrow down the cause:

    warning: LOCATION (defined at /opt/nordic/ncs/v2.6.1/nrf/lib/location/Kconfig:7) was assigned the
    value 'n' but got the value 'y'. See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_LOCATION and/or look up LOCATION in the
    menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values,
    and Kconfig - Tips and Best Practices sections of the manual might be helpful too.

    From the documentation on the location module it seems that just setting the CONFIG_LOCATION to n would be enough.

    Is there a way to find out which code/kconfig setting makes it go back to y?

  • Good point, I was hoping it threw a bit more information.

    If I search through ncs for the following:

    select LOCATION

    I can for instance find the following results:

    Is it possible that you have enabled CONFIG_MOSH_LOCATION or CONFIG_LOCATION_MODULE?

    Best regards,
    Kenneth

  • I don't think so, I can't find them anywhere in my code. And I'm using just the unaltered config files for the asset tracker expect for the inclusion of the lwm2m overlay.

    Furthermore, if I try to add CONFIG_LOCATION_MODULE=n to my prj.conf it throws this error:

    /opt/nordic/ncs/toolchains/580e4ef81c/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: modules/nrf/subsys/net/lib/lwm2m_client_utils/lib..__nrf__subsys__net__lib__lwm2m_client_utils.a(gnss_assistance_obj.c.obj): in function `gnss_assist_write_agnss':
    /opt/nordic/ncs/v2.6.1/nrf/subsys/net/lib/lwm2m_client_utils/lwm2m/gnss_assistance_obj.c:116: undefined reference to `nrf_cloud_agnss_process'
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.


    and it can't find CONFIG_MOSH_LOCATION=n:
    prj.conf:117: warning: attempt to assign the value 'n' to the undefined symbol MOSH_LOCATION

  • hubert_11 said:
    Furthermore, if I try to add CONFIG_LOCATION_MODULE=n to my prj.conf it throws this error:

    Looks like this did the job, the remaining problem now is that you still have code that try to use the location api (e.g. undefined reference to `nrf_cloud_agnss_process') so you need to comment or remove those.

    Kenenth

Reply Children
Related