static void ril_nitz_notify(struct ril_msg *message, gpointer user_data) { struct ofono_netreg *netreg = user_data; struct netreg_data *nd = ofono_netreg_get_data(netreg); int year, mon, mday, hour, min, sec, dst, tzi; char tzs, tz[4]; gchar *nitz; if ((nitz = g_ril_unsol_parse_nitz(nd->ril, message)) == NULL) goto error; sscanf(nitz, "%u/%u/%u,%u:%u:%u%c%u,%u", &year, &mon, &mday, &hour, &min, &sec, &tzs, &tzi, &dst); sprintf(tz, "%c%d", tzs, tzi); nd->time.utcoff = atoi(tz) * 15 * 60; nd->time.dst = dst; nd->time.sec = sec; nd->time.min = min; nd->time.hour = hour; nd->time.mday = mday; nd->time.mon = mon; nd->time.year = 2000 + year; ofono_netreg_time_notify(netreg, &nd->time); g_free(nitz); return; error: ofono_error("%s: unable to notify ofono about NITZ", __func__); }
static void ifx_ctzdst_notify(GAtResult *result, gpointer user_data) { struct ofono_netreg *netreg = user_data; struct netreg_data *nd = ofono_netreg_get_data(netreg); int dst; GAtResultIter iter; g_at_result_iter_init(&iter, result); if (!g_at_result_iter_next(&iter, "+CTZDST:")) return; if (!g_at_result_iter_next_number(&iter, &dst)) return; DBG("dst %d", dst); nd->time.dst = dst; if (nd->nitz_timeout > 0) { g_source_remove(nd->nitz_timeout); nd->nitz_timeout = 0; } ofono_netreg_time_notify(netreg, &nd->time); }
static gboolean notify_time(gpointer user_data) { struct ofono_netreg *netreg = user_data; struct netreg_data *nd = ofono_netreg_get_data(netreg); nd->nitz_timeout = 0; ofono_netreg_time_notify(netreg, &nd->time); return FALSE; }
static void mbm_etzv_notify(GAtResult *result, gpointer user_data) { struct ofono_netreg *netreg = user_data; struct netreg_data *nd = ofono_netreg_get_data(netreg); int year, mon, mday, hour, min, sec; const char *tz, *time, *timestamp; GAtResultIter iter; g_at_result_iter_init(&iter, result); if (g_at_result_iter_next(&iter, "*ETZV:") == FALSE) return; if (g_at_result_iter_next_string(&iter, &tz) == FALSE) return; if (g_at_result_iter_next_string(&iter, &time) == FALSE) time = NULL; if (g_at_result_iter_next_string(&iter, ×tamp) == FALSE) timestamp = NULL; DBG("tz %s time %s timestamp %s", tz, time, timestamp); if (time == NULL) { year = -1; mon = -1; mday = -1; hour = -1; min = -1; sec = -1; } else { if (sscanf(time, "%u/%u/%u,%u:%u:%u", &year, &mon, &mday, &hour, &min, &sec) != 6) return; } nd->time.utcoff = atoi(tz) * 15 * 60; nd->time.sec = sec; nd->time.min = min; nd->time.hour = hour; nd->time.mday = mday; nd->time.mon = mon; nd->time.year = year; ofono_netreg_time_notify(netreg, &nd->time); }
static void ril_nitz_notify(struct ril_msg *message, gpointer user_data) { struct ofono_netreg *netreg = user_data; struct netreg_data *nd = ofono_netreg_get_data(netreg); struct parcel rilp; int year, mon, mday, hour, min, sec, dst, tzi; char tzs, tz[4]; gchar *nitz; if (message->req != RIL_UNSOL_NITZ_TIME_RECEIVED) goto error; ril_util_init_parcel(message, &rilp); nitz = parcel_r_string(&rilp); g_ril_append_print_buf(nd->ril, "(%s)", nitz); g_ril_print_unsol(nd->ril, message); sscanf(nitz, "%u/%u/%u,%u:%u:%u%c%u,%u", &year, &mon, &mday, &hour, &min, &sec, &tzs, &tzi, &dst); sprintf(tz, "%c%d", tzs, tzi); nd->time.utcoff = atoi(tz) * 15 * 60; nd->time.dst = dst; nd->time.sec = sec; nd->time.min = min; nd->time.hour = hour; nd->time.mday = mday; nd->time.mon = mon; nd->time.year = 2000 + year; ofono_netreg_time_notify(netreg, &nd->time); g_free(nitz); return; error: ofono_error("Unable to notify ofono about nitz"); }
static void ctzv_notify(GAtResult *result, gpointer user_data) { struct ofono_netreg *netreg = user_data; struct netreg_data *nd = ofono_netreg_get_data(netreg); const char *tz; GAtResultIter iter; g_at_result_iter_init(&iter, result); if (!g_at_result_iter_next(&iter, "+CTZV:")) return; if (!g_at_result_iter_next_unquoted_string(&iter, &tz)) return; DBG("tz %s", tz); nd->time.utcoff = atoi(tz) * 15 * 60; ofono_netreg_time_notify(netreg, &nd->time); }