ofono_netreg_strength_notify(netreg, strength);
}
+static void telit_ciev_notify(GAtResult *result, gpointer user_data)
+{
+ struct ofono_netreg *netreg = user_data;
+ struct netreg_data *nd = ofono_netreg_get_data(netreg);
+ const char *signal_identifier = "rssi";
+ const char *ind_str;
+ int strength;
+ GAtResultIter iter;
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+CIEV:"))
+ return;
+
+ if (!g_at_result_iter_next_unquoted_string(&iter, &ind_str))
+ return;
+
+ if (!g_str_equal(signal_identifier, ind_str))
+ return;
+
+ if (!g_at_result_iter_next_number(&iter, &strength))
+ return;
+
+ if (strength == nd->signal_invalid)
+ strength = -1;
+ else
+ strength = (strength * 100) / (nd->signal_max - nd->signal_min);
+
+ ofono_netreg_strength_notify(netreg, strength);
+}
+
static void ctzv_notify(GAtResult *result, gpointer user_data)
{
struct ofono_netreg *netreg = user_data;
at_cmer_query_cb, netreg, NULL);
g_at_chat_register(nd->chat, "+CIEV:",
ciev_notify, FALSE, netreg, NULL);
+
+ /*
+ * Telit uses strings instead of numbers to identify indicators
+ * in a +CIEV URC.
+ * Handle them in a separate function to keep the code clean.
+ */
+ if (nd->vendor == OFONO_VENDOR_TELIT)
+ g_at_chat_register(nd->chat, "+CIEV:",
+ telit_ciev_notify, FALSE, netreg, NULL);
+ else
+ g_at_chat_register(nd->chat, "+CIEV:",
+ ciev_notify, FALSE, netreg, NULL);
+
g_at_chat_register(nd->chat, "+CREG:",
creg_notify, FALSE, netreg, NULL);