cdma: check for +SPSERVICE and $SPERI
Which are Sprint-specific commands which appear to be implemented by various phones for getting access technology and roaming status.
This commit is contained in:
@@ -61,6 +61,8 @@ typedef struct {
|
|||||||
gboolean evdo_rev0;
|
gboolean evdo_rev0;
|
||||||
gboolean evdo_revA;
|
gboolean evdo_revA;
|
||||||
gboolean reg_try_css;
|
gboolean reg_try_css;
|
||||||
|
gboolean has_spservice;
|
||||||
|
gboolean has_speri;
|
||||||
|
|
||||||
MMModemCdmaRegistrationState cdma_1x_reg_state;
|
MMModemCdmaRegistrationState cdma_1x_reg_state;
|
||||||
MMModemCdmaRegistrationState evdo_reg_state;
|
MMModemCdmaRegistrationState evdo_reg_state;
|
||||||
@@ -383,6 +385,26 @@ get_enable_info_done (MMModem *modem,
|
|||||||
/* Modem base class handles the response for us */
|
/* Modem base class handles the response for us */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
spservice_done (MMAtSerialPort *port,
|
||||||
|
GString *response,
|
||||||
|
GError *error,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
if (!error)
|
||||||
|
MM_GENERIC_CDMA_GET_PRIVATE (user_data)->has_spservice = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
speri_done (MMAtSerialPort *port,
|
||||||
|
GString *response,
|
||||||
|
GError *error,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
if (!error)
|
||||||
|
MM_GENERIC_CDMA_GET_PRIVATE (user_data)->has_speri = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
enable_all_done (MMModem *modem, GError *error, gpointer user_data)
|
enable_all_done (MMModem *modem, GError *error, gpointer user_data)
|
||||||
{
|
{
|
||||||
@@ -408,6 +430,10 @@ enable_all_done (MMModem *modem, GError *error, gpointer user_data)
|
|||||||
|
|
||||||
/* Grab device info right away */
|
/* Grab device info right away */
|
||||||
mm_modem_get_info (modem, get_enable_info_done, NULL);
|
mm_modem_get_info (modem, get_enable_info_done, NULL);
|
||||||
|
|
||||||
|
/* Check for support of Sprint-specific phone commands */
|
||||||
|
mm_at_serial_port_queue_command (priv->primary, "+SPSERVICE?", 3, spservice_done, self);
|
||||||
|
mm_at_serial_port_queue_command (priv->primary, "$SPERI?", 3, speri_done, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
@@ -432,6 +432,43 @@ mm_gsm_parse_creg_response (GMatchInfo *info,
|
|||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
mm_cdma_parse_spservice_response (const char *reply,
|
||||||
|
MMModemCdmaRegistrationState *out_cdma_1x_state,
|
||||||
|
MMModemCdmaRegistrationState *out_evdo_state)
|
||||||
|
{
|
||||||
|
const char *p;
|
||||||
|
|
||||||
|
g_return_val_if_fail (reply != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (out_cdma_1x_state != NULL, FALSE);
|
||||||
|
g_return_val_if_fail (out_evdo_state != NULL, FALSE);
|
||||||
|
|
||||||
|
p = mm_strip_tag (reply, "+SPSERVICE:");
|
||||||
|
if (!isdigit (*p))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
switch (atoi (p)) {
|
||||||
|
case 0: /* no service */
|
||||||
|
*out_cdma_1x_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN;
|
||||||
|
*out_evdo_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN;
|
||||||
|
break;
|
||||||
|
case 1: /* 1xRTT */
|
||||||
|
*out_cdma_1x_state = MM_MODEM_CDMA_REGISTRATION_STATE_REGISTERED;
|
||||||
|
*out_evdo_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN;
|
||||||
|
break;
|
||||||
|
case 2: /* EVDO rev 0 */
|
||||||
|
case 3: /* EVDO rev A */
|
||||||
|
*out_cdma_1x_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN;
|
||||||
|
*out_evdo_state = MM_MODEM_CDMA_REGISTRATION_STATE_REGISTERED;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
mm_strip_tag (const char *str, const char *cmd)
|
mm_strip_tag (const char *str, const char *cmd)
|
||||||
{
|
{
|
||||||
|
@@ -17,6 +17,8 @@
|
|||||||
#ifndef MM_MODEM_HELPERS_H
|
#ifndef MM_MODEM_HELPERS_H
|
||||||
#define MM_MODEM_HELPERS_H
|
#define MM_MODEM_HELPERS_H
|
||||||
|
|
||||||
|
#include "mm-modem-cdma.h"
|
||||||
|
|
||||||
#define MM_SCAN_TAG_STATUS "status"
|
#define MM_SCAN_TAG_STATUS "status"
|
||||||
#define MM_SCAN_TAG_OPER_LONG "operator-long"
|
#define MM_SCAN_TAG_OPER_LONG "operator-long"
|
||||||
#define MM_SCAN_TAG_OPER_SHORT "operator-short"
|
#define MM_SCAN_TAG_OPER_SHORT "operator-short"
|
||||||
@@ -41,5 +43,9 @@ gboolean mm_gsm_parse_creg_response (GMatchInfo *info,
|
|||||||
|
|
||||||
const char *mm_strip_tag (const char *str, const char *cmd);
|
const char *mm_strip_tag (const char *str, const char *cmd);
|
||||||
|
|
||||||
|
gboolean mm_cdma_parse_spservice_response (const char *reply,
|
||||||
|
MMModemCdmaRegistrationState *out_cdma_1x_state,
|
||||||
|
MMModemCdmaRegistrationState *out_evdo_state);
|
||||||
|
|
||||||
#endif /* MM_MODEM_HELPERS_H */
|
#endif /* MM_MODEM_HELPERS_H */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user