nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
lwm2m_client_utils_location.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
14#ifndef LWM2M_CLIENT_UTILS_LOCATION_H__
15#define LWM2M_CLIENT_UTILS_LOCATION_H__
16
17#include <zephyr/kernel.h>
18#include <nrf_modem_gnss.h>
19#include <zephyr/net/lwm2m.h>
20#include <modem/lte_lc.h>
21
22#define LOCATION_ASSIST_NEEDS_UTC BIT(0)
23#define LOCATION_ASSIST_NEEDS_EPHEMERIES BIT(1)
24#define LOCATION_ASSIST_NEEDS_ALMANAC BIT(2)
25#define LOCATION_ASSIST_NEEDS_KLOBUCHAR BIT(3)
26#define LOCATION_ASSIST_NEEDS_NEQUICK BIT(4)
27#define LOCATION_ASSIST_NEEDS_TOW BIT(5)
28#define LOCATION_ASSIST_NEEDS_CLOCK BIT(6)
29#define LOCATION_ASSIST_NEEDS_LOCATION BIT(7)
30#define LOCATION_ASSIST_NEEDS_INTEGRITY BIT(8)
31
32#define LOCATION_ASSIST_RESULT_CODE_OK 0
33#define LOCATION_ASSIST_RESULT_CODE_PERMANENT_ERR -1
34#define LOCATION_ASSIST_RESULT_CODE_TEMP_ERR 1
35#define LOCATION_ASSIST_RESULT_CODE_NO_RESP_ERR 2
36
57typedef void (*location_assistance_result_code_cb_t)(uint16_t object_id, int32_t result_code);
58
65
73int location_assistance_agnss_set_mask(const struct nrf_modem_gnss_agnss_data_frame *agnss_req);
74
82int location_assistance_agnss_request_send(struct lwm2m_ctx *ctx);
83
92
100int location_assistance_pgps_request_send(struct lwm2m_ctx *ctx);
101
109void location_assistance_retry_init(bool enable_resend);
110
118int location_event_handler_init(struct lwm2m_ctx *ctx);
119
120#define GNSS_ASSIST_OBJECT_ID 33625
121
127void location_assist_agnss_request_set(uint32_t request_mask);
128
135void location_assist_agnss_set_elevation_mask(int32_t elevation_mask);
136
143
152
161
169
176
185
192
193#define GROUND_FIX_OBJECT_ID 33626
200void ground_fix_set_report_back(bool report_back);
201
208
209#define VISIBLE_WIFI_AP_OBJECT_ID 33627
210
211#define ECID_SIGNAL_MEASUREMENT_INFO_OBJECT_ID 10256
214
223
232
243
244#endif /* LWM2M_CLIENT_UTILS_LOCATION_H__ */
245
int32_t ground_fix_get_result_code(void)
Get the result code of the location request.
int lwm2m_ncell_handler_register(void)
Register the handler for the Neighbor cell scanning.
int location_event_handler_init(struct lwm2m_ctx *ctx)
Initialize the location assistance event handler.
int location_assistance_ground_fix_request_send(struct lwm2m_ctx *ctx)
Send the Ground Fix request to LwM2M Server.
void(* location_assistance_result_code_cb_t)(uint16_t object_id, int32_t result_code)
Callback for location assistance result.
Definition: lwm2m_client_utils_location.h:57
void lwm2m_ncell_schedule_measurement(void)
void ground_fix_set_report_back(bool report_back)
Set if the server should report the location back to the object after it has attained it.
int location_assist_pgps_set_start_time(int32_t start_time)
Set the GPS start time in seconds.
int32_t location_assist_pgps_get_start_gps_day(void)
Get the GPS start day stored currently in the resource.
int lwm2m_wifi_request_scan(void)
Request a Wi-Fi scan for nearby access points.
int location_assist_pgps_set_prediction_count(int32_t predictions)
Set prediction count for the P-GPS query.
void location_assistance_retry_init(bool enable_resend)
Initialize the location assistance library resend handler. Handler will handle the result code from s...
int location_assistance_pgps_request_send(struct lwm2m_ctx *ctx)
Send the P-GPS assistance request to LwM2M Server.
int location_assistance_agnss_set_mask(const struct nrf_modem_gnss_agnss_data_frame *agnss_req)
Set the A-GNSS request mask.
int location_assistance_agnss_request_send(struct lwm2m_ctx *ctx)
Send the A-GNSS assistance request to LwM2M Server.
void location_assist_pgps_set_start_gps_day(int32_t gps_day)
Set starting GPS day as days since GPS epoch. Setting the day as 0, will use the default value for th...
void location_assist_agnss_set_elevation_mask(int32_t elevation_mask)
Set the satellite elevation mask angle above the ground. Satellites below the angle will be filtered ...
int32_t location_assist_agnss_get_elevation_mask(void)
Get the satellite elevation mask currently stored in the resource.
int lwm2m_signal_meas_info_inst_id_to_index(uint16_t obj_inst_id)
int lwm2m_update_signal_meas_objects(const struct lte_lc_cells_info *const cells)
Update the ECID-Signal Measurement Info objects with the recent neighbor cell data.
int lwm2m_signal_meas_info_index_to_inst_id(int index)
int location_assist_pgps_set_prediction_interval(int32_t interval)
Set prediction interval as minutes for the P-GPS query.
void location_assist_agnss_request_set(uint32_t request_mask)
Set an A-GNSS assistance request mask for the object.
int32_t location_assist_gnss_get_result_code(void)
Get the result code of the location request.
void location_assistance_set_result_code_cb(location_assistance_result_code_cb_t cb)
Set the location assistance result code callback.
Definition: lte_lc.h:513