location lib -> cloud_service.c -> custom location service provider


looking at https://github.com/nrfconnect/sdk-nrf/tree/main/lib/location

specifically https://github.com/nrfconnect/sdk-nrf/blob/main/lib/location/cloud_service/cloud_service.c

i think it would be useful to be able change void cloud_service_init(void) to accept a custom function

- if null: behaves as before

- if not null: function is used instead of 
cloud_service_nrf_pos_get(params, recv_buf, sizeof(recv_buf), location)  / cloud_service_here_rest_pos_get(params, recv_buf, sizeof(recv_buf), location)

and / or code could be optimized with a #if defined(CONFIG_LOCATION_SERVICE_CUSTOM)

that then needs changes to
https://github.com/nrfconnect/sdk-nrf/blob/main/lib/location/method_cloud_location.c 
int method_cloud_location_init(void)

and to

setup in https://github.com/nrfconnect/sdk-nrf/blob/main/lib/location/location_core.c

#if defined(CONFIG_LOCATION_METHOD_CELLULAR) || defined(CONFIG_LOCATION_METHOD_WIFI)
/**
 * Configuration for cloud location method, that is, combined Wi-Fi and cellular location method.
 * This is an internal method to handle combining sending of ncellmeas and Wi-Fi scan results
 * into a single cloud request. This method cannot be chosen in the library API.
 */
static const struct location_method_api method_cloud_location_api = {
    .method           = LOCATION_METHOD_WIFI_CELLULAR,
    .method_string    = "Wi-Fi + Cellular",
    .init             = method_cloud_location_init,
    .location_get     = method_cloud_location_get,
    ...

my question is if nordic sees the use for that and is willing to introduce the changes anytime soon?

background:

this change would allow the easy reuse of code even for a case where no real location return value is expected (~ custom cloud knows the location)

for that case also some signaling for "no_location_return_value_contained_but_thats_ok" could be good

Parents
  • Hello, 

    apologies for the late reply as our technical support have been understaffed during Easter holiday. 

    I asked our developers working on the location library about your request and they tell me that you can use CONFIG_LOCATION_SERVICE_EXTERNAL. They write:

    this would be overlapping functionality, where CONFIG_LOCATION_SERVICE_EXTERNAL Location library notifies the client with its events when cloud interaction is needed. From architectural perspective, using CONFIG_LOCATION_SERVICE_EXTERNAL is cleaner as application would be fully in control and executing all actions towards the cloud.

    Have you looked at this KConfig option? If this option is not possible to use, could you please explain why? More information can be found under the Location library documentation

    Thanks!

    Kind regards,
    Øyvind

  • i now use CONFIG_LOCATION_SERVICE_EXTERNAL but it's a bit unclean as the library generates location events that in my usecase are filled with dummy data and then ignored. only the cell, wifi, gps ... data is used on the device. 

    the library was written with a specific use case / information flow in mind but RL is different.

    anyway thanks for the info.  

Reply Children
No Data
Related