mirror of git://git.sysmocom.de/ofono
Instead of implementing an own copy of requesting and parsing
CREG, reuse the existing one from at-modem.
This commit is contained in:
parent
d90cfdd71c
commit
90dadace21
|
@ -48,7 +48,6 @@
|
||||||
static const char *none_prefix[] = { NULL };
|
static const char *none_prefix[] = { NULL };
|
||||||
static const char *cmer_prefix[] = { "+CMER:", NULL };
|
static const char *cmer_prefix[] = { "+CMER:", NULL };
|
||||||
static const char *ureg_prefix[] = { "+UREG:", NULL };
|
static const char *ureg_prefix[] = { "+UREG:", NULL };
|
||||||
static const char *creg_prefix[] = { "+CREG:", NULL };
|
|
||||||
|
|
||||||
struct netreg_data {
|
struct netreg_data {
|
||||||
struct at_netreg_data at_data;
|
struct at_netreg_data at_data;
|
||||||
|
@ -249,30 +248,28 @@ static gboolean is_registered(int status)
|
||||||
status == NETWORK_REGISTRATION_STATUS_ROAMING;
|
status == NETWORK_REGISTRATION_STATUS_ROAMING;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ublox_creg_cb(gboolean ok, GAtResult *result,
|
static void registration_status_cb(const struct ofono_error *error,
|
||||||
gpointer user_data)
|
int status, int lac, int ci, int tech,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
struct tech_query *tq = user_data;
|
struct tech_query *tq = user_data;
|
||||||
struct netreg_data *nd = ofono_netreg_get_data(tq->netreg);
|
struct netreg_data *nd = ofono_netreg_get_data(tq->netreg);
|
||||||
int status;
|
struct ofono_netreg *netreg = tq->netreg;
|
||||||
int lac;
|
|
||||||
int ci;
|
|
||||||
int tech;
|
|
||||||
|
|
||||||
nd->updating_status = false;
|
|
||||||
|
|
||||||
if (!ok)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (at_util_parse_reg(result, "+CREG:", NULL, &status,
|
|
||||||
&lac, &ci, &tech, OFONO_VENDOR_GENERIC) == FALSE)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* The query provided a tech, use that */
|
/* The query provided a tech, use that */
|
||||||
if (is_registered(status) && tq->tech != -1)
|
if (is_registered(status) && tq->tech != -1)
|
||||||
tech = tq->tech;
|
tech = tq->tech;
|
||||||
|
|
||||||
ofono_netreg_status_notify(tq->netreg, status, lac, ci, tech);
|
g_free(tq);
|
||||||
|
|
||||||
|
nd->updating_status = false;
|
||||||
|
|
||||||
|
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
|
||||||
|
DBG("Error during registration status query");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ofono_netreg_status_notify(netreg, status, lac, ci, tech);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ublox_ureg_cb(gboolean ok, GAtResult *result,
|
static void ublox_ureg_cb(gboolean ok, GAtResult *result,
|
||||||
|
@ -334,13 +331,8 @@ static void ureg_notify(GAtResult *result, gpointer user_data)
|
||||||
tq->tech = ublox_ureg_state_to_tech(state);
|
tq->tech = ublox_ureg_state_to_tech(state);
|
||||||
tq->netreg = netreg;
|
tq->netreg = netreg;
|
||||||
|
|
||||||
if (g_at_chat_send(nd->at_data.chat, "AT+CREG?", creg_prefix,
|
nd->updating_status = true;
|
||||||
ublox_creg_cb, tq, g_free) > 0) {
|
at_registration_status(netreg, registration_status_cb, tq);
|
||||||
nd->updating_status = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free(tq);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void creg_notify(GAtResult *result, gpointer user_data)
|
static void creg_notify(GAtResult *result, gpointer user_data)
|
||||||
|
|
Loading…
Reference in New Issue