Commit 8e9d5eb2 authored by Jussi Kukkonen's avatar Jussi Kukkonen

make gsmloc provider use www.opencellid.org

gsmloc.org is no longer, www.opencellid.org provides a similar
service, so switch to that.
parent 3c7f9c47
......@@ -7,8 +7,7 @@
*/
/**
* This is mostly a proof-of-concept, and gsmloc.org itself is
* not too trustworthy either, rather "barely kept alive".
* This is mostly a proof-of-concept provider.
*
* Gammu must be configured before running the provider (test by
* running "gammu networkinfo"). Currently the first configuration
......@@ -16,6 +15,10 @@
*
* Gammu initialization takes a really long time if the configured
* phone is not available.
*
* Gsmloc uses the webservice http://www.opencellid.org/ (a similar service
* used to live at gsmloc.org, hence the name)
*
**/
#include <config.h>
......@@ -38,7 +41,7 @@
#define GEOCLUE_DBUS_SERVICE_GSMLOC "org.freedesktop.Geoclue.Providers.Gsmloc"
#define GEOCLUE_DBUS_PATH_GSMLOC "/org/freedesktop/Geoclue/Providers/Gsmloc"
#define GSMLOC_URL "http://gsmloc.org/api"
#define GSMLOC_URL "http://www.opencellid.org/cell/get"
#define GEOCLUE_TYPE_GSMLOC (geoclue_gsmloc_get_type ())
#define GEOCLUE_GSMLOC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEOCLUE_TYPE_GSMLOC, GeoclueGsmloc))
......@@ -187,9 +190,11 @@ geoclue_gsmloc_get_position (GcIfacePosition *iface,
char *mcc, *mnc, *lac, *cid;
gsmloc = (GEOCLUE_GSMLOC (iface));
mcc = mnc = lac = cid = NULL;
if (!geoclue_gsmloc_get_cell (gsmloc, &mcc, &mnc, &lac, &cid)) {
/* Error */
*error = g_error_new (GEOCLUE_ERROR, GEOCLUE_ERROR_NOT_AVAILABLE,
"Failed to get cell data from Gammu");
return FALSE;
}
......@@ -197,14 +202,11 @@ geoclue_gsmloc_get_position (GcIfacePosition *iface,
if (timestamp) {
*timestamp = time (NULL);
}
if (!gc_web_service_query (gsmloc->web_service, error,
"action", "get",
"format", "xml",
"nid1", mcc,
"nid2", mnc,
"mcc", mcc,
"mnc", mnc,
"lac", lac,
"cid", cid,
"cellid", cid,
(char *)0)) {
g_free (mcc);
g_free (mnc);
......@@ -218,11 +220,11 @@ geoclue_gsmloc_get_position (GcIfacePosition *iface,
g_free (cid);
if (latitude && gc_web_service_get_double (gsmloc->web_service,
latitude, "//Point/lat")) {
latitude, "/rsp/cell/attribute::lat")) {
*fields |= GEOCLUE_POSITION_FIELDS_LATITUDE;
}
if (longitude && gc_web_service_get_double (gsmloc->web_service,
longitude, "//Point/lon")) {
longitude, "/rsp/cell/attribute::lat")) {
*fields |= GEOCLUE_POSITION_FIELDS_LONGITUDE;
}
......@@ -271,7 +273,7 @@ geoclue_gsmloc_init (GeoclueGsmloc *gsmloc)
gc_provider_set_details (GC_PROVIDER (gsmloc),
GEOCLUE_DBUS_SERVICE_GSMLOC,
GEOCLUE_DBUS_PATH_GSMLOC,
"Gsmloc", "Gsmloc.org and Gammu -based provider");
"Gsmloc", "opencellid.org and Gammu -based provider");
gsmloc->web_service = g_object_new (GC_TYPE_WEB_SERVICE, NULL);
gc_web_service_set_base_url (gsmloc->web_service, GSMLOC_URL);
......
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