Hi Dara, > -----Original Message----- > From: ofono-boun...@ofono.org > [mailto:ofono-boun...@ofono.org] On Behalf Of Dara Spieker-Doyle > Sent: 08 February 2011 13:05 > To: ofono@ofono.org > Subject: [PATCH 5/7] cdmamodem: Add Signal Strength Support >
> +static gboolean cdma_get_next_number(const char *line, gint > *number) { > + int pos; > + int end; > + int len; > + int value = 0; > + > + len = strlen(line); > + > + pos = 0; > + end = pos; > + > + while (line[end] >= '0' && line[end] <= '9') { > + value = value * 10 + (int)(line[end] - '0'); > + end += 1; > + } > + > + if (pos == end) > + return FALSE; > + > + pos = skip_to_next_field(line, end, len); > + > + if (number) > + *number = value; > + > + return TRUE; > +} > + This is a duplicate of g_at_result_iter_next_number(). Why cant use this function instead of cdma_get_next_number() ? > +static void cdma_csq_cb(gboolean ok, GAtResult *result, gpointer > +user_data) { > + struct cb_data *cbd = user_data; > + ofono_cdma_netreg_strength_cb_t cb = cbd->cb; > + const char *prefix = cbd->user; > + struct ofono_error error; > + const char *attr; > + int strength = -1; > + > + decode_at_error(&error, g_at_result_final_response(result)); > + > + if (!ok) { > + cb(&error, -1, cbd->data); > + return; > + } > + > + if (at_util_parse_attr(result, prefix, &attr) == FALSE) { > + CALLBACK_WITH_FAILURE(cb, -1, cbd->data); > + return; > + } > + > + cdma_get_next_number(attr, &strength); > + > + DBG("csq_cb: %d", strength); > + > + cb(&error, at_util_convert_signal_strength(strength), > cbd->data); } Refer csq_cb() implementation in /drivers/atmodem/network-registration.c BR, Rajesh _______________________________________________ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono