we are developing a product using the nrf9160 that requires fast and accurate GPS fixes and uses LwM2M for cloud communication and device management. We are using NCS v2.4.2.
Since fast and accurate fixes are needed, we would like to use the location library, which will allow us to use GNSS (with P-GPS and A-GPS) and cell tower positioning. The library can be configured to not use nrf cloud directly, but to let the app handle assistance injection (using CONFIG_LOCATION_SERVICE_EXTERNAL) - this should allow us to use lwm2m to download the assistance data.
The above is fine and well-documented.
Now, looking at lwm2m, we have the lwm2m location assistance, which is marked as experimental, but has, as far as I can tell, remained unchanged since NCS v2.2.0.
Looking at the code, I can see the following relevant files:
Sorry to be rude, but this is a mess. Just some issues:
- gnss_assistance_obj.c implements functions that are specified in lwm2m_client_utils_location.h (for example location_assist_agps_request_set).
- The function location_event_handler_init from lwm2m_client_utils_location.h is not implemented in any of the above .c files. It actually belongs to the lwm2m sample (nrf/samples/nrf9160/lwm2m_client/src/events/location_event_handler.c).
- retry_seconds in location_assistance.c is initialized to 0 instead of INITIAL_RETRY_INTERVAL, which causes location_assist_ground_fix_result_cb to schedule the retry work immediately if LOCATION_ASSIST_RESULT_CODE_TEMP_ERR is received before any LOCATION_ASSIST_RESULT_CODE_OK are received.
- gnss_assistance_obj.c uses the nrf_cloud lib directly when receiving a-gps orr p-gps data. For example, in gnss_assist_write_pgps, the function nrf_cloud_pgps_process_update is called. Reading the location lib documentation above, it wants us to call location_pgps_data_process with the p-gps data (which calls nrf_cloud_pgps_process internally).
I have the following questions:
1. If we want to integrate the location library and the lw2m location assistance, what is the best course of action?
a) should we use the gnss_assistance_obj.c as is. Will the location lib know that the p-gps data was injected correctly, even if we don't call location_pgps_data_process?
b) Should we register our own write handlers (gnss_assist_write_cb, gnss_assistance_result_code_cb) and use those to write to the location lib as specified in the location docs?
c) Use the gnss_assistance_obj.c as a "base" and implement our own, which correctly integrates with the location lib.
d) something else?
2. What is the timeline on improvements and finalization of lwm2m gnss assistance? It would be nice to use something official form the SDK as is, but the current state of the lib is not usable for us. Are there any short-term plans to improve this? Do you plan on including this as part of the location lib under the hood (similarly to nrf cloud and here positioning)?
Making modifications/using our own implementations of the location assistance objects is not ideal, since they are not part of the lwm2m spec. Thus, they might change as you (Nordic) or AVSystems modifies them. Thus, It would be also nice to know if you plan on replacing these objects (as you have done with object 50001 in the past).
Please advise on the best course of action for us.