Commit 66f19d22 authored by Zeeshan Ali's avatar Zeeshan Ali

mozilla: Allow 3G queries

parent bd1a59c8
......@@ -105,8 +105,9 @@ get_url (void)
}
SoupMessage *
gclue_mozilla_create_query (GList *bss_list, /* As in Access Points */
GError **error)
gclue_mozilla_create_query (GList *bss_list, /* As in Access Points */
GClue3GTower *tower,
GError **error)
{
SoupMessage *ret = NULL;
JsonBuilder *builder;
......@@ -119,7 +120,33 @@ gclue_mozilla_create_query (GList *bss_list, /* As in Access Points */
builder = json_builder_new ();
json_builder_begin_object (builder);
/* We send pure geoip query using empty object if bss_list is NULL. */
/* We send pure geoip query using empty object if both bss_list and
* tower are NULL.
*/
if (tower != NULL) {
json_builder_set_member_name (builder, "radioType");
json_builder_add_string_value (builder, "gsm");
json_builder_set_member_name (builder, "cellTowers");
json_builder_begin_array (builder);
json_builder_begin_object (builder);
json_builder_set_member_name (builder, "cellId");
json_builder_add_int_value (builder, tower->cell_id);
json_builder_set_member_name (builder, "mobileCountryCode");
json_builder_add_int_value (builder, tower->mcc);
json_builder_set_member_name (builder, "mobileNetworkCode");
json_builder_add_int_value (builder, tower->mnc);
json_builder_set_member_name (builder, "locationAreaCode");
json_builder_add_int_value (builder, tower->lac);
json_builder_end_object (builder);
json_builder_end_array (builder);
}
if (bss_list != NULL) {
GList *iter;
......
......@@ -26,12 +26,14 @@
#include <libsoup/soup.h>
#include "wpa_supplicant-interface.h"
#include "geocode-glib/geocode-location.h"
#include "gclue-3g-tower.h"
G_BEGIN_DECLS
SoupMessage *
gclue_mozilla_create_query (GList *bss_list, /* As in Access Points */
GError **error);
gclue_mozilla_create_query (GList *bss_list, /* As in Access Points */
GClue3GTower *tower,
GError **error);
GeocodeLocation *
gclue_mozilla_parse_response (const char *json,
GError **error);
......
......@@ -669,7 +669,7 @@ gclue_wifi_create_query (GClueWebSource *source,
bss_list = get_bss_list (GCLUE_WIFI (source), NULL);
return gclue_mozilla_create_query (bss_list, error);
return gclue_mozilla_create_query (bss_list, NULL, error);
}
static GeocodeLocation *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment