aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2011-12-20 18:48:54 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-03-15 14:14:35 +0100
commit4495ba180e9d39ff8ae113387cc69eb3004b5612 (patch)
treee8bcdb73cb0d33b29420bb3b9945632c9b931a79 /src
parent516b0973318fa9cc4e928e1d47f5a40105d382b6 (diff)
core: implement Access Technology reporting
For 3GPP modems only for now..
Diffstat (limited to 'src')
-rw-r--r--src/mm-broadband-modem.c11
-rw-r--r--src/mm-iface-modem-3gpp.c26
-rw-r--r--src/mm-iface-modem-3gpp.h3
-rw-r--r--src/mm-iface-modem.c37
-rw-r--r--src/mm-iface-modem.h5
5 files changed, 75 insertions, 7 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index 03248e23..fbe655aa 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -1134,7 +1134,9 @@ reg_state_changed (MMAtSerialPort *port,
/* Report new registration state */
state = get_consolidated_reg_state (self);
- mm_iface_modem_3gpp_update_registration_state (MM_IFACE_MODEM_3GPP (self), state);
+ mm_iface_modem_3gpp_update_registration_state (MM_IFACE_MODEM_3GPP (self),
+ state,
+ act);
/* If registration is finished (either registered or failed) but the
* registration query hasn't completed yet, just remove the timeout and
@@ -1337,7 +1339,8 @@ register_in_network_timed_out (MMBroadbandModem *self)
/* Report IDLE registration state */
mm_iface_modem_3gpp_update_registration_state (MM_IFACE_MODEM_3GPP (self),
- MM_MODEM_3GPP_REGISTRATION_STATE_IDLE);
+ MM_MODEM_3GPP_REGISTRATION_STATE_IDLE,
+ MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN);
g_simple_async_result_take_error (
self->priv->pending_reg_request,
@@ -1602,10 +1605,10 @@ registration_status_check_ready (MMBroadbandModem *self,
/* Report new registration state */
mm_iface_modem_3gpp_update_registration_state (MM_IFACE_MODEM_3GPP (self),
- get_consolidated_reg_state (self));
+ get_consolidated_reg_state (self),
+ act);
/* TODO: report LAC/CI location */
- /* TODO: report access technology, if available */
g_simple_async_result_set_op_res_gboolean (operation_result, TRUE);
}
diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c
index 33a707a1..1ff7a11a 100644
--- a/src/mm-iface-modem-3gpp.c
+++ b/src/mm-iface-modem-3gpp.c
@@ -460,9 +460,22 @@ bearer_3gpp_connection_forbidden (MMIfaceModem3gpp *self)
g_object_unref (bearer_list);
}
+#define ALL_3GPP_ACCESS_TECHNOLOGIES_MASK \
+ (MM_MODEM_ACCESS_TECHNOLOGY_GSM | \
+ MM_MODEM_ACCESS_TECHNOLOGY_GSM_COMPACT | \
+ MM_MODEM_ACCESS_TECHNOLOGY_GPRS | \
+ MM_MODEM_ACCESS_TECHNOLOGY_EDGE | \
+ MM_MODEM_ACCESS_TECHNOLOGY_UMTS | \
+ MM_MODEM_ACCESS_TECHNOLOGY_HSDPA | \
+ MM_MODEM_ACCESS_TECHNOLOGY_HSUPA | \
+ MM_MODEM_ACCESS_TECHNOLOGY_HSPA | \
+ MM_MODEM_ACCESS_TECHNOLOGY_HSPA_PLUS | \
+ MM_MODEM_ACCESS_TECHNOLOGY_LTE)
+
void
mm_iface_modem_3gpp_update_registration_state (MMIfaceModem3gpp *self,
- MMModem3gppRegistrationState new_state)
+ MMModem3gppRegistrationState new_state,
+ MMModemAccessTechnology access_tech)
{
MMModem3gppRegistrationState old_state;
@@ -519,13 +532,19 @@ mm_iface_modem_3gpp_update_registration_state (MMIfaceModem3gpp *self,
NULL);
/* TODO: Update signal quality */
- /* TODO: Update access technology */
+
+ mm_iface_modem_update_access_tech (MM_IFACE_MODEM (self),
+ access_tech,
+ ALL_3GPP_ACCESS_TECHNOLOGIES_MASK);
mm_iface_modem_update_state (MM_IFACE_MODEM (self),
MM_MODEM_STATE_REGISTERED,
MM_MODEM_STATE_REASON_NONE);
break;
case MM_MODEM_3GPP_REGISTRATION_STATE_SEARCHING:
+ mm_iface_modem_update_access_tech (MM_IFACE_MODEM (self),
+ 0,
+ ALL_3GPP_ACCESS_TECHNOLOGIES_MASK);
bearer_3gpp_connection_forbidden (self);
mm_iface_modem_update_state (MM_IFACE_MODEM (self),
MM_MODEM_STATE_SEARCHING,
@@ -534,6 +553,9 @@ mm_iface_modem_3gpp_update_registration_state (MMIfaceModem3gpp *self,
case MM_MODEM_3GPP_REGISTRATION_STATE_IDLE:
case MM_MODEM_3GPP_REGISTRATION_STATE_DENIED:
case MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN:
+ mm_iface_modem_update_access_tech (MM_IFACE_MODEM (self),
+ 0,
+ ALL_3GPP_ACCESS_TECHNOLOGIES_MASK);
bearer_3gpp_connection_forbidden (self);
mm_iface_modem_update_state (MM_IFACE_MODEM (self),
MM_MODEM_STATE_ENABLED,
diff --git a/src/mm-iface-modem-3gpp.h b/src/mm-iface-modem-3gpp.h
index 37f0fa46..ccd225c1 100644
--- a/src/mm-iface-modem-3gpp.h
+++ b/src/mm-iface-modem-3gpp.h
@@ -179,7 +179,8 @@ void mm_iface_modem_3gpp_shutdown (MMIfaceModem3gpp *self);
* the interface asks to run registration state checks.
* Returns FALSE if registration process is still ongoing. */
void mm_iface_modem_3gpp_update_registration_state (MMIfaceModem3gpp *self,
- MMModem3gppRegistrationState new_state);
+ MMModem3gppRegistrationState new_state,
+ MMModemAccessTechnology access_tech);
/* Run all registration checks */
void mm_iface_modem_3gpp_run_all_registration_checks (MMIfaceModem3gpp *self,
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c
index 4ac905b4..6a69fc30 100644
--- a/src/mm-iface-modem.c
+++ b/src/mm-iface-modem.c
@@ -245,6 +245,43 @@ handle_list_bearers (MmGdbusModem *skeleton,
/*****************************************************************************/
+void
+mm_iface_modem_update_access_tech (MMIfaceModem *self,
+ MMModemAccessTechnology new_access_tech,
+ guint32 mask)
+{
+ MmGdbusModem *skeleton = NULL;
+ MMModemAccessTechnology access_tech;
+ gchar *old_access_tech_string;
+ gchar *new_access_tech_string;
+ const gchar *dbus_path;
+
+ g_object_get (self,
+ MM_IFACE_MODEM_DBUS_SKELETON, &skeleton,
+ NULL);
+
+ access_tech = mm_gdbus_modem_get_access_technologies (skeleton);
+ old_access_tech_string = mm_common_get_access_technologies_string (access_tech);
+
+ /* Clear the flags to be set */
+ access_tech &= ~mask;
+ /* And set our new flags */
+ access_tech |= new_access_tech;
+ mm_gdbus_modem_set_access_technologies (skeleton, access_tech);
+
+ /* Log */
+ new_access_tech_string = mm_common_get_access_technologies_string (access_tech);
+ dbus_path = g_dbus_object_get_object_path (G_DBUS_OBJECT (self));
+ mm_info ("Modem %s: access technology changed (%s -> %s)",
+ dbus_path,
+ old_access_tech_string,
+ new_access_tech_string);
+ g_free (old_access_tech_string);
+ g_free (new_access_tech_string);
+}
+
+/*****************************************************************************/
+
static void
bearer_list_count_connected (MMBearer *bearer,
guint *count)
diff --git a/src/mm-iface-modem.h b/src/mm-iface-modem.h
index 9aed17e0..30278adf 100644
--- a/src/mm-iface-modem.h
+++ b/src/mm-iface-modem.h
@@ -296,4 +296,9 @@ void mm_iface_modem_update_state (MMIfaceModem *self,
MMModemState new_state,
MMModemStateReason reason);
+/* Allow reporting new access tech */
+void mm_iface_modem_update_access_tech (MMIfaceModem *self,
+ MMModemAccessTechnology access_tech,
+ guint32 mask);
+
#endif /* MM_IFACE_MODEM_H */