cdma: make ERI parsing generic

This commit is contained in:
Dan Williams
2010-05-18 12:24:42 -07:00
parent 40a4a1d774
commit 533ffaddc4
3 changed files with 10 additions and 10 deletions

View File

@@ -1431,11 +1431,13 @@ reg_query_speri_done (MMAtSerialPort *port,
{ {
MMCallbackInfo *info = user_data; MMCallbackInfo *info = user_data;
gboolean roam = FALSE; gboolean roam = FALSE;
const char *p;
if (error) if (error)
goto done; goto done;
if (!mm_cdma_parse_speri_response (response->str, &roam, NULL)) p = mm_strip_tag (response->str, "$SPERI:");
if (!p || !mm_cdma_parse_eri (p, &roam, NULL))
goto done; goto done;
/* Change the 1x and EVDO registration states to roaming if they were /* Change the 1x and EVDO registration states to roaming if they were

View File

@@ -686,11 +686,10 @@ static const EriItem eris[] = {
}; };
gboolean gboolean
mm_cdma_parse_speri_response (const char *reply, mm_cdma_parse_eri (const char *reply,
gboolean *out_roaming, gboolean *out_roaming,
const char **out_desc) const char **out_desc)
{ {
const char *p;
long int ind; long int ind;
const EriItem *iter = &eris[0]; const EriItem *iter = &eris[0];
gboolean found = FALSE; gboolean found = FALSE;
@@ -698,9 +697,8 @@ mm_cdma_parse_speri_response (const char *reply,
g_return_val_if_fail (reply != NULL, FALSE); g_return_val_if_fail (reply != NULL, FALSE);
g_return_val_if_fail (out_roaming != NULL, FALSE); g_return_val_if_fail (out_roaming != NULL, FALSE);
p = mm_strip_tag (reply, "$SPERI:");
errno = 0; errno = 0;
ind = strtol (p, NULL, 10); ind = strtol (reply, NULL, 10);
if (errno == 0) { if (errno == 0) {
while (iter->num != -1) { while (iter->num != -1) {
if (iter->num == ind) { if (iter->num == ind) {

View File

@@ -49,7 +49,7 @@ gboolean mm_cdma_parse_spservice_response (const char *reply,
MMModemCdmaRegistrationState *out_cdma_1x_state, MMModemCdmaRegistrationState *out_cdma_1x_state,
MMModemCdmaRegistrationState *out_evdo_state); MMModemCdmaRegistrationState *out_evdo_state);
gboolean mm_cdma_parse_speri_response (const char *reply, gboolean mm_cdma_parse_eri (const char *reply,
gboolean *out_roaming, gboolean *out_roaming,
const char **out_desc); const char **out_desc);