diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2016-10-11 16:28:17 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2016-10-12 11:29:52 +0200 |
commit | 151d608eec4c7728551e03c9b375306c147042b4 (patch) | |
tree | d3b210eceb9ca7ec90bb36914d7f271528d7248b /plugins/ublox/mm-modem-helpers-ublox.c | |
parent | d7fdda224765e8ea9c1b4713dfa3708f2251b8c3 (diff) |
ublox: new u-blox specific +CFUN? response parser
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 */ |