gnss: Support using ofono when compiled with HAVE_MMGLIB

This commit is contained in:
ArenM
2021-09-04 12:18:52 -04:00
parent e6df81778e
commit f7c655c297
2 changed files with 28 additions and 11 deletions

View File

@@ -27,13 +27,26 @@ gboolean gnss_upload_assistance_data(struct EG25Manager *manager)
return FALSE; return FALSE;
} }
/* data upload isn't necessary to bring the modem onine, so we should wait
* until we've finished the rest of our configuration */
if (!manager->modem_iface ||
manager->modem_state < EG25_STATE_CONFIGURED ||
manager->modem_state > EG25_STATE_CONNECTED) {
g_message ("Rescheduling upload since modem isn't online yet, in %ds",
RESCHEDULE_IN_SECS);
manager->gnss_assistance_step = EG25_GNSS_STEP_LAST;
return TRUE;
}
#ifdef HAVE_MMGLIB
/* ModemManager's Location is only available after unlocking */ /* ModemManager's Location is only available after unlocking */
if(!manager->mm_location) { if(manager->modem_iface == MODEM_IFACE_MODEMMANAGER && !manager->mm_location) {
g_message ("Rescheduling upload since Location interface is not available, in %ds", g_message ("Rescheduling upload since Location interface is not available, in %ds",
RESCHEDULE_IN_SECS); RESCHEDULE_IN_SECS);
manager->gnss_assistance_step = EG25_GNSS_STEP_LAST; manager->gnss_assistance_step = EG25_GNSS_STEP_LAST;
return TRUE; return TRUE;
} }
#endif
manager->gnss_assistance_step = EG25_GNSS_STEP_FIRST; manager->gnss_assistance_step = EG25_GNSS_STEP_FIRST;
gnss_step(manager); gnss_step(manager);
@@ -421,10 +434,12 @@ void gnss_step(struct EG25Manager *manager)
#ifdef HAVE_MMGLIB #ifdef HAVE_MMGLIB
case EG25_GNSS_STEP_MM_GNSS_DISABLE: case EG25_GNSS_STEP_MM_GNSS_DISABLE:
g_message("GNSS assistance upload step (%d/%d): " if (manager->modem_iface == MODEM_IFACE_MODEMMANAGER) {
"disabling GNSS engine through ModemManager", g_message("GNSS assistance upload step (%d/%d): "
manager->gnss_assistance_step, EG25_GNSS_STEP_LAST); "disabling GNSS engine through ModemManager",
disable_mm_gnss(manager); manager->gnss_assistance_step, EG25_GNSS_STEP_LAST);
disable_mm_gnss(manager);
}
manager->gnss_assistance_step++; manager->gnss_assistance_step++;
/* fall-through */ /* fall-through */
#endif #endif
@@ -464,10 +479,12 @@ void gnss_step(struct EG25Manager *manager)
#ifdef HAVE_MMGLIB #ifdef HAVE_MMGLIB
case EG25_GNSS_STEP_MM_GNSS_ENABLE: case EG25_GNSS_STEP_MM_GNSS_ENABLE:
g_message("GNSS assistance upload step (%d/%d): " if (manager->modem_iface == MODEM_IFACE_MODEMMANAGER) {
"re-enabling GNSS through ModemManager", g_message("GNSS assistance upload step (%d/%d): "
manager->gnss_assistance_step, EG25_GNSS_STEP_LAST); "re-enabling GNSS through ModemManager",
enable_mm_gnss(manager); manager->gnss_assistance_step, EG25_GNSS_STEP_LAST);
enable_mm_gnss(manager);
}
manager->gnss_assistance_step++; manager->gnss_assistance_step++;
/* fall-through */ /* fall-through */
#endif #endif

View File

@@ -48,10 +48,10 @@ enum EG25State {
EG25_STATE_STARTED, // Modem has been started and declared itdata ready EG25_STATE_STARTED, // Modem has been started and declared itdata ready
EG25_STATE_ACQUIRED, // Modem has been probed by ModemManager EG25_STATE_ACQUIRED, // Modem has been probed by ModemManager
EG25_STATE_CONFIGURED, // Modem has been configured through AT commands EG25_STATE_CONFIGURED, // Modem has been configured through AT commands
EG25_STATE_SUSPENDING, // System is going into suspend
EG25_STATE_RESUMING, // System is being resumed, waiting for modem to come back
EG25_STATE_REGISTERED, // Modem is unlocked and registered to a network provider EG25_STATE_REGISTERED, // Modem is unlocked and registered to a network provider
EG25_STATE_CONNECTED, // Modem is connected (data connection active) EG25_STATE_CONNECTED, // Modem is connected (data connection active)
EG25_STATE_SUSPENDING, // System is going into suspend
EG25_STATE_RESUMING, // System is being resumed, waiting for modem to come back
EG25_STATE_RESETTING, // Something went wrong, we're restarting the modem EG25_STATE_RESETTING, // Something went wrong, we're restarting the modem
EG25_STATE_FINISHING EG25_STATE_FINISHING
}; };