huaweicdma: Add data strength notification support

This commit is contained in:
Guillaume Zajac 2011-12-06 10:33:43 +01:00 committed by Denis Kenzior
parent 1e052ef1fe
commit dcd1730c3a
1 changed files with 28 additions and 0 deletions

View File

@ -141,6 +141,31 @@ error:
ofono_error("Invalid RSSILVL value");
}
static void hrssilvl_notify(GAtResult *result, gpointer user_data)
{
struct ofono_cdma_netreg *netreg = user_data;
int strength;
GAtResultIter iter;
g_at_result_iter_init(&iter, result);
if (!g_at_result_iter_next(&iter, "^HRSSILVL:"))
goto error;
if (!g_at_result_iter_next_number(&iter, &strength))
goto error;
if (strength == 99)
strength = 100;
ofono_cdma_netreg_data_strength_notify(netreg, strength);
return;
error:
ofono_error("Invalid HRSSILVL value");
}
static void probe_cb(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_cdma_netreg *netreg = user_data;
@ -157,6 +182,9 @@ static void probe_cb(gboolean ok, GAtResult *result, gpointer user_data)
g_at_chat_register(chat, "^RSSILVL:",
rssilvl_notify, FALSE, netreg, NULL);
g_at_chat_register(chat, "^HRSSILVL:",
hrssilvl_notify, FALSE, netreg, NULL);
ofono_cdma_netreg_register(netreg);
}