diff options
Diffstat (limited to 'plugins/ublox/mm-modem-helpers-ublox.c')
-rw-r--r-- | plugins/ublox/mm-modem-helpers-ublox.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/plugins/ublox/mm-modem-helpers-ublox.c b/plugins/ublox/mm-modem-helpers-ublox.c index 54e09667..b82b2d0c 100644 --- a/plugins/ublox/mm-modem-helpers-ublox.c +++ b/plugins/ublox/mm-modem-helpers-ublox.c @@ -242,6 +242,38 @@ out: } /*****************************************************************************/ +/* CFUN? response parser */ + +gboolean +mm_ublox_parse_cfun_response (const gchar *response, + MMModemPowerState *out_state, + GError **error) +{ + guint state; + + if (!mm_3gpp_parse_cfun_query_response (response, &state, error)) + return FALSE; + + switch (state) { + case 1: + *out_state = MM_MODEM_POWER_STATE_ON; + return TRUE; + case 0: + /* minimum functionality */ + case 4: + /* airplane mode */ + case 19: + /* minimum functionality with SIM deactivated */ + *out_state = MM_MODEM_POWER_STATE_LOW; + return TRUE; + default: + g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED, + "Unknown +CFUN state: %u", state); + return FALSE; + } +} + +/*****************************************************************************/ /* URAT=? response parser */ /* Index of the array is the ublox-specific value */ |