diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2018-08-08 15:14:28 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2018-08-08 21:46:28 +0200 |
commit | 7e6b4d7aa942dfff996a12ccdc769085058056d0 (patch) | |
tree | 4cb6b99ba88c9ee6941481f4aad1bf66c8822b2b /src | |
parent | f58a652578812809e14f0cc9fb82d6b2633a331e (diff) |
api,location: give Tracking Area Code field in 3GPP location info
The "location area code" field is given in GSM/UMTS networks
exclusively. LTE networks use the concept of "tracking area code"
instead.
This patch updates the Location interface to Provide separate fields
for LAC and TAC, instead of giving TAC values in the LAC field.
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-broadband-modem-qmi.c | 53 | ||||
-rw-r--r-- | src/mm-broadband-modem.c | 36 | ||||
-rw-r--r-- | src/mm-iface-modem-3gpp.c | 12 | ||||
-rw-r--r-- | src/mm-iface-modem-3gpp.h | 1 | ||||
-rw-r--r-- | src/mm-iface-modem-location.c | 18 | ||||
-rw-r--r-- | src/mm-iface-modem-location.h | 7 |
6 files changed, 89 insertions, 38 deletions
diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index 4be11867..aa640ef2 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -2016,7 +2016,7 @@ modem_load_supported_bands_finish (MMIfaceModem *_self, { MMBroadbandModemQmi *self = MM_BROADBAND_MODEM_QMI (_self); GArray *supported_bands; - + supported_bands = g_task_propagate_pointer (G_TASK (res), error); if (supported_bands) { if (self->priv->supported_bands) @@ -4397,6 +4397,7 @@ common_process_serving_system_3gpp (MMBroadbandModemQmi *self, const gchar *description; gboolean has_pcs_digit; guint16 lac; + guint16 tac; guint32 cid; MMModemAccessTechnology mm_access_technologies; MMModem3gppRegistrationState mm_cs_registration_state; @@ -4459,7 +4460,7 @@ common_process_serving_system_3gpp (MMBroadbandModemQmi *self, mm_iface_modem_3gpp_update_cs_registration_state (MM_IFACE_MODEM_3GPP (self), reg_state_3gpp); mm_iface_modem_3gpp_update_ps_registration_state (MM_IFACE_MODEM_3GPP (self), reg_state_3gpp); mm_iface_modem_3gpp_update_access_technologies (MM_IFACE_MODEM_3GPP (self), MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN); - mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), 0, 0); + mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), 0, 0, 0); return; } @@ -4548,18 +4549,22 @@ common_process_serving_system_3gpp (MMBroadbandModemQmi *self, if (mm_access_technologies & MM_MODEM_ACCESS_TECHNOLOGY_LTE) mm_iface_modem_3gpp_update_eps_registration_state (MM_IFACE_MODEM_3GPP (self), mm_ps_registration_state); - /* Get 3GPP location LAC and CI */ + /* Get 3GPP location LAC/TAC and CI */ lac = 0; + tac = 0; cid = 0; - if ((response_output && - qmi_message_nas_get_serving_system_output_get_lac_3gpp (response_output, &lac, NULL) && - qmi_message_nas_get_serving_system_output_get_cid_3gpp (response_output, &cid, NULL)) || - (indication_output && - qmi_indication_nas_serving_system_output_get_lac_3gpp (indication_output, &lac, NULL) && - qmi_indication_nas_serving_system_output_get_cid_3gpp (indication_output, &cid, NULL))) { - /* Only update info in the interface if we get something */ - mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), lac, cid); - } + if (response_output) { + qmi_message_nas_get_serving_system_output_get_lac_3gpp (response_output, &lac, NULL); + qmi_message_nas_get_serving_system_output_get_lte_tac (response_output, &tac, NULL); + qmi_message_nas_get_serving_system_output_get_cid_3gpp (response_output, &cid, NULL); + } else if (indication_output) { + qmi_indication_nas_serving_system_output_get_lac_3gpp (indication_output, &lac, NULL); + qmi_indication_nas_serving_system_output_get_lte_tac (indication_output, &tac, NULL); + qmi_indication_nas_serving_system_output_get_cid_3gpp (indication_output, &cid, NULL); + } + /* Only update info in the interface if we get something */ + if (cid && (lac || tac)) + mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), lac, tac, cid); /* Note: don't update access technologies with the ones retrieved here; they * are not really the 'current' access technologies */ @@ -4611,6 +4616,8 @@ process_common_info (QmiNasServiceStatus service_status, gboolean forbidden, gboolean lac_valid, guint16 lac, + gboolean tac_valid, + guint16 tac, gboolean cid_valid, guint32 cid, gboolean network_id_valid, @@ -4619,6 +4626,7 @@ process_common_info (QmiNasServiceStatus service_status, MMModem3gppRegistrationState *mm_cs_registration_state, MMModem3gppRegistrationState *mm_ps_registration_state, guint16 *mm_lac, + guint16 *mm_tac, guint32 *mm_cid, gchar **mm_operator_id) { @@ -4659,6 +4667,8 @@ process_common_info (QmiNasServiceStatus service_status, /* If we're registered either at home or roaming, try to get LAC/CID */ if (lac_valid) *mm_lac = lac; + if (tac_valid) + *mm_tac = tac; if (cid_valid) *mm_cid = cid; } @@ -4773,11 +4783,13 @@ process_gsm_info (QmiMessageNasGetSystemInfoOutput *response_output, roaming_status_valid, roaming_status, forbidden_valid, forbidden, lac_valid, lac, + FALSE, 0, cid_valid, cid, network_id_valid, mcc, mnc, mm_cs_registration_state, mm_ps_registration_state, mm_lac, + NULL, mm_cid, mm_operator_id)) { mm_dbg ("No GSM service registered"); @@ -4880,11 +4892,13 @@ process_wcdma_info (QmiMessageNasGetSystemInfoOutput *response_output, roaming_status_valid, roaming_status, forbidden_valid, forbidden, lac_valid, lac, + FALSE, 0, cid_valid, cid, network_id_valid, mcc, mnc, mm_cs_registration_state, mm_ps_registration_state, mm_lac, + NULL, mm_cid, mm_operator_id)) { mm_dbg ("No WCDMA service registered"); @@ -4900,6 +4914,7 @@ process_lte_info (QmiMessageNasGetSystemInfoOutput *response_output, MMModem3gppRegistrationState *mm_cs_registration_state, MMModem3gppRegistrationState *mm_ps_registration_state, guint16 *mm_lac, + guint16 *mm_tac, guint32 *mm_cid, gchar **mm_operator_id) { @@ -4912,6 +4927,8 @@ process_lte_info (QmiMessageNasGetSystemInfoOutput *response_output, gboolean forbidden; gboolean lac_valid; guint16 lac; + gboolean tac_valid; + guint16 tac; gboolean cid_valid; guint32 cid; gboolean network_id_valid; @@ -4924,6 +4941,7 @@ process_lte_info (QmiMessageNasGetSystemInfoOutput *response_output, *mm_ps_registration_state = MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN; *mm_cs_registration_state = MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN; *mm_lac = 0; + *mm_tac = 0; *mm_cid = 0; g_free (*mm_operator_id); *mm_operator_id = NULL; @@ -4945,7 +4963,7 @@ process_lte_info (QmiMessageNasGetSystemInfoOutput *response_output, &cid_valid, &cid, NULL, NULL, NULL, /* registration_reject_info */ &network_id_valid, &mcc, &mnc, - NULL, NULL, /* tac */ + &tac_valid, &tac, NULL)) { mm_dbg ("No LTE service reported"); /* No GSM service */ @@ -4968,7 +4986,7 @@ process_lte_info (QmiMessageNasGetSystemInfoOutput *response_output, &cid_valid, &cid, NULL, NULL, NULL, /* registration_reject_info */ &network_id_valid, &mcc, &mnc, - NULL, NULL, /* tac */ + &tac_valid, &tac, NULL)) { mm_dbg ("No LTE service reported"); /* No GSM service */ @@ -4981,11 +4999,13 @@ process_lte_info (QmiMessageNasGetSystemInfoOutput *response_output, roaming_status_valid, roaming_status, forbidden_valid, forbidden, lac_valid, lac, + tac_valid, tac, cid_valid, cid, network_id_valid, mcc, mnc, mm_cs_registration_state, mm_ps_registration_state, mm_lac, + mm_tac, mm_cid, mm_operator_id)) { mm_dbg ("No LTE service registered"); @@ -5003,6 +5023,7 @@ common_process_system_info_3gpp (MMBroadbandModemQmi *self, MMModem3gppRegistrationState cs_registration_state; MMModem3gppRegistrationState ps_registration_state; guint16 lac; + guint16 tac; guint32 cid; gchar *operator_id; gboolean has_lte_info; @@ -5010,6 +5031,7 @@ common_process_system_info_3gpp (MMBroadbandModemQmi *self, ps_registration_state = MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN; cs_registration_state = MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN; lac = 0; + tac = 0; cid = 0; operator_id = NULL; @@ -5021,6 +5043,7 @@ common_process_system_info_3gpp (MMBroadbandModemQmi *self, &cs_registration_state, &ps_registration_state, &lac, + &tac, &cid, &operator_id); if (!has_lte_info && @@ -5050,7 +5073,7 @@ common_process_system_info_3gpp (MMBroadbandModemQmi *self, mm_iface_modem_3gpp_update_ps_registration_state (MM_IFACE_MODEM_3GPP (self), ps_registration_state); if (has_lte_info) mm_iface_modem_3gpp_update_eps_registration_state (MM_IFACE_MODEM_3GPP (self), ps_registration_state); - mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), lac, cid); + mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), lac, tac, cid); } static void diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index a4be504d..a685e407 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -4008,7 +4008,7 @@ registration_state_changed (MMPortSerialAt *port, MMBroadbandModem *self) { MMModem3gppRegistrationState state = MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN; - gulong lac = 0, cell_id = 0; + gulong lac = 0, tac = 0, cell_id = 0; MMModemAccessTechnology act = MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN; gboolean cgreg = FALSE; gboolean cereg = FALSE; @@ -4028,13 +4028,24 @@ registration_state_changed (MMPortSerialAt *port, return; } - /* Report new registration state */ + /* Report new registration state and fix LAC/TAC. + * According to 3GPP TS 27.007: + * - If CREG reports <AcT> 7 (LTE) then the <lac> field contains TAC + * - CEREG always reports TAC + */ if (cgreg) mm_iface_modem_3gpp_update_ps_registration_state (MM_IFACE_MODEM_3GPP (self), state); - else if (cereg) + else if (cereg) { + tac = lac; + lac = 0; mm_iface_modem_3gpp_update_eps_registration_state (MM_IFACE_MODEM_3GPP (self), state); - else + } else { + if (act == MM_MODEM_ACCESS_TECHNOLOGY_LTE) { + tac = lac; + lac = 0; + } mm_iface_modem_3gpp_update_cs_registration_state (MM_IFACE_MODEM_3GPP (self), state); + } /* Only update access technologies from CREG/CGREG response if the modem * doesn't have custom commands for access technology loading, otherwise @@ -4045,7 +4056,7 @@ registration_state_changed (MMPortSerialAt *port, MM_IFACE_MODEM_GET_INTERFACE (self)->load_access_technologies == NULL) mm_iface_modem_3gpp_update_access_technologies (MM_IFACE_MODEM_3GPP (self), act); - mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), lac, cell_id); + mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), lac, tac, cell_id); } static void @@ -4266,6 +4277,7 @@ registration_status_check_ready (MMBroadbandModem *self, MMModem3gppRegistrationState state; MMModemAccessTechnology act; gulong lac; + gulong tac; gulong cid; ctx = g_task_get_task_data (task); @@ -4360,7 +4372,11 @@ registration_status_check_ready (MMBroadbandModem *self, return; } - /* Report new registration state */ + /* Report new registration state and fix LAC/TAC. + * According to 3GPP TS 27.007: + * - If CREG reports <AcT> 7 (LTE) then the <lac> field contains TAC + * - CEREG always reports TAC + */ if (cgreg) { if (ctx->running_cs) mm_dbg ("Got PS registration state when checking CS registration state"); @@ -4368,12 +4384,18 @@ registration_status_check_ready (MMBroadbandModem *self, mm_dbg ("Got PS registration state when checking EPS registration state"); mm_iface_modem_3gpp_update_ps_registration_state (MM_IFACE_MODEM_3GPP (self), state); } else if (cereg) { + tac = lac; + lac = 0; if (ctx->running_cs) mm_dbg ("Got EPS registration state when checking CS registration state"); else if (ctx->running_ps) mm_dbg ("Got EPS registration state when checking PS registration state"); mm_iface_modem_3gpp_update_eps_registration_state (MM_IFACE_MODEM_3GPP (self), state); } else { + if (act == MM_MODEM_ACCESS_TECHNOLOGY_LTE) { + tac = lac; + lac = 0; + } if (ctx->running_ps) mm_dbg ("Got CS registration state when checking PS registration state"); else if (ctx->running_eps) @@ -4382,7 +4404,7 @@ registration_status_check_ready (MMBroadbandModem *self, } mm_iface_modem_3gpp_update_access_technologies (MM_IFACE_MODEM_3GPP (self), act); - mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), lac, cid); + mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), lac, tac, cid); run_registration_checks_context_step (task); } diff --git a/src/mm-iface-modem-3gpp.c b/src/mm-iface-modem-3gpp.c index 4e19815d..4aeaa8a1 100644 --- a/src/mm-iface-modem-3gpp.c +++ b/src/mm-iface-modem-3gpp.c @@ -252,7 +252,7 @@ register_in_network_context_complete_failed (GTask *task, mm_iface_modem_3gpp_update_ps_registration_state (ctx->self, MM_MODEM_3GPP_REGISTRATION_STATE_IDLE); mm_iface_modem_3gpp_update_eps_registration_state (ctx->self, MM_MODEM_3GPP_REGISTRATION_STATE_IDLE); mm_iface_modem_3gpp_update_access_technologies (ctx->self, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN); - mm_iface_modem_3gpp_update_location (ctx->self, 0, 0); + mm_iface_modem_3gpp_update_location (ctx->self, 0, 0, 0); g_task_return_error (task, error); g_object_unref (task); @@ -1217,6 +1217,7 @@ mm_iface_modem_3gpp_update_access_technologies (MMIfaceModem3gpp *self, void mm_iface_modem_3gpp_update_location (MMIfaceModem3gpp *self, gulong location_area_code, + gulong tracking_area_code, gulong cell_id) { MMModem3gppRegistrationState state; @@ -1238,9 +1239,10 @@ mm_iface_modem_3gpp_update_location (MMIfaceModem3gpp *self, * change to registered), we also allow LAC/CID updates. */ if (reg_state_is_registered (state) || ctx->reloading_registration_info) { if (location_area_code > 0 && cell_id > 0) - mm_iface_modem_location_3gpp_update_lac_ci (MM_IFACE_MODEM_LOCATION (self), - location_area_code, - cell_id); + mm_iface_modem_location_3gpp_update_lac_tac_ci (MM_IFACE_MODEM_LOCATION (self), + location_area_code, + tracking_area_code, + cell_id); } else mm_iface_modem_location_3gpp_clear (MM_IFACE_MODEM_LOCATION (self)); } @@ -1689,7 +1691,7 @@ interface_disabling_step (GTask *task) case DISABLING_STEP_REGISTRATION_STATE: update_registration_state (self, MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN, FALSE); mm_iface_modem_3gpp_update_access_technologies (self, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN); - mm_iface_modem_3gpp_update_location (self, 0, 0); + mm_iface_modem_3gpp_update_location (self, 0, 0, 0); /* Fall down to next step */ ctx->step++; diff --git a/src/mm-iface-modem-3gpp.h b/src/mm-iface-modem-3gpp.h index 7b6d47e1..a08c5fb6 100644 --- a/src/mm-iface-modem-3gpp.h +++ b/src/mm-iface-modem-3gpp.h @@ -257,6 +257,7 @@ void mm_iface_modem_3gpp_update_access_technologies (MMIfaceModem3gpp *self, MMModemAccessTechnology access_tech); void mm_iface_modem_3gpp_update_location (MMIfaceModem3gpp *self, gulong location_area_code, + gulong tracking_area_code, gulong cell_id); /* Run all registration checks */ diff --git a/src/mm-iface-modem-location.c b/src/mm-iface-modem-location.c index d4fae0b7..4c45ab11 100644 --- a/src/mm-iface-modem-location.c +++ b/src/mm-iface-modem-location.c @@ -289,11 +289,12 @@ notify_3gpp_location_update (MMIfaceModemLocation *self, dbus_path = g_dbus_object_get_object_path (G_DBUS_OBJECT (self)); mm_dbg ("Modem %s: 3GPP location updated " - "(MCC: '%u', MNC: '%u', Location area code: '%lX', Cell ID: '%lX')", + "(MCC: '%u', MNC: '%u', Location area code: '%lX', Tracking area code: '%lX', Cell ID: '%lX')", dbus_path, mm_location_3gpp_get_mobile_country_code (location_3gpp), mm_location_3gpp_get_mobile_network_code (location_3gpp), mm_location_3gpp_get_location_area_code (location_3gpp), + mm_location_3gpp_get_tracking_area_code (location_3gpp), mm_location_3gpp_get_cell_id (location_3gpp)); /* We only update the property if we are supposed to signal @@ -338,9 +339,10 @@ mm_iface_modem_location_3gpp_update_mcc_mnc (MMIfaceModemLocation *self, } void -mm_iface_modem_location_3gpp_update_lac_ci (MMIfaceModemLocation *self, - gulong location_area_code, - gulong cell_id) +mm_iface_modem_location_3gpp_update_lac_tac_ci (MMIfaceModemLocation *self, + gulong location_area_code, + gulong tracking_area_code, + gulong cell_id) { MmGdbusModemLocation *skeleton; LocationContext *ctx; @@ -356,10 +358,9 @@ mm_iface_modem_location_3gpp_update_lac_ci (MMIfaceModemLocation *self, guint changed = 0; g_assert (ctx->location_3gpp != NULL); - changed += mm_location_3gpp_set_location_area_code (ctx->location_3gpp, - location_area_code); - changed += mm_location_3gpp_set_cell_id (ctx->location_3gpp, - cell_id); + changed += mm_location_3gpp_set_location_area_code (ctx->location_3gpp, location_area_code); + changed += mm_location_3gpp_set_tracking_area_code (ctx->location_3gpp, tracking_area_code); + changed += mm_location_3gpp_set_cell_id (ctx->location_3gpp, cell_id); if (changed) notify_3gpp_location_update (self, skeleton, ctx->location_3gpp); } @@ -385,6 +386,7 @@ mm_iface_modem_location_3gpp_clear (MMIfaceModemLocation *self) g_assert (ctx->location_3gpp != NULL); changed += mm_location_3gpp_set_location_area_code (ctx->location_3gpp, 0); + changed += mm_location_3gpp_set_tracking_area_code (ctx->location_3gpp, 0); changed += mm_location_3gpp_set_cell_id (ctx->location_3gpp, 0); changed += mm_location_3gpp_set_mobile_country_code (ctx->location_3gpp, 0); changed += mm_location_3gpp_set_mobile_network_code (ctx->location_3gpp, 0); diff --git a/src/mm-iface-modem-location.h b/src/mm-iface-modem-location.h index 96fe9b3b..e49fd79c 100644 --- a/src/mm-iface-modem-location.h +++ b/src/mm-iface-modem-location.h @@ -114,9 +114,10 @@ void mm_iface_modem_location_3gpp_clear (MMIfaceModemLocation *self); void mm_iface_modem_location_3gpp_update_mcc_mnc (MMIfaceModemLocation *self, guint mobile_country_code, guint mobile_network_code); -void mm_iface_modem_location_3gpp_update_lac_ci (MMIfaceModemLocation *self, - gulong location_area_code, - gulong cell_id); +void mm_iface_modem_location_3gpp_update_lac_tac_ci (MMIfaceModemLocation *self, + gulong location_area_code, + gulong tracking_area_code, + gulong cell_id); /* Update GPS location */ void mm_iface_modem_location_gps_update (MMIfaceModemLocation *self, |