Commit a6237bf7 authored by Jussi Kukkonen's avatar Jussi Kukkonen

Added "civic position changed"-signal to position API

Commit includes implementation for hostip-backend.
parent 9fe45824
......@@ -53,6 +53,19 @@ struct GeocluePosition
gdouble current_lat;
gdouble current_lon;
gboolean is_current_valid;
gchar* civic_country;
gchar* civic_region;
gchar* civic_locality;
gchar* civic_area;
gchar* civic_postalcode;
gchar* civic_street;
gchar* civic_building;
gchar* civic_floor;
gchar* civic_room;
gchar* civic_text;
gboolean is_civic_valid;
#ifdef HAVE_LIBCONIC
ConIcConnection* net_connection;
DBusConnection* dbus_connection;
......@@ -66,6 +79,7 @@ struct GeocluePositionClass
/* Signals */
void (*current_position_changed) (GeocluePosition*, gdouble, gdouble );
void (*civic_location_changed) (GeocluePosition*, gchar*, gchar*, gchar*, gchar*, gchar*, gchar*, gchar*, gchar*, gchar*, gchar*);
};
#define TYPE_GEOCLUE_POSITION (geoclue_position_get_type ())
......
......@@ -41,6 +41,7 @@
static DBusGConnection* geoclue_position_connection = NULL;
static DBusGProxy* geoclue_position_proxy = NULL;
static GEOCLUE_POSITION_CALLBACK callbackfunction = NULL;
static GEOCLUE_CIVIC_CALLBACK civic_loc_cb = NULL;
static void* userdatastore = NULL;
......@@ -53,6 +54,25 @@ void geoclue_position_current_position_changed(void* userdata, gdouble lat, gdou
}
void geoclue_position_civic_location_changed(void* userdata,
char* country,
char* region,
char* locality,
char* area,
char* postalcode,
char* street,
char* building,
char* floor,
char* room,
char* text)
{
if (civic_loc_cb != NULL)
civic_loc_cb (country, region, locality, area,
postalcode, street, building,
floor, room, text,
userdatastore);
}
GEOCLUE_POSITION_RETURNCODE geoclue_position_set_position_callback(GEOCLUE_POSITION_CALLBACK callback, void* userdata )
{
callbackfunction = callback;
......@@ -381,38 +401,3 @@ GEOCLUE_POSITION_RETURNCODE geoclue_position_civic_location (char** OUT_country,
return GEOCLUE_POSITION_SUCCESS;
}
GEOCLUE_POSITION_RETURNCODE geoclue_position_civic_location_supports (gboolean* OUT_country,
gboolean* OUT_region,
gboolean* OUT_locality,
gboolean* OUT_area,
gboolean* OUT_postalcode,
gboolean* OUT_street,
gboolean* OUT_building,
gboolean* OUT_floor,
gboolean* OUT_room,
gboolean* OUT_text)
{
g_return_val_if_fail (geoclue_position_connection, GEOCLUE_POSITION_NOT_INITIALIZED);
g_return_val_if_fail (geoclue_position_proxy, GEOCLUE_POSITION_NOT_INITIALIZED);
GError* error = NULL;
org_foinse_project_geoclue_position_civic_location_supports (geoclue_position_proxy,
OUT_country,
OUT_region,
OUT_locality,
OUT_area,
OUT_postalcode,
OUT_street,
OUT_building,
OUT_floor,
OUT_room,
OUT_text,
&error);
if( error != NULL )
{
g_printerr ("Error getting geoclue_position civic_location_supports : %s\n", error->message);
g_error_free (error);
return GEOCLUE_POSITION_DBUS_ERROR;
}
return GEOCLUE_POSITION_SUCCESS;
}
......@@ -50,6 +50,17 @@ typedef enum _geoclue_position_fix
typedef void (*GEOCLUE_POSITION_CALLBACK)(gdouble lat, gdouble lon, void* userdata);
typedef void (*GEOCLUE_CIVIC_CALLBACK)(char* country,
char* region,
char* locality,
char* area,
char* postalcode,
char* street,
char* building,
char* floor,
char* room,
char* text,
void* userdata);
/*!
* \brief texttospeech version
......@@ -119,7 +130,10 @@ typedef enum _geoclue_position_fix
* \return TRUE Version returned sucessfully
* FALSE Error
*/
GEOCLUE_POSITION_RETURNCODE geoclue_position_set_position_callback(GEOCLUE_POSITION_CALLBACK callback, void* userdata );
GEOCLUE_POSITION_RETURNCODE geoclue_position_set_position_callback(GEOCLUE_POSITION_CALLBACK callback, void* userdata );
GEOCLUE_POSITION_RETURNCODE geoclue_position_set_civic_callback (GEOCLUE_CIVIC_CALLBACK callback, void* userdata );
/*!
......@@ -145,17 +159,6 @@ typedef enum _geoclue_position_fix
char** OUT_room,
char** OUT_text);
GEOCLUE_POSITION_RETURNCODE geoclue_position_civic_location_supports (gboolean* OUT_country,
gboolean* OUT_region,
gboolean* OUT_locality,
gboolean* OUT_area,
gboolean* OUT_postalcode,
gboolean* OUT_street,
gboolean* OUT_building,
gboolean* OUT_floor,
gboolean* OUT_room,
gboolean* OUT_text);
G_END_DECLS
......
......@@ -38,7 +38,6 @@
<arg type="d" name="longitude" direction="out" />
</signal>
<method name="current_position">
<arg type="d" name="latitude" direction="out" />
<arg type="d" name="longitude" direction="out" />
......@@ -79,7 +78,20 @@
<arg type="b" name="differential" direction="out" />
<arg type="b" name="ephemeris" direction="out" />
</method>
<signal name="civic_location_changed">
<arg type="s" name="country" direction="out" />
<arg type="s" name="region" direction="out" />
<arg type="s" name="locality" direction="out" />
<arg type="s" name="area" direction="out" />
<arg type="s" name="postalcode" direction="out" />
<arg type="s" name="street" direction="out" />
<arg type="s" name="building" direction="out" />
<arg type="s" name="floor" direction="out" />
<arg type="s" name="room" direction="out" />
<arg type="s" name="text" direction="out" />
</signal>
<method name="civic_location">
<arg type="s" name="country" direction="out" />
<arg type="s" name="region" direction="out" />
......@@ -93,18 +105,6 @@
<arg type="s" name="text" direction="out" />
</method>
<method name="civic_location_supports">
<arg type="b" name="country" direction="out" />
<arg type="b" name="region" direction="out" />
<arg type="b" name="locality" direction="out" />
<arg type="b" name="area" direction="out" />
<arg type="b" name="postalcode" direction="out" />
<arg type="b" name="street" direction="out" />
<arg type="b" name="building" direction="out" />
<arg type="b" name="floor" direction="out" />
<arg type="b" name="room" direction="out" />
<arg type="b" name="text" direction="out" />
</method>
<method name="service_available">
<arg type="b" name="available" direction="out" />
......
VOID:DOUBLE,DOUBLE
VOID:STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING,STRING
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