diff options
author | Guido Günther <agx@sigxcpu.org> | 2021-04-19 17:44:07 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2021-04-21 16:47:04 +0200 |
commit | 89c20a5b84ea48b7a3b4107bc2c893ff32f1909a (patch) | |
tree | 2af54e2a44a19843a7e6c3540ae7979ed365c04c | |
parent | aaa285adc7b2e01d59513f3e4497283446033b1b (diff) | |
download | geoclue-89c20a5b84ea48b7a3b4107bc2c893ff32f1909a.tar.gz |
gclue-mozilla: Add per tower radio type
Mozilla's API has a per tower `radioType` field¹. Without that filled in
it will assume GSM and hence ignore the provided data in case of 4G with
a locationAreaCode > 65535² and just fallback to GeoIP.
This changes the request from
{"radioType":"gsm","cellTowers":[{"cellId":45622821,"mobileCountryCode":262,"mobileNetworkCode":3,"locationAreaCode":47260}]}
to
{"radioType":"gsm","cellTowers":[{"cellId":45622821,"mobileCountryCode":262,"mobileNetworkCode":3,"locationAreaCode":47260,"radioType":"lte"}]}
and the returned result then matches the cell tower data from ³.
1: https://ichnaea.readthedocs.io/en/latest/api/geolocate.html#cell-tower-fields
2: See https://developers.google.com/maps/documentation/geolocation/overview#calculating_cell_id
3: https://location.services.mozilla.com/downloads
Fixes 5d15b65e60df84f741b436c254dc5eb4dc8e966c
-rw-r--r-- | src/gclue-mozilla.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gclue-mozilla.c b/src/gclue-mozilla.c index 3a1de17..6d25a31 100644 --- a/src/gclue-mozilla.c +++ b/src/gclue-mozilla.c @@ -164,6 +164,10 @@ gclue_mozilla_create_query (GList *bss_list, /* As in Access Points */ json_builder_add_int_value (builder, tower->mnc); json_builder_set_member_name (builder, "locationAreaCode"); json_builder_add_int_value (builder, tower->lac); + if (tower->tec == GCLUE_TOWER_TEC_4G) { + json_builder_set_member_name (builder, "radioType"); + json_builder_add_string_value (builder, "lte"); + } json_builder_end_object (builder); |