Multicell location
Note
This library has been marked as deprecated after the release of the nRF Connect SDK v2.2.0 and relevant functionality is available through the Location library.
The Multicell location library provides a way to acquire the location of the device based on LTE cell measurements.
Overview
The library uses LTE cell information, such as LTE link controller library, to generate requests through nRF Cloud location, nRF Cloud REST or REST client depending on the selected service and transport (REST or MQTT).
When the location service has resolved the location based on the cell measurements provided in the request, it sends back a response to the device. After receiving the response, the Multicell location library parses the response and returns the location to the caller.
The library supports the following location services:
HERE Positioning (v1 and v2)
The data transport method for the request to the service is mainly REST. However, you can configure either MQTT (CONFIG_NRF_CLOUD_MQTT
) or REST (CONFIG_NRF_CLOUD_REST
) for nRF Cloud Location Services.
To use the location services, see the respective documentation for account setup and for getting the required credentials for authentication.
Note
nRF9160 DK and Thingy:91 devices are shipped with RSA256 certificates. To start using the Multicell location library with nRF Cloud, you must perform either of the following actions:
Delete the device from nRF Cloud and reprovision it with a new ES256 device certificate. See Updating the nRF Cloud certificate for more information.
Register a separate key for JWT signing as described in Securely generating credentials on the nRF9160.
The required credentials for the location services are configurable using Kconfig options. There is no difference in the API calls when using the services.
The library has an API to handle provisioning of the required TLS certificates for the location services, multicell_location_provision_certificate()
.
Note
Certificates must be provisioned while the modem’s functional mode is offline, or it is powered off.
The simplest way to achieve this is to call the multicell_location_provision_certificate()
function after booting the application, before connecting to the LTE network.
Configuration
To use the multicell location library, enable the CONFIG_MULTICELL_LOCATION
Kconfig option.
Select nRF Cloud and HERE location services using at least one of the following sets of options and configure corresponding authentication parameters:
CONFIG_MULTICELL_LOCATION_SERVICE_HERE
andCONFIG_MULTICELL_LOCATION_HERE_API_KEY
(see below other authentication options)
The authentication method for HERE is the API key. For nRF Cloud, use a JSON Web Token (JWT) signed by the device’s private key.
The following options offer different versions and authentication methods for HERE location service:
The following options control the transport method used with nRF Cloud:
CONFIG_NRF_CLOUD_REST
- Uses REST APIs to communicate with nRF Cloud ifCONFIG_NRF_CLOUD_MQTT
is not set.CONFIG_NRF_CLOUD_MQTT
- Uses MQTT transport to communicate with nRF Cloud.
The following options can usually have default values:
For other relevant options for configuring location retrieval, see nRF Cloud REST and REST client.
The maximum number of supported neighbor cell measurements for HERE location services depend on the CONFIG_LTE_NEIGHBOR_CELLS_MAX
Kconfig option.
Limitations
Retrieving the device’s location is a blocking operation.
Dependencies
This library uses the following nRF Connect SDK libraries:
API documentation
include/net/multicell_location.h
lib/multicell_location/
- group multicell_location
Library for performing multicell location requests towards the cloud.
- Deprecated:
After nRF Connect SDK v2.2.0.
Enums
-
enum multicell_service
Cellular positioning service.
Values:
-
enumerator MULTICELL_SERVICE_ANY
Use any location service that has been configured to be available.
This is especially useful when only one service is configured but can be used even if many are available, in which case selected service is undefined.
-
enumerator MULTICELL_SERVICE_NRF_CLOUD
nRF Cloud location service.
-
enumerator MULTICELL_SERVICE_HERE
Here location service.
-
enumerator MULTICELL_SERVICE_ANY
Functions
-
int multicell_location_get(const struct multicell_location_params *params, struct multicell_location *location)
Send a request for location based on cell measurements to the selected location service.
Note
This function will block the calling thread until a response is received from the location service, or timeout has elapsed.
Note
Certificate must be provisioned before a request can be sent, multicell_location_provision_certificate.
- Parameters
params – [in] Cellular positioning parameters to be used.
location – [out] Location.
- Return values
-ENOENT – No cellular cells found from cell_data. I.e., even current cell is not available and there is no cellular connectivity.
-ENOMEM – Out of memory.
-ENOMSG – Parsing response from the location service failed.
- Returns
0 on success, or negative error code on failure.
-
int multicell_location_provision_certificate(bool overwrite)
Provision TLS certificate that the selected location service requires for HTTPS connections. Certificate provisioning must be done before location requests can successfully be executed, either using this API or some other method.
Note
Certificate provisioning must happen when LTE is not active in the modem. This is typically achieved by calling this API prior to setting up the LTE link in an application, but it can also be done by setting the modem in offline mode before provisioning.
- Parameters
overwrite – [in] If this flag is set, any CA certificate currently provisioned to CONFIG_MULTICELL_LOCATION_TLS_SEC_TAG is overwritten.
- Returns
0 on success, or negative error code on failure.
-
struct multicell_location
- #include <multicell_location.h>
-
struct multicell_location_params
- #include <multicell_location.h>
Cellular positioning input parameters.
Public Members
-
enum multicell_service service
Cellular positioning service to be used.
-
const struct lte_lc_cells_info *cell_data
Neighbor cell data.
-
int32_t timeout
Timeout (in milliseconds) of how long the cellular positioning procedure can take. SYS_FOREVER_MS means that the timer is disabled.
-
enum multicell_service service