Skip to content

Commit 5e39c5f

Browse files
tokangasrlubos
authored andcommitted
lib: location: Remove support for HERE location services
Removed support for HERE location services. Signed-off-by: Tommi Kangas <[email protected]>
1 parent 588b845 commit 5e39c5f

File tree

25 files changed

+77
-1086
lines changed

25 files changed

+77
-1086
lines changed

doc/nrf/libraries/modem/location.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,12 +382,10 @@ This library uses the following |NCS| libraries:
382382

383383
* :ref:`nrf_modem_lib_readme`
384384
* :ref:`lte_lc_readme`
385-
* :ref:`lib_rest_client`
386385
* :ref:`lib_nrf_cloud`
387386
* :ref:`lib_nrf_cloud_agnss`
388387
* :ref:`lib_nrf_cloud_pgps`
389388
* :ref:`lib_nrf_cloud_rest`
390-
* :ref:`lib_modem_jwt`
391389

392390
It uses the following `sdk-nrfxlib`_ library:
393391

doc/nrf/releases_and_maturity/migration/migration_guide_3.0.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,19 @@ nRF Cloud library
118118
* You must set the :kconfig:option:`CONFIG_NRF_CLOUD` Kconfig option to access the nRF Cloud libraries.
119119
This option is now disabled by default to prevent the unintended inclusion of nRF Cloud Kconfig variables in non-nRF Cloud projects, addressing a previous issue.
120120

121+
Location library
122+
----------------
123+
124+
.. toggle::
125+
126+
For applications and samples using the :ref:`lib_location` library:
127+
128+
* Support for HERE location services and the :kconfig:option:`CONFIG_LOCATION_SERVICE_HERE` Kconfig option has been removed.
129+
To use external location services, enable the :kconfig:option:`CONFIG_LOCATION_SERVICE_EXTERNAL` option and implement the required APIs.
130+
131+
* The ``service`` parameter in :c:struct:`location_cellular_config` and :c:struct:`location_wifi_config` has been removed.
132+
The library supports only one location service, so the ``service`` parameter is no longer needed.
133+
121134
.. _migration_3.0_recommended:
122135

123136
Recommended changes

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,7 @@ Modem libraries
953953

954954
* :ref:`lib_location` library:
955955

956-
* Removed references to HERE location services.
956+
* Removed support for HERE location services.
957957

958958
* :ref:`lib_at_host` library:
959959

include/modem/location.h

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -142,21 +142,6 @@ enum location_accuracy {
142142
LOCATION_ACCURACY_HIGH,
143143
};
144144

145-
/** Location service. */
146-
enum location_service {
147-
/**
148-
* Use any location service that has been configured to be available.
149-
*
150-
* This is useful when only one service is configured but can also be used
151-
* even if several services are available.
152-
*/
153-
LOCATION_SERVICE_ANY,
154-
/** nRF Cloud location service. */
155-
LOCATION_SERVICE_NRF_CLOUD,
156-
/** HERE location service. */
157-
LOCATION_SERVICE_HERE
158-
};
159-
160145
/** Date and time (UTC). */
161146
struct location_datetime {
162147
/** True if date and time are valid, false if not. */
@@ -466,16 +451,6 @@ struct location_cellular_config {
466451
*/
467452
int32_t timeout;
468453

469-
/**
470-
* @brief Used cellular positioning service.
471-
*
472-
* @details Default value is @ref LOCATION_SERVICE_ANY. It is applied when
473-
* location_config_defaults_set() function is called.
474-
*
475-
* This parameter is ignored when @kconfig{CONFIG_LOCATION_SERVICE_EXTERNAL} is enabled.
476-
*/
477-
enum location_service service;
478-
479454
/**
480455
* @brief Number of cells to be requested for cellular positioning.
481456
*
@@ -519,16 +494,6 @@ struct location_wifi_config {
519494
* @ref location_config structure is still valid.
520495
*/
521496
int32_t timeout;
522-
523-
/**
524-
* @brief Used Wi-Fi positioning service.
525-
*
526-
* @details Default value is @ref LOCATION_SERVICE_ANY. It is applied when
527-
* location_config_defaults_set() function is called.
528-
*
529-
* This parameter is ignored when @kconfig{CONFIG_LOCATION_SERVICE_EXTERNAL} is enabled.
530-
*/
531-
enum location_service service;
532497
};
533498

534499
/** Location method configuration. */
@@ -560,7 +525,6 @@ struct location_config {
560525
* these methods are handled together, if the following conditions are met:
561526
* - Methods are one after the other in location request method list
562527
* - @ref mode is @ref LOCATION_REQ_MODE_FALLBACK
563-
* - Requested cloud service for Wi-Fi and cellular is the same
564528
*/
565529
struct location_method_config methods[CONFIG_LOCATION_METHODS_LIST_SIZE];
566530

lib/location/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ endif()
1717

1818
if(CONFIG_LOCATION_METHOD_CELLULAR OR CONFIG_LOCATION_METHOD_WIFI)
1919
zephyr_library_sources(method_cloud_location.c)
20-
add_subdirectory(cloud_service)
20+
zephyr_library_sources_ifdef(CONFIG_LOCATION_SERVICE_NRF_CLOUD cloud_service.c)
2121
endif()
2222

2323
zephyr_library_compile_definitions(_POSIX_C_SOURCE=200809L)

lib/location/Kconfig

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -117,17 +117,10 @@ if LOCATION_METHOD_CELLULAR || LOCATION_METHOD_WIFI
117117

118118
config LOCATION_SERVICE_CLOUD_RECV_BUF_SIZE
119119
int "Receive buffer size"
120-
default 1024 if LOCATION_SERVICE_HERE
121120
default 512
122121
help
123122
Size of the buffer used to store the response from the location service.
124123

125-
config LOCATION_SERVICE_HERE
126-
bool "HERE location service"
127-
select CJSON_LIB
128-
help
129-
Use HERE location service.
130-
131124
config LOCATION_SERVICE_NRF_CLOUD
132125
bool "nRF Cloud location service"
133126
default y if !LOCATION_SERVICE_EXTERNAL
@@ -137,47 +130,6 @@ config LOCATION_SERVICE_NRF_CLOUD
137130
help
138131
Use nRF Cloud location service.
139132

140-
if LOCATION_SERVICE_HERE
141-
142-
config LOCATION_REST_CLIENT
143-
bool
144-
default y
145-
select REST_CLIENT
146-
help
147-
Use the REST client library for cellular service. This is
148-
separated here from other dependencies to allow disabling of
149-
REST client library in tests for mocking purposes.
150-
151-
config LOCATION_MODEM_KEY_MGMT
152-
bool
153-
default y
154-
select MODEM_KEY_MGMT
155-
help
156-
Use the Modem key management library for cellular service. This is
157-
separated here from other dependencies to allow disabling of
158-
Modem key management library in tests for mocking purposes.
159-
160-
config LOCATION_SERVICE_HERE_API_KEY
161-
string "HERE API key"
162-
help
163-
HERE API key used for authentication.
164-
165-
config LOCATION_SERVICE_HERE_HOSTNAME
166-
string "Server hostname for HERE"
167-
default "positioning.hereapi.com"
168-
help
169-
Server hostname to use when connecting to the HERE location service.
170-
171-
config LOCATION_SERVICE_HERE_TLS_SEC_TAG
172-
int "Security tag for HERE TLS certificates"
173-
default 175
174-
help
175-
Security tag where the required TLS certificates for the HERE location
176-
service are stored. This sec tag will also be used to provision CA
177-
certificates.
178-
179-
endif # LOCATION_SERVICE_HERE
180-
181133
endif # LOCATION_METHOD_CELLULAR || LOCATION_METHOD_WIFI
182134

183135
config LOCATION_SERVICE_EXTERNAL

lib/location/cloud_service/cloud_service_nrf.c renamed to lib/location/cloud_service.c

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,40 +26,41 @@ BUILD_ASSERT(
2626
"CONFIG_NRF_CLOUD_MQTT, CONFIG_NRF_CLOUD_REST or CONFIG_NRF_CLOUD_COAP transport "
2727
"must be enabled");
2828

29+
static char recv_buf[CONFIG_LOCATION_SERVICE_CLOUD_RECV_BUF_SIZE];
2930

3031
#if defined(CONFIG_NRF_CLOUD_MQTT)
3132
/* Verify that LOCATION is enabled if MQTT is enabled */
3233
BUILD_ASSERT(
3334
IS_ENABLED(CONFIG_NRF_CLOUD_LOCATION),
3435
"If CONFIG_NRF_CLOUD_MQTT is enabled also CONFIG_NRF_CLOUD_LOCATION must be enabled");
3536

36-
static struct location_data nrf_cloud_location;
37-
static K_SEM_DEFINE(nrf_location_ready, 0, 1);
37+
static struct location_data cloud_location;
38+
static K_SEM_DEFINE(location_ready, 0, 1);
3839
#endif
3940

4041
#if defined(CONFIG_NRF_CLOUD_MQTT)
41-
static void cloud_service_nrf_location_ready_cb(
42+
static void cloud_service_location_ready_cb(
4243
const struct nrf_cloud_location_result *const result)
4344
{
4445
if ((result != NULL) && (result->err == NRF_CLOUD_ERROR_NONE)) {
45-
nrf_cloud_location.latitude = result->lat;
46-
nrf_cloud_location.longitude = result->lon;
47-
nrf_cloud_location.accuracy = (double)result->unc;
46+
cloud_location.latitude = result->lat;
47+
cloud_location.longitude = result->lon;
48+
cloud_location.accuracy = (double)result->unc;
4849

49-
k_sem_give(&nrf_location_ready);
50+
k_sem_give(&location_ready);
5051
} else {
5152
if (result) {
5253
LOG_ERR("Unable to determine location from cloud service, error: %d",
5354
result->err);
5455
}
55-
/* Reset the semaphore to unblock cloud_service_nrf_pos_get()
56+
/* Reset the semaphore to unblock cloud_service_pos_get()
5657
* and make it return an error.
5758
*/
58-
k_sem_reset(&nrf_location_ready);
59+
k_sem_reset(&location_ready);
5960
}
6061
}
6162

62-
int cloud_service_nrf_pos_get(
63+
static int cloud_service_pos_get(
6364
const struct cloud_service_pos_req *params,
6465
char * const rcv_buf,
6566
const size_t rcv_buf_len,
@@ -70,11 +71,11 @@ int cloud_service_nrf_pos_get(
7071

7172
int err;
7273

73-
k_sem_reset(&nrf_location_ready);
74+
k_sem_reset(&location_ready);
7475

7576
LOG_DBG("Sending positioning request (MQTT)");
7677
err = nrf_cloud_location_request(
77-
params->cell_data, params->wifi_data, NULL, cloud_service_nrf_location_ready_cb);
78+
params->cell_data, params->wifi_data, NULL, cloud_service_location_ready_cb);
7879
if (err == -EACCES) {
7980
LOG_ERR("Cloud connection is not established");
8081
return err;
@@ -85,18 +86,18 @@ int cloud_service_nrf_pos_get(
8586

8687
LOG_DBG("Positioning request sent");
8788

88-
if (k_sem_take(&nrf_location_ready, K_MSEC(params->timeout_ms)) == -EAGAIN) {
89+
if (k_sem_take(&location_ready, K_MSEC(params->timeout_ms)) == -EAGAIN) {
8990
LOG_ERR("Positioning data request timed out or "
9091
"cloud did not return a location");
9192
return -ETIMEDOUT;
9293
}
9394

94-
*location = nrf_cloud_location;
95+
*location = cloud_location;
9596

9697
return err;
9798
}
9899
#else /* defined(CONFIG_NRF_CLOUD_MQTT) */
99-
int cloud_service_nrf_pos_get(
100+
static int cloud_service_pos_get(
100101
const struct cloud_service_pos_req *params,
101102
char * const rcv_buf,
102103
const size_t rcv_buf_len,
@@ -136,3 +137,18 @@ int cloud_service_nrf_pos_get(
136137
return err;
137138
}
138139
#endif /* defined(CONFIG_NRF_CLOUD_MQTT) */
140+
141+
int cloud_service_location_get(
142+
const struct cloud_service_pos_req *params,
143+
struct location_data *location)
144+
{
145+
__ASSERT_NO_MSG(params != NULL);
146+
__ASSERT_NO_MSG(params->cell_data != NULL || params->wifi_data != NULL);
147+
__ASSERT_NO_MSG(location != NULL);
148+
149+
LOG_DBG("Cloud service location parameters:");
150+
LOG_DBG(" Timeout: %dms", params->timeout_ms);
151+
152+
return cloud_service_pos_get(
153+
params, recv_buf, sizeof(recv_buf), location);
154+
}

lib/location/cloud_service/cloud_service.h renamed to lib/location/cloud_service.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ extern "C" {
1717

1818
/** Cloud positioning input parameters. */
1919
struct cloud_service_pos_req {
20-
/** Cloud positioning service to be used. */
21-
enum location_service service;
2220
/** Neighbor cell data. */
2321
struct lte_lc_cells_info *cell_data;
2422
/** Wi-Fi scanning results data. */
@@ -44,11 +42,6 @@ int cloud_service_location_get(
4442
const struct cloud_service_pos_req *params,
4543
struct location_data *location);
4644

47-
/**
48-
* @brief Initialize cloud services.
49-
*/
50-
void cloud_service_init(void);
51-
5245
#ifdef __cplusplus
5346
}
5447
#endif

lib/location/cloud_service/CMakeLists.txt

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)