mirror of
https://gitlab.com/mobian1/eg25-manager.git
synced 2025-08-30 07:42:23 +02:00
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:
22
src/at.c
22
src/at.c
@@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user