File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
samples/nrf9160/location/src Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,29 @@ static void location_gnss_low_accuracy_get(void)
160160 location_event_wait ();
161161}
162162
163+ /**
164+ * @brief Retrieve location with GNSS high accuracy.
165+ */
166+ static void location_gnss_high_accuracy_get (void )
167+ {
168+ int err ;
169+ struct location_config config ;
170+ enum location_method methods [] = {LOCATION_METHOD_GNSS };
171+
172+ location_config_defaults_set (& config , sizeof (methods ), methods );
173+ config .methods [0 ].gnss .accuracy = LOCATION_ACCURACY_HIGH ;
174+
175+ printk ("Requesting high accuracy GNSS location...\n" );
176+
177+ err = location_request (& config );
178+ if (err ) {
179+ printk ("Requesting location failed, error: %d\n" , err );
180+ return ;
181+ }
182+
183+ location_event_wait ();
184+ }
185+
163186#if defined(CONFIG_LOCATION_METHOD_WIFI )
164187/**
165188 * @brief Retrieve location with Wi-Fi positioning as first priority, GNSS as second
@@ -260,6 +283,8 @@ int main(void)
260283
261284 location_gnss_low_accuracy_get ();
262285
286+ location_gnss_high_accuracy_get ();
287+
263288#if defined(CONFIG_LOCATION_METHOD_WIFI )
264289 location_wifi_get ();
265290#endif
You can’t perform that action at this time.
0 commit comments