gnss: add GNSS assistance support

Automatically fetch the GNSS assistance data from the Web
to heavily reduce the time to acquire a GNSS lock by uploading
the assistance data to the modem.
This feature is optional and can be disabled in the configuration
as people may prefer to not download the assistance data from
the Quectel/Qualcomm servers.
Also configure the GNSS engine to optimize the performance
and power consumption.
This commit is contained in:
Dylan Van Assche
2021-05-12 19:37:21 +02:00
parent 5da7c88fc4
commit 9cfe782f74
11 changed files with 625 additions and 12 deletions

View File

@@ -7,6 +7,7 @@
#include "at.h"
#include "suspend.h"
#include "gpio.h"
#include "gnss.h"
#include <fcntl.h>
#include <stdio.h>
@@ -215,20 +216,37 @@ static gboolean modem_response(gint fd,
g_message("Response: [%s]", response);
/*
* When the modem is started, it outputs 'RDY' to indicate that
* it is ready to receive AT commands.
*/
if (strcmp(response, "RDY") == 0) {
suspend_inhibit(manager, TRUE, TRUE);
manager->modem_state = EG25_STATE_STARTED;
}
/*
* Search for 'QGPSURC: "xtradataexpire"' in response to detect
* if GNSS assistance data must be re-uploaded.
* If that's the case, check if no AT commands are being processed
* to avoid deadlocks and start upload.
*/
else if (strstr(response, "QGPSURC: \"xtradataexpire\"") && manager->at_cmds == NULL)
gnss_upload_assistance_data(manager);
/* AT command failed, retry */
else if (strstr(response, "ERROR"))
retry_at_command(manager);
else if (strstr(response, "OK")) {
/*
* Successfull AT responses contain 'OK', except for AT+QFUPL which also
* returns 'CONNECT' when the modem is ready to receive data over serial
*/
else if (strstr(response, "OK") || strstr(response, "CONNECT")) {
if (manager->at_callback != NULL)
manager->at_callback(manager, response);
else
g_warning("AT command succesfull but no callback registered");
}
/* Not a recognized response, try running next command, just in case */
else
// Not a recognized response, try running next command, just in case
at_next_command(manager);
}