aboutsummaryrefslogtreecommitdiff
path: root/src/mm-iface-modem-location.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-10-09 12:50:49 +0200
committerAleksander Morgado <aleksander@aleksander.es>2020-10-10 15:43:57 +0200
commit135d484501dbf641b51b02033377871100323049 (patch)
tree6576c610817f4925b75d008906ea14285c0bf589 /src/mm-iface-modem-location.c
parentc6f38ecac3ed2ac783dbab706c5e155ba7409747 (diff)
iface-modem-location: allow Cell ID only updates
The "Serving System" indications reported via QMI when the device is moving may contain LAC/TAC+CID updates or just CID updates. E.g. this one has "CID 3GPP" (0x1e): Mon Aug 3 11:22:42 2020 daemon.debug [1567]: [/dev/cdc-wdm0] received generic indication (translated)... <<<<<< QMUX: <<<<<< length = 33 <<<<<< flags = 0x80 <<<<<< service = "nas" <<<<<< client = 3 <<<<<< QMI: <<<<<< flags = "indication" <<<<<< transaction = 4512 <<<<<< tlv_length = 21 <<<<<< message = "Serving System" (0x0024) <<<<<< TLV: <<<<<< type = "Serving System" (0x01) <<<<<< length = 6 <<<<<< value = 01:01:01:02:01:08 <<<<<< translated = [ registration_state = 'registered' cs_attach_state = 'attached' ps_attach_state = 'attached' selected_network = '3gpp' radio_interfaces = '{ [0] = 'lte '}' ] <<<<<< TLV: <<<<<< type = "Data Service Capability" (0x11) <<<<<< length = 2 <<<<<< value = 01:0B <<<<<< translated = { [0] = 'lte '} <<<<<< TLV: <<<<<< type = "CID 3GPP" (0x1e) <<<<<< length = 4 <<<<<< value = 14:C2:A8:00 <<<<<< translated = 11059732 And this one has both "CID 3GPP" (0x1e) and "LTE TAC" (0x25): Mon Aug 3 11:23:05 2020 daemon.debug [1567]: [/dev/cdc-wdm0] received generic indication (translated)... <<<<<< QMUX: <<<<<< length = 38 <<<<<< flags = 0x80 <<<<<< service = "nas" <<<<<< client = 3 <<<<<< QMI: <<<<<< flags = "indication" <<<<<< transaction = 4513 <<<<<< tlv_length = 26 <<<<<< message = "Serving System" (0x0024) <<<<<< TLV: <<<<<< type = "Serving System" (0x01) <<<<<< length = 6 <<<<<< value = 01:01:01:02:01:08 <<<<<< translated = [ registration_state = 'registered' cs_attach_state = 'attached' ps_attach_state = 'attached' selected_network = '3gpp' radio_interfaces = '{ [0] = 'lte '}' ] <<<<<< TLV: <<<<<< type = "Data Service Capability" (0x11) <<<<<< length = 2 <<<<<< value = 01:0B <<<<<< translated = { [0] = 'lte '} <<<<<< TLV: <<<<<< type = "CID 3GPP" (0x1e) <<<<<< length = 4 <<<<<< value = 32:36:BC:00 <<<<<< translated = 12334642 <<<<<< TLV: <<<<<< type = "LTE TAC" (0x25) <<<<<< length = 2 <<< We should therefore allow changes only in the CID, maintaining whatever LAC/TAC value we had before.
Diffstat (limited to 'src/mm-iface-modem-location.c')
-rw-r--r--src/mm-iface-modem-location.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/mm-iface-modem-location.c b/src/mm-iface-modem-location.c
index ce307ccb..da78a1ff 100644
--- a/src/mm-iface-modem-location.c
+++ b/src/mm-iface-modem-location.c
@@ -396,9 +396,9 @@ mm_iface_modem_location_3gpp_update_mcc_mnc (MMIfaceModemLocation *self,
void
mm_iface_modem_location_3gpp_update_lac_tac_ci (MMIfaceModemLocation *self,
- gulong location_area_code,
- gulong tracking_area_code,
- gulong cell_id)
+ gulong location_area_code,
+ gulong tracking_area_code,
+ gulong cell_id)
{
MmGdbusModemLocation *skeleton;
LocationContext *ctx;
@@ -414,9 +414,23 @@ mm_iface_modem_location_3gpp_update_lac_tac_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_tracking_area_code (ctx->location_3gpp, tracking_area_code);
- changed += mm_location_3gpp_set_cell_id (ctx->location_3gpp, cell_id);
+
+ /* Update LAC if given, and clear TAC unless a TAC is also given */
+ if (location_area_code) {
+ changed += mm_location_3gpp_set_location_area_code (ctx->location_3gpp, location_area_code);
+ if (!tracking_area_code)
+ changed += mm_location_3gpp_set_tracking_area_code (ctx->location_3gpp, 0);
+ }
+ /* Update TAC if given, and clear LAC unless a LAC is also given */
+ if (tracking_area_code) {
+ changed += mm_location_3gpp_set_tracking_area_code (ctx->location_3gpp, tracking_area_code);
+ if (!location_area_code)
+ changed += mm_location_3gpp_set_location_area_code (ctx->location_3gpp, 0);
+ }
+ /* Cell ID only updated if given. It is assumed that if LAC or TAC are given, CID is also given */
+ if (cell_id)
+ changed += mm_location_3gpp_set_cell_id (ctx->location_3gpp, cell_id);
+
if (changed)
notify_3gpp_location_update (self, skeleton, ctx->location_3gpp);
}