nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches

◆ location_request()

int location_request ( const struct location_config config)

#include <include/modem/location.h>

Requests the current position or starts periodic position updates.

Requests the current position using the given configuration. Depending on the configuration, a single position or periodic position updates are given. If the position request is successful, the results are delivered to the event handler function in LOCATION_EVT_LOCATION event. Otherwise LOCATION_EVT_TIMEOUT or LOCATION_EVT_ERROR event is triggered.

In periodic mode, position update is always attempted after the configured interval regardless of the outcome of any previous attempt. Periodic position updates can be stopped by calling location_cancel().

Parameters
[in]configUsed configuration or NULL to get a single position update with the default configuration. Default configuration has the following location methods in priority order (if they are enabled in library configuration): GNSS, Wi-Fi and Cellular.
Returns
0 on success, or negative error code on failure.
Return values
-EPERMLibrary not initialized.
-EBUSYPrevious location request still ongoing.
-EINVALInvalid configuration given.