nRF Cloud cellular positioning

The nRF Cloud cellular positioning library enables applications to request cellular positioning data from nRF Cloud to be used with the nRF9160 SiP. This library is an enhancement to the nRF Cloud library.

Note

To use the nRF Cloud cellular positioning service, an nRF Cloud account is needed, and the device needs to be associated with a user’s account.

Configuration

Configure the following options to enable or disable the use of this library:

Request and process cellular positioning data

The nrf_cloud_cell_pos_request() function is used to request the cellular location of the device.

When nRF Cloud responds with the requested cellular positioning data, the nrf_cloud_cell_pos_process() function processes the received data. The function parses the data and returns the location information if it is found.

API documentation

Header file: include/net/nrf_cloud_cell_pos.h
Source files: subsys/net/lib/nrf_cloud/src/
group nrf_cloud_cell_pos

Defines

NRF_CLOUD_CELL_POS_TIME_ADV_MAX

Enums

enum nrf_cloud_cell_pos_type

Cellular positioning request type.

Values:

enumerator CELL_POS_TYPE_SINGLE
enumerator CELL_POS_TYPE_MULTI

Functions

int nrf_cloud_cell_pos_request_json_get(const struct lte_lc_cells_info *const cells_inf, const bool request_loc, cJSON **req_obj_out)

Get the reference to a cJSON object containing a cell position request.

Parameters
  • cells_inf – Pointer to cell info.

  • request_loc – If true, cloud will send location to the device. If false, cloud will not send location to the device.

  • req_obj_out – Pointer used to get the reference to the generated cJSON object.

Returns

0 – If successful. Otherwise, a (negative) error code is returned.

int nrf_cloud_cell_pos_process(const char *buf, struct nrf_cloud_cell_pos_result *result)

Processes cellular positioning data received from nRF Cloud via MQTT or REST.

Parameters
  • buf – Pointer to data received from nRF Cloud.

  • result – Pointer to buffer for parsing result.

Returns

  • 0 – If processed successfully and cell-based location found.

  • 1 – If processed successfully but no cell-based location found. Otherwise, a (negative) error code is returned.

struct nrf_cloud_cell_pos_result
#include <nrf_cloud_cell_pos.h>

Cellular positioning request result.