Hello,
I've been trying to use the NRF Cloud A-GNSS capabilities using the location library. However, after carefully checking the documentation, I am still unable to do it.
Calling this function:
static void get_and_process_agnss_nrf_cloud_data(void)
{
int err;
char response[4096];
struct nrf_cloud_rest_context rest_context;
char agnss_buf[4096]; // Buffer for A-GNSS data
rest_context = (struct nrf_cloud_rest_context){
.connect_socket = -1, // Use default socket
.auth = NULL, // Must be NULL!
.response = response,
.response_len = sizeof(response),
.total_response_len = sizeof(response),
.rx_buf = agnss_buf,
.rx_buf_len = sizeof(agnss_buf),
.fragment_size = 0, // Use default fragment size
.timeout_ms = 10000, // Set a timeout for the request
.nrf_err = NRF_CLOUD_ERROR_NONE,
};
struct nrf_cloud_rest_agnss_request request = {
.type = NRF_CLOUD_REST_AGNSS_REQ_ASSISTANCE,
.agnss_req = NULL, // Not used for this request type
.net_info = NULL, // Not used for this request type
.filtered = false, // Not filtering the data
.mask_angle = NRF_CLOUD_AGNSS_MASK_ANGLE_NONE, // No angle
};
struct nrf_cloud_rest_agnss_result result = {
.buf = agnss_buf,
.buf_sz = sizeof(agnss_buf),
.agnss_sz = 0, // Will be set by the function
};
printk("Requesting A-GNSS data from nRF Cloud...\n");
err = nrf_cloud_rest_agnss_data_get(&rest_context, &request, &result);
if (err > 0) {
printk("Buffer too small: %d bytes needed\n", err);
return;
} else if (err < 0) {
printk("Failed to get A-GNSS data: %d\n", err);
return;
}
printk("A-GNSS data received (%zu bytes), processing...\n", result.agnss_sz);
err = nrf_cloud_agnss_process(result.buf, result.agnss_sz);
if (err) {
printk("Failed to process A-GNSS data: %d\n", err);
} else {
printk("A-GNSS data processed successfully\n");
}
}
Results in
A-GNSS data received (3179 bytes), processing... [00:00:18.806,030] <err> nrf_cloud_agnss: Cannot parse schema version: 72 Failed to process A-GNSS data: -77
Which I just can't comprehend - where am I making a mistake? Or is that a bug in nrf cloud?
Full log:
*** Booting nRF Connect SDK v3.0.2-89ba1294ac9b *** *** Using Zephyr OS v4.0.99-f791c49f492c *** Location sample started Connecting to LTE... Waiting for LTE connection PSM enabled +CEREG: 2,"04CF","01C9D101",7 LTE event received: 0 Network registration status: 2 LTE event received: 4 LTE event received: 5 +CSCON: 1 LTE event received: 3 +CEREG: 5,"04CF","01C9D101",7,,,"11100000","11100000" LTE event received: 0 Network registration status: 5 Connected to LTE Connected to LTE LTE connected Waiting for current time LTE event received: 1 %XTIME: "80","52801091335480","01" Current time updated Location library initialized, error: 0 Requesting A-GNSS data from nRF Cloud... [00:00:13.803,222] <inf> nrf_cloud_info: Device ID: nrf-359404230094402 [00:00:13.810,852] <inf> nrf_cloud_info: IMEI: 359404230094402 %XTIME: ,"52801091335480","01" [00:00:13.940,826] <inf> nrf_cloud_info: UUID: 50343956-3037-4b5e-8071-240adfc896e8 [00:00:13.949,829] <inf> nrf_cloud_info: Modem FW: mfw_nrf91x1_2.0.2 [00:00:13.956,634] <inf> nrf_cloud_info: Protocol: REST [00:00:13.963,043] <inf> nrf_cloud_info: Download protocol: HTTPS [00:00:13.969,512] <inf> nrf_cloud_info: Sec tag: 16842753 [00:00:13.976,287] <inf> nrf_cloud_info: Host name: api.nrfcloud.com A-GNSS data received (3179 bytes), processing... [00:00:18.806,030] <err> nrf_cloud_agnss: Cannot parse schema version: 72 Failed to process A-GNSS data: -77 Requesting low accuracy GNSS location... %NCELLMEAS: 0,"01C9D101","23002","04CF",104,6300,111,38,24,17478,6300,257,26,2,0,17411 LTE event received: 7
I am also providing a link to the repository with the full code - it is a modified Location nordic sample. I am using SDK 3.0.2