elocation: remove beta library

This has never been fully finished or really used. The GeoClue project
dbus API moved on to a newer version as well. We still have it marked as
beta so we should take the chance and get rid of it to cleanup our tree
a little bit.

Reviewed-by: Chris Michael <cp.michael@samsung.com>
Reviewed-by: Vincent Torri <vincent.torri@gmail.com>
Differential Revision: https://phab.enlightenment.org/D10788
This commit is contained in:
Stefan Schmidt 2019-10-02 17:45:07 +02:00
parent 431f3b1fce
commit 4ff8fb140c
28 changed files with 19 additions and 4104 deletions

View File

@ -6809,7 +6809,6 @@
* @example efl_thread_win32_2.c
* @example efl_thread_win32_3.c
* @example efl_thread_win32_4.c
* @example location_example_01.c
* @example naviframe_example.c
*/

View File

@ -33,8 +33,6 @@
*
* @ref icon_cxx_example_01
*
* @ref location_cxx_example_01
*
* @ref menu_cxx_example_01
*
* @ref popup_cxx_example_01
@ -3200,230 +3198,6 @@
* @example icon_cxx_example_01.cc
*/
/**
* @page location_cxx_example_01 Location example with C++ Binding
* @dontinclude location_cxx_example_01.cc
* This example shows how to integrate the Elocation.h library with
* elementary.
* The first part consists of including the headers. In this case we
* need to include both Elementary C++ binding and Elocation,
* @skip Elementary.hh
* @until endif
* @attention All necessary libraries from Elementary, Elightenment, C
* and/or C++ headers should be include here.
* Before our main code, we need a set of callbacks to react on
* incoming elocation events. They are standard ecore events and we
* register callbacks on these events in the main function.
* @skip void
* @until ECORE_CALLBACK_DONE
* @until }
* Now we need to actually start the code and initializing pointers
* for address, addr_geocode, position and pos_geocode and an integer
* status. We also run a check for elm_need_elocation.
* @skip EAPI_MAIN
* @until -1
* Now let's set the elm_policy, which defines for a given policy
* group/identifier a new policy's value, respectively. In this
* example the only policy we need to set a value for is @c
* ELM_POLICY_QUIT, possibles values for it are:
* @li @p ELM_POLICY_QUIT_NONE: Never quit the application
* automatically;
* @li @p ELM_POLICY_QUIT_LAST_WINDOW_CLOSED: quit when the
* application's last window is closed;
* @li @p ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN : quit when the
* application's last window is hidden;
* @skipline elm_policy_set
* As you can see, the policy we chose was to quit when the last win
* is hidden as opposed to examples with the C bindings where we
* perpetually set it to quit when last win was closed. This changed
* was necessary because in C++ binding as the elm mainloop stop
* running all object are destroyed, references are unreferenced and
* events are stopped at ELM_MAIN().
* @see For more details consult elm_policy_set
* Next step is creating an elementary window, in this example we use
* the C++ binding method with the elm_win_util_standard_add that is a
* elm_win_legacy function, better explained below. And then we set
* the autohide state for it.
* @p elm_win_util_standard_add (const char *name, const char *tittle)
* Adds a window object with standard setup.
* Parameters:
* @li @p name - The name of the window;
* @li @p title - The title for the window.
* This creates a window but also puts in a standard background with
* @p elm_bg_add(), as well as setting the window title to @p
* title. The window type created is of type @c ELM_WIN_BASIC, with
* the @c NULL as the parent widget. Returns the created object or @c
* NULL on failure.
* The autohide works similarly to @p autodel, automatically handling
* "delete,request" signals when set to @p true, with the difference
* that it will hide the window, instead of destroying it.
* It is specially designed to work together with @p
* ELM_POLICY_QUIT_LAST_WINDOW_HIDDEN which allows exiting
* Elementary's main loop when all the windows are hidden.
* @skip ::elm::win
* @until autohide_set
* @note @p autodel and @a autohide are not mutually exclusive. The
* window will be destructed if both autodel and autohide is set to @p
* EINA_TRUE or @p true.
* For this example we're using a label that will display the text
* "Getting location ...". First we'll create our label, setting it's
* parent, then setting the following label's options:
* @li @p line_wrap_set: Set the wrapping behavior of the label, by
* default no wrapping is done. Possible values for wrap are:
* @p ELM_WRAP_NONE - No wrapping;
* @p ELM_WRAP_CHAR - wrap between characters;
* @p ELM_WRAP_WORD - wrap between words;
* @p ELM_WRAP_MIXED - Word wrap, and if that fails, char wrap.
* @ skipline wrap
* @li @p text_set: Set the text that label will display.
* @skipline text
* @li @p slide_mode_set: Set the slide mode of the label widget. By
* default, slide mode is none. Possible values for mode are:
* ELM_LABEL_SLIDE_MODE_NONE - no slide effect
* ELM_LABEL_SLIDE_MODE_AUTO - slide only if the label area is bigger
* than the text width length
* ELM_LABEL_SLIDE_MODE_ALWAYS -slide always
* @attention ELM_LABEL_SLIDE_MODE_AUTO, ELM_LABEL_SLIDE_MODE_ALWAYS
* only work with the themes "slide_short", "slide_long" and
* "slide_bounce". ELM_LABEL_SLIDE_MODE_AUTO,
* ELM_LABEL_SLIDE_MODE_ALWAYS don't work if the line
* wrap(elm_label_line_wrap_set()) or
* ellipsis(elm_label_ellipsis_set()) is set.
* @skipline slide
* To better understand, the function @c size_hint_weight_set for C++
* bindings originated from C bindings function
* evas_object_size_hint_weight_set, that is EFL Evas type function.
* With this function we set the hints for an object's weight. The
* parameters are:
* @li x - Nonnegative double value to use as horizontal weight hint.
* @li y - Nonnegative double value to use as vertical weight hint.
* This is not a size enforcement in any way, it's just a hint that
* should be used whenever appropriate. This is a hint on how a
* container object should resize a given child within its area.
* Containers may adhere to the simpler logic of just expanding the
* child object's dimensions to fit its own (see the EVAS_HINT_EXPAND
* helper weight macro in the EFL Evas Documentation) or the complete
* one of taking each child's weight hint as real weights to how much
* of its size to allocate for them in each axis. A container is
* supposed to, after normalizing the weights of its children (with
* weight hints), distribute the space it has to layout them by those
* factors most weighted children get larger in this process than
* the least ones.
* @dontinclude location_cxx_example_01.cc
* @skipline weight_set
* @note Default weight hint values are 0.0, for both axis.
* The function @c size_hint_align_set for C++ bindings originated
* from C bindings function evas_object_size_hint_align_set, that is
* EFL Evas type function. With this function we set the hints for an
* object's alignment. The parameters are:
* @li x - Double, ranging from 0.0 to 1.0 or with the special value
* EVAS_HINT_FILL, to use as horizontal alignment hint.
* @li y - Double, ranging from 0.0 to 1.0 or with the special value
* EVAS_HINT_FILL, to use as vertical alignment hint.
* These are hints on how to align an object inside the boundaries of
* a container/manager. Accepted values are in the 0.0 to 1.0 range,
* with the special value EVAS_HINT_FILL used to specify "justify" or
* "fill" by some users. In this case, maximum size hints should be
* enforced with higher priority, if they are set. Also, any padding
* hint set on objects should add up to the alignment space on the
* final scene composition.
* For the horizontal component, 0.0 means to the left, 1.0 means to
* the right. Analogously, for the vertical component, 0.0 to the top,
* 1.0 means to the bottom.
* This is not a size enforcement in any way, it's just a hint that
* should be used whenever appropriate.
* @note Default alignment hint values are 0.5, for both axis.
* @skipline align_set
* Setting the size for label and make it visible.
* @skip size
* @until visibility
* Going back to our elocation, first we'll create an address
* and position object that we'll use for all our operations.
* @skip address
* @until position
* We also have to register our callback so we get updates later on.
* @skipline ecore
* Now we need to get the elocation position and print it, using our
* label. This fills in the object with the data from GeoClue.
* @skip elocation
* @until print
* Now we only have to set the size for our window and make it
* visible.
* @skip size_set
* @until visibility_set
* And finally, start the elm mainloop, starting to handle events and
* drawing operations.
* @skip elm_run
* @until ELM_MAIN
* The full code for this example can be found at @ref location_cxx_example_01.cc
* @example location_cxx_example_01.cc
*/
/**
* @page menu_cxx_example_01 Menu Example with C++ Binding
* @dontinclude menu_cxx_example_01.cc

View File

@ -43,7 +43,6 @@
* <h3>Early stage libraries (BETA testing)</h3>
*
* @li @ref eolian_main an EO file parser and code generator.
* @li @ref elocation_main awareness library.
*
* If you are looking for methods that do not fit into the above list you can
* see the full <a href="modules.html" />module listing</a>.

View File

@ -297,8 +297,7 @@ subprojects = [
['emotion' ,[] , true, true, false, false, true, true, ['eina', 'efl', 'eo'], []],
['ethumb' ,[] , true, true, true, false, false, false, ['eina', 'efl', 'eo'], []],
['ethumb_client' ,[] , false, true, true, false, false, true, ['eina', 'efl', 'eo', 'ethumb'], []],
['elocation' ,[] , false, true, false, false, false, false, ['ecore', 'eldbus'], []],
['elementary' ,[] , true, true, true, true, true, true, ['eina', 'efl', 'eo', 'eet', 'evas', 'ecore', 'ecore-evas', 'ecore-file', 'ecore-input', 'edje', 'ethumb-client', 'emotion', 'ecore-imf', 'ecore-con', 'eldbus', 'efreet', 'efreet-mime', 'efreet-trash', 'eio', 'elocation'], ['atspi']],
['elementary' ,[] , true, true, true, true, true, true, ['eina', 'efl', 'eo', 'eet', 'evas', 'ecore', 'ecore-evas', 'ecore-file', 'ecore-input', 'edje', 'ethumb-client', 'emotion', 'ecore-imf', 'ecore-con', 'eldbus', 'efreet', 'efreet-mime', 'efreet-trash', 'eio'], ['atspi']],
['efl_wl' ,['wl'] , false, true, true, false, false, false, ['evas', 'ecore'], []],
['elua' ,['elua'] , false, true, true, false, true, false, ['eina', 'luajit'], []],
['ecore_wayland' ,['wl-deprecated'] , false, true, false, false, false, false, ['eina'], []],

View File

@ -1,151 +0,0 @@
//Compile with:
//gcc -o location_example_01 location_example_01.c -g `pkg-config --cflags --libs elementary elocation`
#ifndef EFL_BETA_API_SUPPORT
# define EFL_BETA_API_SUPPORT
#endif
#include <Elementary.h>
#ifdef ELM_ELOCATION
#include <Elocation.h>
#endif
static Evas_Object *pos_label, *addr_label, *box, *win;
#ifdef ELM_ELOCATION
static void
_print_position(Elocation_Position *position)
{
char buffer[1024];
if (!position) return;
snprintf(buffer, sizeof(buffer),
"<b>### Position Detail ###</b><br/>"
"<b>GeoClue position reply with data from timestamp</b> %i<br/>"
"<b>Latitude:</b> %f<br/>"
"<b>Longitude:</b> %f<br/>"
"<b>Altitude:</b> %f<br/>"
"<b>Accuracy level:</b> %i<br/>"
"<b>Accuracy horizontal:</b> %f<br/>"
"<b>Accuracy vertical:</b> %f",
position->timestamp, position->latitude, position->longitude,
position->altitude, position->accur->level,
position->accur->horizontal, position->accur->vertical);
elm_object_text_set(pos_label, buffer);
}
static void
_print_address(Elocation_Address *address)
{
char buffer[1024];
if (!address) return;
snprintf(buffer, sizeof(buffer),
"<b>### Address Detail ###</b><br/>"
"<b>Address update with data from timestamp:</b> %i<br/>"
"<b>Country:</b> %s<br/>"
"<b>Countrycode:</b> %s<br/>"
"<b>Locality:</b> %s<br/>"
"<b>Postalcode:</b> %s<br/>"
"<b>Region:</b> %s<br/>"
"<b>Timezone:</b> %s<br/>"
"<b>Accuracy level:</b> %i<br/>"
"<b>Accuracy horizontal:</b> %f<br/>"
"<b>Accuracy vertical:</b> %f",
address->timestamp, address->country, address->countrycode,
address->locality, address->postalcode, address->region,
address->timezone, address->accur->level, address->accur->horizontal,
address->accur->vertical);
elm_object_text_set(addr_label, buffer);
}
static Eina_Bool
_position_changed(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event)
{
Elocation_Position *position;
position = event;
_print_position(position);
return ECORE_CALLBACK_DONE;
}
static Eina_Bool
_address_changed(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event)
{
Elocation_Address *address;
address = event;
_print_address(address);
return ECORE_CALLBACK_DONE;
}
#endif
EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
#ifdef ELM_ELOCATION
Elocation_Address *address;
Elocation_Position *position;
#endif
/* The program will proceed only if Ewebkit library is available. */
if (elm_need_elocation() == EINA_FALSE)
return -1;
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
win = elm_win_util_standard_add("elocation", "Elocation example");
elm_win_autodel_set(win, EINA_TRUE);
box = elm_box_add(win);
elm_win_resize_object_add(win, box);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
pos_label = elm_label_add(box);
elm_label_line_wrap_set(pos_label, ELM_WRAP_CHAR);
elm_object_text_set(pos_label, "Getting location ...");
evas_object_size_hint_weight_set(pos_label, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(pos_label, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_label_slide_mode_set(pos_label, ELM_LABEL_SLIDE_MODE_ALWAYS);
elm_box_pack_end(box, pos_label);
evas_object_show(pos_label);
elm_box_padding_set(box, 0, 50);
addr_label = elm_label_add(box);
elm_label_line_wrap_set(addr_label, ELM_WRAP_CHAR);
elm_object_text_set(addr_label, "Getting location ...");
evas_object_size_hint_weight_set(addr_label, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(addr_label, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_label_slide_mode_set(addr_label, ELM_LABEL_SLIDE_MODE_ALWAYS);
elm_box_pack_end(box, addr_label);
evas_object_show(addr_label);
#ifdef ELM_ELOCATION
address = elocation_address_new();
position = elocation_position_new();
ecore_event_handler_add(ELOCATION_EVENT_POSITION, _position_changed, NULL);
ecore_event_handler_add(ELOCATION_EVENT_ADDRESS, _address_changed, NULL);
elocation_position_get(position);
_print_position(position);
elocation_address_get(address);
_print_address(address);
#endif
evas_object_show(box);
evas_object_resize(win, 600, 480);
evas_object_show(win);
elm_run();
#ifdef ELM_ELOCATION
elocation_position_free(position);
elocation_address_free(address);
#endif
return 0;
}
ELM_MAIN()

View File

@ -59,7 +59,6 @@ examples = [
'list_example_01',
'list_example_02',
'list_example_03',
'location_example_01',
'map_example_01',
'map_example_02',
'map_example_03',

View File

@ -1 +0,0 @@
/elocation

View File

@ -1,167 +0,0 @@
#include <stdio.h>
#define EFL_BETA_API_SUPPORT
#include <Ecore.h>
#include <Elocation.h>
/* A set of callbacks to react on incoming elocation events. They are standard
* ecore events and we register callbacks based on these events in the main
* function.
*/
static Eina_Bool
status_changed(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event)
{
int *status = event;
printf("Status changed to: %i\n", *status);
printf("\n");
return ECORE_CALLBACK_DONE;
}
static Eina_Bool
rgeocode_arrived(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event)
{
Elocation_Address *address;
address = event;
printf("Geocode reply:\n");
printf("Country: %s\n", address->country);
printf("Countrycode: %s\n", address->countrycode);
printf("Locality: %s\n", address->locality);
printf("Postalcode: %s\n", address->postalcode);
printf("Region: %s\n", address->region);
printf("Timezone: %s\n", address->timezone);
printf("Accuracy level: %i\n", address->accur->level);
printf("Accuracy horizontal: %f\n", address->accur->horizontal);
printf("Accuracy vertical: %f\n", address->accur->vertical);
printf("\n");
return ECORE_CALLBACK_DONE;
}
static Eina_Bool
geocode_arrived(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event)
{
Elocation_Position *position;
position = event;
printf("Reverse geocode reply:\n");
printf("Latitude:\t %f\n", position->latitude);
printf("Longitude:\t %f\n", position->longitude);
printf("Altitude:\t %f\n", position->altitude);
printf("Accuracy level: %i\n", position->accur->level);
printf("Accuracy horizontal: %f\n", position->accur->horizontal);
printf("Accuracy vertical: %f\n", position->accur->vertical);
printf("\n");
return ECORE_CALLBACK_DONE;
}
static Eina_Bool
address_changed(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event)
{
Elocation_Address *address;
address = event;
printf("Address update with data from timestamp: %i\n", address->timestamp);
printf("Country: %s\n", address->country);
printf("Countrycode: %s\n", address->countrycode);
printf("Locality: %s\n", address->locality);
printf("Postalcode: %s\n", address->postalcode);
printf("Region: %s\n", address->region);
printf("Timezone: %s\n", address->timezone);
printf("Accuracy level: %i\n", address->accur->level);
printf("Accuracy horizontal: %f\n", address->accur->horizontal);
printf("Accuracy vertical: %f\n", address->accur->vertical);
printf("\n");
return ECORE_CALLBACK_DONE;
}
static Eina_Bool
position_changed(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event)
{
Elocation_Position *position;
position = event;
printf("GeoClue position reply with data from timestamp %i\n", position->timestamp);
printf("Latitude:\t %f\n", position->latitude);
printf("Longitude:\t %f\n", position->longitude);
printf("Altitude:\t %f\n", position->altitude);
printf("Accuracy level: %i\n", position->accur->level);
printf("Accuracy horizontal: %f\n", position->accur->horizontal);
printf("Accuracy vertical: %f\n", position->accur->vertical);
printf("\n");
return ECORE_CALLBACK_DONE;
}
int
main(void)
{
Elocation_Address *address, *addr_geocode;
Elocation_Position *position, *pos_geocode;
int status;
/* Init the needed efl subsystems so we can safely use them */
ecore_init();
eldbus_init();
elocation_init();
/* Create an address and positon object that we use for all our operations.
* Needs to be freed manually with elocation_*_free when we now longer use
* them */
address = elocation_address_new();
position = elocation_position_new();
/* Register callback so we get updates later on */
ecore_event_handler_add(ELOCATION_EVENT_STATUS, status_changed, NULL);
ecore_event_handler_add(ELOCATION_EVENT_POSITION, position_changed, NULL);
ecore_event_handler_add(ELOCATION_EVENT_ADDRESS, address_changed, NULL);
ecore_event_handler_add(ELOCATION_EVENT_GEOCODE, geocode_arrived, NULL);
ecore_event_handler_add(ELOCATION_EVENT_REVERSEGEOCODE, rgeocode_arrived, NULL);
/* To the initial request for status address and position. This fills in the
* objects with the data from GeoClue */
elocation_status_get(&status);
elocation_position_get(position);
elocation_address_get(address);
/* Another set of address and position object. This time for demonstrating
* the GeoCode functionalities */
addr_geocode = elocation_address_new();
pos_geocode = elocation_position_new();
/* The Freeform API could use any string to transform it into position
* coordinates. How good that works depends on the used GeoClue provider */
elocation_freeform_address_to_position("London", pos_geocode);
/* Some demo values to show the position to address conversion */
pos_geocode->latitude = 51.7522;
pos_geocode->longitude = -1.25596;
pos_geocode->accur->level = 3;
elocation_position_to_address(pos_geocode, addr_geocode);
/* And now from address to position */
addr_geocode->locality = "Cambridge";
addr_geocode->countrycode = "UK";
elocation_address_to_position(addr_geocode, pos_geocode);
/* Enter the mainloop now that we are setup with initial data and waiting for
* events. */
ecore_main_loop_begin();
/* Cleanup allocated memory now that we shut down */
elocation_address_free(addr_geocode);
elocation_position_free(pos_geocode);
elocation_address_free(address);
elocation_position_free(position);
/* Make sure we also shut down the initialized subsystems */
elocation_shutdown();
eldbus_shutdown();
ecore_shutdown();
return 0;
}

View File

@ -73,10 +73,6 @@
#include <Efreet_Trash.h>
#include <Ethumb_Client.h>
#ifdef ELM_ELOCATION
#include <Elocation.h>
#endif
#ifdef ELM_EMAP
#include <EMap.h>
#endif

View File

@ -13,8 +13,4 @@
@ELM_LIBINTL_H_DEF@ ELM_LIBINTL_H
@ELM_DIRENT_H_DEF@ ELM_DIRENT_H
#ifdef EFL_BETA_API_SUPPORT
# define ELM_ELOCATION
#endif
#endif

View File

@ -1684,3 +1684,20 @@ EINA_DEPRECATED EAPI void elm_win_name_set(Evas_Object *obj, const char *name);
* @ingroup Elm_Textpath_Group
*/
EINA_DEPRECATED EAPI void elm_textpath_circle_set(Efl_Ui_Textpath *obj, double x, double y, double radius, double start_angle, Efl_Ui_Textpath_Direction direction);
/**
* Request that your elementary application needs elocation
*
* This initializes the elocation library when called and if
* support exists it returns @c EINA_TRUE, otherwise returns
* @c EINA_FALSE. This must be called before any elocation usage.
*
* @return @c EINA_TRUE if support exists and initialization succeeded.
*
* @since 1.8.0
*
* @deprecated removed beta API
*
* @ingroup eldbus
*/
EINA_DEPRECATED EAPI Eina_Bool elm_need_elocation(void);

View File

@ -690,30 +690,10 @@ _elm_unneed_eldbus(void)
eldbus_shutdown();
}
#ifdef ELM_ELOCATION
static Eina_Bool _elm_need_elocation = EINA_FALSE;
#endif
EAPI Eina_Bool
elm_need_elocation(void)
{
#ifdef ELM_ELOCATION
if (_elm_need_elocation) return EINA_TRUE;
_elm_need_elocation = EINA_TRUE;
elocation_init();
return EINA_TRUE;
#else
return EINA_FALSE;
#endif
}
static void
_elm_unneed_elocation(void)
{
#ifdef ELM_ELOCATION
if (!_elm_need_elocation) return;
_elm_need_elocation = EINA_FALSE;
elocation_shutdown();
#endif
}
static Eina_Bool _elm_need_efreet = EINA_FALSE;
@ -967,7 +947,6 @@ elm_quicklaunch_shutdown(void)
_elm_unneed_efreet();
_elm_unneed_e_dbus();
_elm_unneed_eldbus();
_elm_unneed_elocation();
_elm_unneed_ethumb();
_elm_unneed_web();

View File

@ -70,21 +70,6 @@ EAPI Eina_Bool elm_need_e_dbus(void) EINA_DEPRECATED;
*/
EAPI Eina_Bool elm_need_eldbus(void);
/**
* Request that your elementary application needs elocation
*
* This initializes the elocation library when called and if
* support exists it returns @c EINA_TRUE, otherwise returns
* @c EINA_FALSE. This must be called before any elocation usage.
*
* @return @c EINA_TRUE if support exists and initialization succeeded.
*
* @since 1.8.0
*
* @ingroup eldbus
*/
EAPI Eina_Bool elm_need_elocation(void);
/**
* Request that your elementary application needs ethumb
*

View File

@ -952,7 +952,7 @@ elementary_src = [
elementary_deps = [emile, eo, efl, edje, ethumb, ethumb_client, emotion, ecore_imf, ecore_con, eldbus, efreet, efreet_mime, efreet_trash, eio, atspi, dl, intl]
elementary_pub_deps = [eina, eet, evas, ecore, ecore_evas, ecore_file, ecore_input, ecore_imf, ecore_con,
edje, eldbus, efreet, efreet_mime, efreet_trash, ethumb_client, efl, elocation]
edje, eldbus, efreet, efreet_mime, efreet_trash, ethumb_client, efl]
elm_options = configuration_data()
@ -967,7 +967,6 @@ else
elm_options.set('DLL_EXPORT', '1')
endif
elm_options.set('ELM_ELOCATION', '1')
elm_options.set('ELM_EFREET', '1')
if config_h.has('HAVE_ALLOCA_H')

View File

@ -1,433 +0,0 @@
/**
* @file Elocation.h
* @brief Elocation Library
*
* @defgroup Location Location
*/
/**
* @page elocation_main Elocation (BETA)
*
* @section intro Elocation Use Cases
*
* Elocation is meant as a convenience library to ease application developers
* the usage of geo information in their apps. Adding a geo tag to a picture or
* translating an address to a GPS position and show it on a map widget are just
* some of the use cases.
*
* In the beginning elocation will rely on the GeoClue DBus service. Its has
* providers for various techniques to get hold off the current position.
* Ranging from GeoIP over wifi and GSM cell location to GPS. As well as
* provider to translates between location in a textual form to coordinates
* (GeoCode).
*
* Elocation covers all of these interfaces but in the end it depends on your
* system and the installed GeoClue providers what can be used.
*
* Currently it offer the following functionality:
* @li Request current address in textual form
* @li Request current position in GPS format
* @li Translate a position into and address or an address in a position
*
* You can find the API documentation at @ref Location
*/
#ifndef _ELOCATION_H
#define _ELOCATION_H
#ifdef EAPI
# undef EAPI
#endif
#ifdef _WIN32
# ifdef EFL_BUILD
# ifdef DLL_EXPORT
# define EAPI __declspec(dllexport)
# else
# define EAPI
# endif
# else
# define EAPI __declspec(dllimport)
# endif
#else
# ifdef __GNUC__
# if __GNUC__ >= 4
# define EAPI __attribute__ ((visibility("default")))
# else
# define EAPI
# endif
# else
# define EAPI
# endif
#endif
#ifdef EFL_BETA_API_SUPPORT
#include <stdio.h>
#include <Ecore.h>
#include <Eldbus.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @ingroup Location
* @brief Available location events that are emitted from the library
* @since 1.13
*
* Ecore events emitted by the library. Applications can register ecore event
* handlers to react on such events. After the initial query this can be used
* to keep track of changes and update your UI or data accordingly.
* @{
*/
EAPI extern int ELOCATION_EVENT_STATUS; /**< Status changed */
EAPI extern int ELOCATION_EVENT_POSITION; /**< Position changed */
EAPI extern int ELOCATION_EVENT_ADDRESS; /**< Address changed */
EAPI extern int ELOCATION_EVENT_VELOCITY; /**< Velocity changed */
EAPI extern int ELOCATION_EVENT_GEOCODE; /**< Reply for geocode translation arrived */
EAPI extern int ELOCATION_EVENT_REVERSEGEOCODE; /**< Reply for geocode translation arrived */
EAPI extern int ELOCATION_EVENT_NMEA; /**< NMEA update */
EAPI extern int ELOCATION_EVENT_SATELLITE; /**< Satellite info changed */
EAPI extern int ELOCATION_EVENT_POI; /**< POI reply */
EAPI extern int ELOCATION_EVENT_META_READY; /**< Meta provider is ready to be used */
/**@}*/
/**
* @ingroup Location
* @typedef Elocation_Accuracy_Level
* @since 1.13
*
* Different location accuracy levels from country level up to detailed,
* e.g. GPS, information.
* @{
*/
typedef enum {
ELOCATION_ACCURACY_LEVEL_NONE = 0,
ELOCATION_ACCURACY_LEVEL_COUNTRY = 1,
ELOCATION_ACCURACY_LEVEL_REGION, /* GeoClue1 only */
ELOCATION_ACCURACY_LEVEL_LOCALITY, /* GeoClue1 only */
ELOCATION_ACCURACY_LEVEL_POSTALCODE, /* GeoClue1 only */
ELOCATION_ACCURACY_LEVEL_CITY = 4, /* GeoClue2 only */
ELOCATION_ACCURACY_LEVEL_NEIGHBORHOOD = 5, /* GeoClue2 only */
ELOCATION_ACCURACY_LEVEL_STREET = 6,
ELOCATION_ACCURACY_LEVEL_DETAILED, /* GeoClue1 only */
ELOCATION_ACCURACY_LEVEL_EXACT = 8, /* GeoClue2 only */
} Elocation_Accuracy_Level;
/**@}*/
/**
* @ingroup Location
* @typedef Elocation_Resource_Flags
* @since 1.13
*
* Flags for available system resources to be used for locating. So far they
* cover physical resources like network connection, cellular network
* connection and GPS.
* @{
*/
typedef enum {
ELOCATION_RESOURCE_NONE = 0,
ELOCATION_RESOURCE_NETWORK = 1 << 0, /**< Internet connection is available */
ELOCATION_RESOURCE_CELL = 1 << 1, /**< Cell network information, e.g. GSM, is available */
ELOCATION_RESOURCE_GPS = 1 << 2, /**< GPS information is available */
ELOCATION_RESOURCE_ALL = (1 << 10) - 1 /**< All resources are available */
} Elocation_Resource_Flags;
/**@}*/
/**
* @ingroup Location
* @typedef Elocation_Accuracy
* @since 1.13
*
* Information about the accuracy of the reported location. For details about
* the level of accuracy see #Elocation_Accuracy_Level. It also covers
* horizontal and vertical accuracy. The values depend on the used provider
* and may very in quality.
*/
typedef struct _Elocation_Accuracy
{
Elocation_Accuracy_Level level;
double horizontal;
double vertical;
} Elocation_Accuracy;
/**
* @ingroup Location
* @typedef Elocation_Address
* @since 1.13
*
* Location information in textual form. Depending on the used provider this
* can cover only the country or a detailed address with postcode and street.
* The level of detail varies depending on the used provider.
* A timestamp is available to calculate the age of the address data.
*/
typedef struct _Elocation_Address
{
unsigned int timestamp; /**< Timestamp of data read out in seconds since epoch */
char *country;
char *countrycode;
char *locality;
char *postalcode;
char *region;
char *timezone;
Elocation_Accuracy *accur;
} Elocation_Address;
/**
* @ingroup Location
* @typedef Elocation_Position
* @since 1.13
*
* Location information based on the GPS grid. Latitude, longitude and altitude.
* A timestamp is available to calculate the age of the address data.
*/
typedef struct _Elocation_Position
{
unsigned int timestamp; /**< Timestamp of data read out in seconds since epoch */
double latitude;
double longitude;
double altitude;
Elocation_Accuracy *accur;
} Elocation_Position;
/**
* @ingroup Location
* @typedef Elocation_Velocity
* @since 1.13
*
* Velocity information. So far this interface is only offered with GPS based
* providers. It offers information about speed, direction and climb.
* A timestamp is available to calculate the age of the address data.
*
* FIXME: check units and formats of this values coming in from GeoClue
*/
typedef struct _Elocation_Velocity
{
unsigned int timestamp; /**< Timestamp of data read out in seconds since epoch */
double speed;
double direction;
double climb;
} Elocation_Velocity;
/**
* @ingroup Location
* @typedef Elocation_Requirements
* @since 1.13
*
* Requirement settings for the location provider. Requirements can be a level
* of accuracy or allowed resources like network access or GPS. See
* #Elocation_Resource_Flags for all available resource flags.
*
* Based on this setting the best provider is chosen between the available
* providers of GeoClue.
*/
typedef struct _Elocation_Requirements
{
Elocation_Accuracy_Level accurancy_level;
int min_time; /**< Minimal time between updates. Not implemented upstream */
Eina_Bool require_update;
Elocation_Resource_Flags allowed_resources;
} Elocation_Requirements;
/**
* @brief Create a new address object to operate on.
* @return Address object.
*
* The returned address object is safe to be operated on. It can be used for
* all other elocation functions. Once finished with it it need to be destroyed
* with a call to #elocation_address_free.
*
* @ingroup Location
* @since 1.13
*/
EAPI Elocation_Address *elocation_address_new(void);
/**
* @brief Free an address object
* @param address Address object to be freed.
*
* Destroys an address object created with #elocation_address_new. Should be
* used during the cleanup of the application or whenever the address object is
* no longer needed.
*
* @ingroup Location
* @since 1.13
*/
EAPI void elocation_address_free(Elocation_Address *address);
/**
* @brief Create a new position object to operate on.
* @return Position object.
*
* The returned address object is safe to be operated on. It can be used for
* all other elocation functions. Once finished with it it need to be destroyed
* with a call to #elocation_address_free.
*
* @ingroup Location
* @since 1.13
*/
EAPI Elocation_Position *elocation_position_new(void);
/**
* @brief Free an position object
* @param position Position object to be freed.
*
* Destroys a position object created with #elocation_address_new. Should be
* used during the cleanup of the application or whenever the location object is
* no longer needed.
*
* @ingroup Location
* @since 1.13
*/
EAPI void elocation_position_free(Elocation_Position *position);
/**
* @brief Get the current address information.
* @param address Address struct to be filled with information.
* @return EINA_TRUE for success and EINA_FALSE for failure.
*
* Request the latest address. The requested to the underling components might
* be asynchronous so better check the timestamp if the data has changed. To get
* events when the address changes one can also subscribe to the
* #ELOCATION_EVENT_ADDRESS ecore event which will have the address object as
* event.
*
* @ingroup Location
* @since 1.13
*/
EAPI Eina_Bool elocation_address_get(Elocation_Address *address);
/**
* @brief Get the current position information.
* @param position Position struct to be filled with information.
* @return EINA_TRUE for success and EINA_FALSE for failure.
*
* Request the latest position. The requested to the underling components might
* be asynchronous so better check the timestamp if the data has changed. To get
* events when the position changes one can also subscribe to the
* #ELOCATION_EVENT_POSITION ecore event which will have the position object as
* event.
*
* @ingroup Location
* @since 1.13
*/
EAPI Eina_Bool elocation_position_get(Elocation_Position *position);
/**
* @brief Get the current status.
* @param status Status
* @return EINA_TRUE for success and EINA_FALSE for failure.
*
* @ingroup Location
* @since 1.13
*/
EAPI Eina_Bool elocation_status_get(int *status);
/**
* @brief Set the requirements.
* @param requirements Requirements
* @return EINA_TRUE for success and EINA_FALSE for failure.
*
* Set the requirements for selecting a provider.
*
* @ingroup Location
* @since 1.13
*/
EAPI Eina_Bool elocation_requirements_set(Elocation_Requirements *requirements);
/**
* @brief Convert position to address
* @param position_shadow Position input
* @param address_shadow Address output
* @return EINA_TRUE for success and EINA_FALSE for failure.
*
* Use a GeoCode provider to translate from a given GPS coordinate
* representation of a location to a representation in textual form.
*
* @ingroup Location
* @since 1.13
*/
EAPI Eina_Bool elocation_position_to_address(Elocation_Position *position_shadow, Elocation_Address *address_shadow);
/**
* @brief Convert address to position
* @param address_shadow Address input
* @param position_shadow Position output
* @return EINA_TRUE for success and EINA_FALSE for failure.
*
* Use a GeoCode provider to translate from a given textual form
* representation of a location to a representation as GPS coordinates.
*
* @ingroup Location
* @since 1.13
*/
EAPI Eina_Bool elocation_address_to_position(Elocation_Address *address_shadow, Elocation_Position *position_shadow);
/**
* @brief Convert free form address tring to position
* @param freeform_address Address string in free form
* @param position_shadow Position output
* @return EINA_TRUE for success and EINA_FALSE for failure.
*
* Similar GeoCode translation from textual form to GPS coordinates as
* #elocation_address_to_position but in this case the address is a simple
* string which hopefully contains enough information for the provider to
* understand and translate.
*
* Useful for an easy search interface in an application but also more error
* prone regarding correct results.
*
* @ingroup Location
* @since 1.13
*/
EAPI Eina_Bool elocation_freeform_address_to_position(const char *freeform_address, Elocation_Position *position_shadow);
/**
* @brief Request a landmark position
* @param position_shadow Position ouput
* @param address_shadow Address input
* @return EINA_TRUE for success and EINA_FALSE for failure.
*
* Request a landmark position also known as Point Of Interest (POI) from
* GeoClue.
*
* @ingroup Location
* @since 1.13
*/
EAPI Eina_Bool elocation_landmarks_get(Elocation_Position *position_shadow, Elocation_Address *address_shadow);
/**
* @brief Initialize the elocation subsystem.
* @return EINA_TRUE for success and EINA_FALSE for failure.
*
* This function must be called before using any of the Elocation functionality
* in your application to make sure it it setup correctly for usage.
*
* @ingroup Location
* @since 1.13
*/
EAPI Eina_Bool elocation_init(void);
/**
* @brief Cleanup and shutdown the elocation subsystem.
*
* This function must be called when the application is no longer using any of
* the Elocation functionality to allow the subsystem to shutdown cleanly.
*
* @ingroup Location
* @since 1.13
*/
EAPI void elocation_shutdown(void);
#ifdef __cplusplus
}
#endif
#endif /* BETA API */
#undef EAPI
#define EAPI
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,186 +0,0 @@
#ifndef _ELOCATION_PRIVATE_H
#define _ELOCATION_PRIVATE_H
#ifdef EFL_BETA_API_SUPPORT
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <Eina.h>
#include <Ecore.h>
#include <Eldbus.h>
#ifndef ELOCATION_COLOR_DEFAULT
#define ELOCATION_COLOR_DEFAULT EINA_COLOR_BLUE
#endif
extern int _elocation_log_dom;
#ifdef CRI
#undef CRI
#endif
#ifdef ERR
#undef ERR
#endif
#ifdef INF
#undef INF
#endif
#ifdef WARN
#undef WARN
#endif
#ifdef DBG
#undef DBG
#endif
#define CRI(...) EINA_LOG_DOM_CRIT(_elocation_log_dom, __VA_ARGS__)
#define DBG(...) EINA_LOG_DOM_DBG(_elocation_log_dom, __VA_ARGS__)
#define INF(...) EINA_LOG_DOM_INFO(_elocation_log_dom, __VA_ARGS__)
#define WARN(...) EINA_LOG_DOM_WARN(_elocation_log_dom, __VA_ARGS__)
#define ERR(...) EINA_LOG_DOM_ERR(_elocation_log_dom, __VA_ARGS__)
/* Provider bus names and object paths. Master is the generic one which should
* pick up the best one internally based on given requirements. It is also still
* possible to use providers directly */
#define GEOCLUE_DBUS_NAME "org.freedesktop.Geoclue.Master"
#define GEOCLUE_OBJECT_PATH "/org/freedesktop/Geoclue/Master"
#define GSMLOC_DBUS_NAME "org.freedesktop.Geoclue.Providers.Gsmloc"
#define GSMLOC_OBJECT_PATH "/org/freedesktop/Geoclue/Providers/Gsmloc"
#define HOSTIP_DBUS_NAME "org.freedesktop.Geoclue.Providers.Hostip"
#define HOSTIP_OBJECT_PATH "/org/freedesktop/Geoclue/Providers/Hostip"
#define SKYHOOK_DBUS_NAME "org.freedesktop.Geoclue.Providers.Skyhook"
#define SKYHOOK_OBJECT_PATH "/org/freedesktop/Geoclue/Providers/Skyhook"
#define UBUNTU_DBUS_NAME "org.freedesktop.Geoclue.Providers.UbuntuGeoIP"
#define UBUNTU_OBJECT_PATH "/org/freedesktop/Geoclue/Providers/UbuntuGeoIP"
#define GEONAMES_DBUS_NAME "org.freedesktop.Geoclue.Providers.Geonames"
#define GEONAMES_OBJECT_PATH "/org/freedesktop/Geoclue/Providers/Geonames"
#define PLAZES_DBUS_NAME "org.freedesktop.Geoclue.Providers.Plazes"
#define PLAZES_OBJECT_PATH "/org/freedesktop/Geoclue/Providers/Plazes"
#define YAHOO_DBUS_NAME "org.freedesktop.Geoclue.Providers.Yahoo"
#define YAHOO_OBJECT_PATH "/org/freedesktop/Geoclue/Providers/Yahoo"
/* Master interfaces to control geoclue */
#define GEOCLUE_MASTER_IFACE "org.freedesktop.Geoclue.Master"
#define GEOCLUE_MASTERCLIENT_IFACE "org.freedesktop.Geoclue.MasterClient"
/* Provider interfaces to access location data */
#define GEOCLUE_GEOCLUE_IFACE "org.freedesktop.Geoclue"
#define GEOCLUE_POSITION_IFACE "org.freedesktop.Geoclue.Position"
#define GEOCLUE_ADDRESS_IFACE "org.freedesktop.Geoclue.Address"
#define GEOCLUE_VELOCITY_IFACE "org.freedesktop.Geoclue.Velocity"
#define GEOCLUE_GEOCODE_IFACE "org.freedesktop.Geoclue.Geocode"
#define GEOCLUE_REVERSEGEOCODE_IFACE "org.freedesktop.Geoclue.ReverseGeocode"
/* More provider interfaces. These three are not in upstream geoclue but only
* in the Tizen version. Lets hope they get upstream at some point. Right now
* we will test at runtime if they are offered and ignore them if not */
#define GEOCLUE_NMEA_IFACE "org.freedesktop.Geoclue.Nmea"
#define GEOCLUE_SATELLITE_IFACE "org.freedesktop.Geoclue.Satellite"
#define GEOCLUE_POI_IFACE "org.freedesktop.Geoclue.Poi"
#define GEOCLUE_ADDRESS_KEY_AREA "area"
#define GEOCLUE_ADDRESS_KEY_COUNTRY "country"
#define GEOCLUE_ADDRESS_KEY_COUNTRYCODE "countrycode"
#define GEOCLUE_ADDRESS_KEY_LOCALITY "locality"
#define GEOCLUE_ADDRESS_KEY_POSTALCODE "postalcode"
#define GEOCLUE_ADDRESS_KEY_REGION "region"
#define GEOCLUE_ADDRESS_KEY_STREET "street"
extern int ELOCATION_EVENT_IN;
extern int ELOCATION_EVENT_OUT;
/* Some ENUMs that we mimic from GeoClue code as we only access it over the DBus
* interface and share no header file for such defines.
*/
/**
* @ingroup Location
* @typedef GeocluePositionFields
* @since 1.13
*
* Bitmask to indicate which of the supplied positions fields are valid.
*
* @{
*/
typedef enum {
GEOCLUE_POSITION_FIELDS_NONE = 0,
GEOCLUE_POSITION_FIELDS_LATITUDE = 1 << 0,
GEOCLUE_POSITION_FIELDS_LONGITUDE = 1 << 1,
GEOCLUE_POSITION_FIELDS_ALTITUDE = 1 << 2
} GeocluePositionFields;
/**@}*/
/**
* @ingroup Location
* @typedef GeoclueNetworkStatus
* @since 1.13
*
* Status of the network connectivity for GeoClue. Needed for all providers that
* access external data to determine the location. For example GeoIP or GeoCode
* providers.
*
* @{
*/
typedef enum {
GEOCLUE_CONNECTIVITY_UNKNOWN,
GEOCLUE_CONNECTIVITY_OFFLINE,
GEOCLUE_CONNECTIVITY_ACQUIRING,
GEOCLUE_CONNECTIVITY_ONLINE,
} GeoclueNetworkStatus;
/**@}*/
/**
* @ingroup Location
* @typedef GeoclueStatus
* @since 1.13
*
* Status of a GeoClue provider.
*
* @{
*/
typedef enum {
GEOCLUE_STATUS_ERROR,
GEOCLUE_STATUS_UNAVAILABLE,
GEOCLUE_STATUS_ACQUIRING,
GEOCLUE_STATUS_AVAILABLE
} GeoclueStatus;
/**@}*/
/**
* @ingroup Location
* @typedef GeoclueVelocityFields
* @since 1.13
*
* Bitmask to indicate which of the supplied velocity fields are valid.
*
* @{
*/
typedef enum {
GEOCLUE_VELOCITY_FIELDS_NONE = 0,
GEOCLUE_VELOCITY_FIELDS_SPEED = 1 << 0,
GEOCLUE_VELOCITY_FIELDS_DIRECTION = 1 << 1,
GEOCLUE_VELOCITY_FIELDS_CLIMB = 1 << 2
} GeoclueVelocityFields;
/**@}*/
/**
* @ingroup Location
* @typedef Elocation_Provider
* @since 1.13
*
* Data structure to hold information about a GeoClue provider.
*
*/
typedef struct _Elocation_Provider
{
char *name;
char *description;
char *service;
char *path;
GeoclueStatus status;
} Elocation_Provider;
#endif /* BETA API */
#endif

View File

@ -1,448 +0,0 @@
#ifndef EFL_BETA_API_SUPPORT
# define EFL_BETA_API_SUPPORT
#endif
#include "eldbus_geo_clue2_client.h"
static int _log_main = -1;
#undef ERR
#define ERR(...) EINA_LOG_DOM_ERR(_log_main, __VA_ARGS__);
int GEO_CLUE2_CLIENT_LOCATION_UPDATED_EVENT = 0;
static void
cb_geo_clue2_client_start(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
void *user_data = eldbus_pending_data_del(pending, "__user_data");
Geo_Clue2_Client_Start_Cb cb = data;
const char *error, *error_msg;
Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
if (eldbus_message_error_get(msg, &error, &error_msg))
{
Eldbus_Error_Info error_info = {error, error_msg};
cb(proxy, user_data, pending, &error_info);
return;
}
if (!eldbus_message_arguments_get(msg, ""))
{
Eldbus_Error_Info error_info = {"", ""};
ERR("Error: Getting arguments from message.");
cb(proxy, user_data, pending, &error_info);
return;
}
cb(proxy, user_data, pending, NULL);
return;
}
Eldbus_Pending *
geo_clue2_client_start_call(Eldbus_Proxy *proxy, Geo_Clue2_Client_Start_Cb cb, const void *data)
{
Eldbus_Message *msg;
Eldbus_Pending *p;
EINA_SAFETY_ON_NULL_RETURN_VAL(proxy, NULL);
msg = eldbus_proxy_method_call_new(proxy, "Start");
if (!eldbus_message_arguments_append(msg, ""))
{
ERR("Error: Filling message.");
eldbus_message_unref(msg);
return NULL;
}
p = eldbus_proxy_send(proxy, msg, cb_geo_clue2_client_start, cb, -1);
if (data)
eldbus_pending_data_set(p, "__user_data", data);
eldbus_pending_data_set(p, "__proxy", proxy);
return p;
}
static void
cb_geo_clue2_client_stop(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
void *user_data = eldbus_pending_data_del(pending, "__user_data");
Geo_Clue2_Client_Stop_Cb cb = data;
const char *error, *error_msg;
Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
if (eldbus_message_error_get(msg, &error, &error_msg))
{
Eldbus_Error_Info error_info = {error, error_msg};
cb(proxy, user_data, pending, &error_info);
return;
}
if (!eldbus_message_arguments_get(msg, ""))
{
Eldbus_Error_Info error_info = {"", ""};
ERR("Error: Getting arguments from message.");
cb(proxy, user_data, pending, &error_info);
return;
}
cb(proxy, user_data, pending, NULL);
return;
}
Eldbus_Pending *
geo_clue2_client_stop_call(Eldbus_Proxy *proxy, Geo_Clue2_Client_Stop_Cb cb, const void *data)
{
Eldbus_Message *msg;
Eldbus_Pending *p;
EINA_SAFETY_ON_NULL_RETURN_VAL(proxy, NULL);
msg = eldbus_proxy_method_call_new(proxy, "Stop");
if (!eldbus_message_arguments_append(msg, ""))
{
ERR("Error: Filling message.");
eldbus_message_unref(msg);
return NULL;
}
p = eldbus_proxy_send(proxy, msg, cb_geo_clue2_client_stop, cb, -1);
if (data)
eldbus_pending_data_set(p, "__user_data", data);
eldbus_pending_data_set(p, "__proxy", proxy);
return p;
}
static void
geo_clue2_client_location_updated_data_free(void *user_data EINA_UNUSED, void *func_data)
{
Geo_Clue2_Client_LocationUpdated_Data *s_data = func_data;
free(s_data->old);
free(s_data->new);
free(s_data);
}
static void
on_geo_clue2_client_location_updated(void *data, const Eldbus_Message *msg)
{
Eldbus_Proxy *proxy = data;
Geo_Clue2_Client_LocationUpdated_Data *s_data = calloc(1, sizeof(Geo_Clue2_Client_LocationUpdated_Data));
s_data->proxy = proxy;
if (!eldbus_message_arguments_get(msg, "oo", &s_data->old, &s_data->new))
{
ERR("Error: Getting arguments from message.");
free(s_data);
return;
}
s_data->old = strdup(s_data->old);
s_data->new = strdup(s_data->new);
ecore_event_add(GEO_CLUE2_CLIENT_LOCATION_UPDATED_EVENT, s_data, geo_clue2_client_location_updated_data_free, NULL);
}
static void
cb_geo_clue2_client_location(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
void *user_data = eldbus_pending_data_del(pending, "__user_data");
const char *error, *error_msg;
Eldbus_Codegen_Property_String_Get_Cb cb = data;
Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
Eldbus_Message_Iter *variant;
const char *v;
if (eldbus_message_error_get(msg, &error, &error_msg))
{
Eldbus_Error_Info error_info = {error, error_msg};
cb(user_data, pending, "Location", proxy, &error_info, NULL);
return;
}
if (!eldbus_message_arguments_get(msg, "v", &variant))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "Location", proxy, &error_info, NULL);
return;
}
if (!eldbus_message_iter_arguments_get(variant, "o", &v))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "Location", proxy, &error_info, NULL);
return;
}
cb(user_data, pending, "Location", proxy, NULL, v);
}
Eldbus_Pending *
geo_clue2_client_location_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_String_Get_Cb cb, const void *data)
{
Eldbus_Pending *p;
EINA_SAFETY_ON_NULL_RETURN_VAL(proxy, NULL);
p = eldbus_proxy_property_get(proxy, "Location", cb_geo_clue2_client_location, cb);
if (data)
eldbus_pending_data_set(p, "__user_data", data);
eldbus_pending_data_set(p, "__proxy", proxy);
return p;
}
static void
cb_geo_clue2_client_distance_threshold(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
void *user_data = eldbus_pending_data_del(pending, "__user_data");
const char *error, *error_msg;
Eldbus_Codegen_Property_Uint32_Get_Cb cb = data;
Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
Eldbus_Message_Iter *variant;
unsigned int v;
if (eldbus_message_error_get(msg, &error, &error_msg))
{
Eldbus_Error_Info error_info = {error, error_msg};
cb(user_data, pending, "DistanceThreshold", proxy, &error_info, 0);
return;
}
if (!eldbus_message_arguments_get(msg, "v", &variant))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "DistanceThreshold", proxy, &error_info, 0);
return;
}
if (!eldbus_message_iter_arguments_get(variant, "u", &v))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "DistanceThreshold", proxy, &error_info, 0);
return;
}
cb(user_data, pending, "DistanceThreshold", proxy, NULL, v);
}
Eldbus_Pending *
geo_clue2_client_distance_threshold_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Uint32_Get_Cb cb, const void *data)
{
Eldbus_Pending *p;
EINA_SAFETY_ON_NULL_RETURN_VAL(proxy, NULL);
p = eldbus_proxy_property_get(proxy, "DistanceThreshold", cb_geo_clue2_client_distance_threshold, cb);
if (data)
eldbus_pending_data_set(p, "__user_data", data);
eldbus_pending_data_set(p, "__proxy", proxy);
return p;
}
static void
cb_geo_clue2_client_distance_threshold_set(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
const char *error, *error_msg;
void *user_data = eldbus_pending_data_del(pending, "__user_data");
Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
Eldbus_Codegen_Property_Set_Cb cb = data;
if (eldbus_message_error_get(msg, &error, &error_msg)) {
Eldbus_Error_Info error_info = {error, error_msg};
cb(user_data, "DistanceThreshold", proxy, pending, &error_info);
return;
}
cb(user_data, "DistanceThreshold", proxy, pending, NULL);
}
Eldbus_Pending *
geo_clue2_client_distance_threshold_propset(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Set_Cb cb, const void *data, const void *value)
{
Eldbus_Pending *p;
EINA_SAFETY_ON_NULL_RETURN_VAL(proxy, NULL);
EINA_SAFETY_ON_NULL_RETURN_VAL(value, NULL);
p = eldbus_proxy_property_set(proxy, "DistanceThreshold", "u", value, cb_geo_clue2_client_distance_threshold_set, cb);
eldbus_pending_data_set(p, "__user_data", data);
eldbus_pending_data_set(p, "__proxy", proxy);
return p;
}
static void
cb_geo_clue2_client_desktop_id(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
void *user_data = eldbus_pending_data_del(pending, "__user_data");
const char *error, *error_msg;
Eldbus_Codegen_Property_String_Get_Cb cb = data;
Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
Eldbus_Message_Iter *variant;
const char *v;
if (eldbus_message_error_get(msg, &error, &error_msg))
{
Eldbus_Error_Info error_info = {error, error_msg};
cb(user_data, pending, "DesktopId", proxy, &error_info, NULL);
return;
}
if (!eldbus_message_arguments_get(msg, "v", &variant))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "DesktopId", proxy, &error_info, NULL);
return;
}
if (!eldbus_message_iter_arguments_get(variant, "s", &v))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "DesktopId", proxy, &error_info, NULL);
return;
}
cb(user_data, pending, "DesktopId", proxy, NULL, v);
}
Eldbus_Pending *
geo_clue2_client_desktop_id_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_String_Get_Cb cb, const void *data)
{
Eldbus_Pending *p;
EINA_SAFETY_ON_NULL_RETURN_VAL(proxy, NULL);
p = eldbus_proxy_property_get(proxy, "DesktopId", cb_geo_clue2_client_desktop_id, cb);
if (data)
eldbus_pending_data_set(p, "__user_data", data);
eldbus_pending_data_set(p, "__proxy", proxy);
return p;
}
static void
cb_geo_clue2_client_desktop_id_set(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
const char *error, *error_msg;
void *user_data = eldbus_pending_data_del(pending, "__user_data");
Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
Eldbus_Codegen_Property_Set_Cb cb = data;
if (eldbus_message_error_get(msg, &error, &error_msg)) {
Eldbus_Error_Info error_info = {error, error_msg};
cb(user_data, "DesktopId", proxy, pending, &error_info);
return;
}
cb(user_data, "DesktopId", proxy, pending, NULL);
}
Eldbus_Pending *
geo_clue2_client_desktop_id_propset(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Set_Cb cb, const void *data, const void *value)
{
Eldbus_Pending *p;
EINA_SAFETY_ON_NULL_RETURN_VAL(proxy, NULL);
EINA_SAFETY_ON_NULL_RETURN_VAL(value, NULL);
p = eldbus_proxy_property_set(proxy, "DesktopId", "s", value, cb_geo_clue2_client_desktop_id_set, cb);
eldbus_pending_data_set(p, "__user_data", data);
eldbus_pending_data_set(p, "__proxy", proxy);
return p;
}
static void
cb_geo_clue2_client_requested_accuracy_level(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
void *user_data = eldbus_pending_data_del(pending, "__user_data");
const char *error, *error_msg;
Eldbus_Codegen_Property_Uint32_Get_Cb cb = data;
Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
Eldbus_Message_Iter *variant;
unsigned int v;
if (eldbus_message_error_get(msg, &error, &error_msg))
{
Eldbus_Error_Info error_info = {error, error_msg};
cb(user_data, pending, "RequestedAccuracyLevel", proxy, &error_info, 0);
return;
}
if (!eldbus_message_arguments_get(msg, "v", &variant))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "RequestedAccuracyLevel", proxy, &error_info, 0);
return;
}
if (!eldbus_message_iter_arguments_get(variant, "u", &v))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "RequestedAccuracyLevel", proxy, &error_info, 0);
return;
}
cb(user_data, pending, "RequestedAccuracyLevel", proxy, NULL, v);
}
Eldbus_Pending *
geo_clue2_client_requested_accuracy_level_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Uint32_Get_Cb cb, const void *data)
{
Eldbus_Pending *p;
EINA_SAFETY_ON_NULL_RETURN_VAL(proxy, NULL);
p = eldbus_proxy_property_get(proxy, "RequestedAccuracyLevel", cb_geo_clue2_client_requested_accuracy_level, cb);
if (data)
eldbus_pending_data_set(p, "__user_data", data);
eldbus_pending_data_set(p, "__proxy", proxy);
return p;
}
static void
cb_geo_clue2_client_requested_accuracy_level_set(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
const char *error, *error_msg;
void *user_data = eldbus_pending_data_del(pending, "__user_data");
Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
Eldbus_Codegen_Property_Set_Cb cb = data;
if (eldbus_message_error_get(msg, &error, &error_msg)) {
Eldbus_Error_Info error_info = {error, error_msg};
cb(user_data, "RequestedAccuracyLevel", proxy, pending, &error_info);
return;
}
cb(user_data, "RequestedAccuracyLevel", proxy, pending, NULL);
}
Eldbus_Pending *
geo_clue2_client_requested_accuracy_level_propset(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Set_Cb cb, const void *data, const void *value)
{
Eldbus_Pending *p;
EINA_SAFETY_ON_NULL_RETURN_VAL(proxy, NULL);
EINA_SAFETY_ON_NULL_RETURN_VAL(value, NULL);
p = eldbus_proxy_property_set(proxy, "RequestedAccuracyLevel", "u", value, cb_geo_clue2_client_requested_accuracy_level_set, cb);
eldbus_pending_data_set(p, "__user_data", data);
eldbus_pending_data_set(p, "__proxy", proxy);
return p;
}
static void
cb_geo_clue2_client_active(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
void *user_data = eldbus_pending_data_del(pending, "__user_data");
const char *error, *error_msg;
Eldbus_Codegen_Property_Bool_Get_Cb cb = data;
Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
Eldbus_Message_Iter *variant;
Eina_Bool v;
if (eldbus_message_error_get(msg, &error, &error_msg))
{
Eldbus_Error_Info error_info = {error, error_msg};
cb(user_data, pending, "Active", proxy, &error_info, 0);
return;
}
if (!eldbus_message_arguments_get(msg, "v", &variant))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "Active", proxy, &error_info, 0);
return;
}
if (!eldbus_message_iter_arguments_get(variant, "b", &v))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "Active", proxy, &error_info, 0);
return;
}
cb(user_data, pending, "Active", proxy, NULL, v);
}
Eldbus_Pending *
geo_clue2_client_active_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Bool_Get_Cb cb, const void *data)
{
Eldbus_Pending *p;
EINA_SAFETY_ON_NULL_RETURN_VAL(proxy, NULL);
p = eldbus_proxy_property_get(proxy, "Active", cb_geo_clue2_client_active, cb);
if (data)
eldbus_pending_data_set(p, "__user_data", data);
eldbus_pending_data_set(p, "__proxy", proxy);
return p;
}
void
geo_clue2_client_log_domain_set(int id)
{
_log_main = id;
}
void
geo_clue2_client_proxy_unref(Eldbus_Proxy *proxy)
{
Eldbus_Object *obj = eldbus_proxy_object_get(proxy);
eldbus_proxy_unref(proxy);
eldbus_object_unref(obj);
}
Eldbus_Proxy *
geo_clue2_client_proxy_get(Eldbus_Connection *conn, const char *bus, const char *path)
{
Eldbus_Object *obj;
Eldbus_Proxy *proxy;
EINA_SAFETY_ON_NULL_RETURN_VAL(conn, NULL);
EINA_SAFETY_ON_NULL_RETURN_VAL(bus, NULL);
if (!path) path = "/";
obj = eldbus_object_get(conn, bus, path);
proxy = eldbus_proxy_get(obj, "org.freedesktop.GeoClue2.Client");
eldbus_proxy_signal_handler_add(proxy, "LocationUpdated", on_geo_clue2_client_location_updated, proxy);
if (!GEO_CLUE2_CLIENT_LOCATION_UPDATED_EVENT)
GEO_CLUE2_CLIENT_LOCATION_UPDATED_EVENT = ecore_event_type_new();
return proxy;
}

View File

@ -1,36 +0,0 @@
#ifndef ELDBUS_GEO_CLUE2_CLIENT_H
#define ELDBUS_GEO_CLUE2_CLIENT_H
#ifdef EFL_BETA_API_SUPPORT
#include <Eina.h>
#include <Ecore.h>
#include <Eldbus.h>
#include "eldbus_utils.h"
Eldbus_Proxy *geo_clue2_client_proxy_get(Eldbus_Connection *conn, const char *bus, const char *path);
void geo_clue2_client_proxy_unref(Eldbus_Proxy *proxy);
void geo_clue2_client_log_domain_set(int id);
typedef void (*Geo_Clue2_Client_Start_Cb)(Eldbus_Proxy *proxy, void *data, Eldbus_Pending *pending, Eldbus_Error_Info *error);
Eldbus_Pending *geo_clue2_client_start_call(Eldbus_Proxy *proxy, Geo_Clue2_Client_Start_Cb cb, const void *data);
typedef void (*Geo_Clue2_Client_Stop_Cb)(Eldbus_Proxy *proxy, void *data, Eldbus_Pending *pending, Eldbus_Error_Info *error);
Eldbus_Pending *geo_clue2_client_stop_call(Eldbus_Proxy *proxy, Geo_Clue2_Client_Stop_Cb cb, const void *data);
extern int GEO_CLUE2_CLIENT_LOCATION_UPDATED_EVENT;
typedef struct _Geo_Clue2_Client_LocationUpdated_Data
{
Eldbus_Proxy *proxy;
char *old;
char *new;
} Geo_Clue2_Client_LocationUpdated_Data;
Eldbus_Pending *geo_clue2_client_location_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_String_Get_Cb cb, const void *data);
Eldbus_Pending *geo_clue2_client_distance_threshold_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Uint32_Get_Cb cb, const void *data);
Eldbus_Pending *geo_clue2_client_distance_threshold_propset(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Set_Cb cb, const void *data, const void *value);
Eldbus_Pending *geo_clue2_client_desktop_id_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_String_Get_Cb cb, const void *data);
Eldbus_Pending *geo_clue2_client_desktop_id_propset(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Set_Cb cb, const void *data, const void *value);
Eldbus_Pending *geo_clue2_client_requested_accuracy_level_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Uint32_Get_Cb cb, const void *data);
Eldbus_Pending *geo_clue2_client_requested_accuracy_level_propset(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Set_Cb cb, const void *data, const void *value);
Eldbus_Pending *geo_clue2_client_active_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Bool_Get_Cb cb, const void *data);
#endif /* BETA API */
#endif

View File

@ -1,246 +0,0 @@
#ifndef EFL_BETA_API_SUPPORT
# define EFL_BETA_API_SUPPORT
#endif
#include "eldbus_geo_clue2_location.h"
static int _log_main = -1;
#undef ERR
#define ERR(...) EINA_LOG_DOM_ERR(_log_main, __VA_ARGS__);
static void
cb_geo_clue2_location_latitude(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
void *user_data = eldbus_pending_data_del(pending, "__user_data");
const char *error, *error_msg;
Eldbus_Codegen_Property_Double_Get_Cb cb = data;
Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
Eldbus_Message_Iter *variant;
double v;
if (eldbus_message_error_get(msg, &error, &error_msg))
{
Eldbus_Error_Info error_info = {error, error_msg};
cb(user_data, pending, "Latitude", proxy, &error_info, 0);
return;
}
if (!eldbus_message_arguments_get(msg, "v", &variant))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "Latitude", proxy, &error_info, 0);
return;
}
if (!eldbus_message_iter_arguments_get(variant, "d", &v))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "Latitude", proxy, &error_info, 0);
return;
}
cb(user_data, pending, "Latitude", proxy, NULL, v);
}
Eldbus_Pending *
geo_clue2_location_latitude_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Double_Get_Cb cb, const void *data)
{
Eldbus_Pending *p;
EINA_SAFETY_ON_NULL_RETURN_VAL(proxy, NULL);
p = eldbus_proxy_property_get(proxy, "Latitude", cb_geo_clue2_location_latitude, cb);
if (data)
eldbus_pending_data_set(p, "__user_data", data);
eldbus_pending_data_set(p, "__proxy", proxy);
return p;
}
static void
cb_geo_clue2_location_longitude(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
void *user_data = eldbus_pending_data_del(pending, "__user_data");
const char *error, *error_msg;
Eldbus_Codegen_Property_Double_Get_Cb cb = data;
Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
Eldbus_Message_Iter *variant;
double v;
if (eldbus_message_error_get(msg, &error, &error_msg))
{
Eldbus_Error_Info error_info = {error, error_msg};
cb(user_data, pending, "Longitude", proxy, &error_info, 0);
return;
}
if (!eldbus_message_arguments_get(msg, "v", &variant))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "Longitude", proxy, &error_info, 0);
return;
}
if (!eldbus_message_iter_arguments_get(variant, "d", &v))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "Longitude", proxy, &error_info, 0);
return;
}
cb(user_data, pending, "Longitude", proxy, NULL, v);
}
Eldbus_Pending *
geo_clue2_location_longitude_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Double_Get_Cb cb, const void *data)
{
Eldbus_Pending *p;
EINA_SAFETY_ON_NULL_RETURN_VAL(proxy, NULL);
p = eldbus_proxy_property_get(proxy, "Longitude", cb_geo_clue2_location_longitude, cb);
if (data)
eldbus_pending_data_set(p, "__user_data", data);
eldbus_pending_data_set(p, "__proxy", proxy);
return p;
}
static void
cb_geo_clue2_location_accuracy(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
void *user_data = eldbus_pending_data_del(pending, "__user_data");
const char *error, *error_msg;
Eldbus_Codegen_Property_Double_Get_Cb cb = data;
Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
Eldbus_Message_Iter *variant;
double v;
if (eldbus_message_error_get(msg, &error, &error_msg))
{
Eldbus_Error_Info error_info = {error, error_msg};
cb(user_data, pending, "Accuracy", proxy, &error_info, 0);
return;
}
if (!eldbus_message_arguments_get(msg, "v", &variant))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "Accuracy", proxy, &error_info, 0);
return;
}
if (!eldbus_message_iter_arguments_get(variant, "d", &v))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "Accuracy", proxy, &error_info, 0);
return;
}
cb(user_data, pending, "Accuracy", proxy, NULL, v);
}
Eldbus_Pending *
geo_clue2_location_accuracy_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Double_Get_Cb cb, const void *data)
{
Eldbus_Pending *p;
EINA_SAFETY_ON_NULL_RETURN_VAL(proxy, NULL);
p = eldbus_proxy_property_get(proxy, "Accuracy", cb_geo_clue2_location_accuracy, cb);
if (data)
eldbus_pending_data_set(p, "__user_data", data);
eldbus_pending_data_set(p, "__proxy", proxy);
return p;
}
static void
cb_geo_clue2_location_altitude(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
void *user_data = eldbus_pending_data_del(pending, "__user_data");
const char *error, *error_msg;
Eldbus_Codegen_Property_Double_Get_Cb cb = data;
Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
Eldbus_Message_Iter *variant;
double v;
if (eldbus_message_error_get(msg, &error, &error_msg))
{
Eldbus_Error_Info error_info = {error, error_msg};
cb(user_data, pending, "Altitude", proxy, &error_info, 0);
return;
}
if (!eldbus_message_arguments_get(msg, "v", &variant))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "Altitude", proxy, &error_info, 0);
return;
}
if (!eldbus_message_iter_arguments_get(variant, "d", &v))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "Altitude", proxy, &error_info, 0);
return;
}
cb(user_data, pending, "Altitude", proxy, NULL, v);
}
Eldbus_Pending *
geo_clue2_location_altitude_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Double_Get_Cb cb, const void *data)
{
Eldbus_Pending *p;
EINA_SAFETY_ON_NULL_RETURN_VAL(proxy, NULL);
p = eldbus_proxy_property_get(proxy, "Altitude", cb_geo_clue2_location_altitude, cb);
if (data)
eldbus_pending_data_set(p, "__user_data", data);
eldbus_pending_data_set(p, "__proxy", proxy);
return p;
}
static void
cb_geo_clue2_location_description(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
void *user_data = eldbus_pending_data_del(pending, "__user_data");
const char *error, *error_msg;
Eldbus_Codegen_Property_String_Get_Cb cb = data;
Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
Eldbus_Message_Iter *variant;
const char *v;
if (eldbus_message_error_get(msg, &error, &error_msg))
{
Eldbus_Error_Info error_info = {error, error_msg};
cb(user_data, pending, "Description", proxy, &error_info, NULL);
return;
}
if (!eldbus_message_arguments_get(msg, "v", &variant))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "Description", proxy, &error_info, NULL);
return;
}
if (!eldbus_message_iter_arguments_get(variant, "s", &v))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "Description", proxy, &error_info, NULL);
return;
}
cb(user_data, pending, "Description", proxy, NULL, v);
}
Eldbus_Pending *
geo_clue2_location_description_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_String_Get_Cb cb, const void *data)
{
Eldbus_Pending *p;
EINA_SAFETY_ON_NULL_RETURN_VAL(proxy, NULL);
p = eldbus_proxy_property_get(proxy, "Description", cb_geo_clue2_location_description, cb);
if (data)
eldbus_pending_data_set(p, "__user_data", data);
eldbus_pending_data_set(p, "__proxy", proxy);
return p;
}
void
geo_clue2_location_log_domain_set(int id)
{
_log_main = id;
}
void
geo_clue2_location_proxy_unref(Eldbus_Proxy *proxy)
{
Eldbus_Object *obj = eldbus_proxy_object_get(proxy);
eldbus_proxy_unref(proxy);
eldbus_object_unref(obj);
}
Eldbus_Proxy *
geo_clue2_location_proxy_get(Eldbus_Connection *conn, const char *bus, const char *path)
{
Eldbus_Object *obj;
Eldbus_Proxy *proxy;
EINA_SAFETY_ON_NULL_RETURN_VAL(conn, NULL);
EINA_SAFETY_ON_NULL_RETURN_VAL(bus, NULL);
if (!path) path = "/";
obj = eldbus_object_get(conn, bus, path);
proxy = eldbus_proxy_get(obj, "org.freedesktop.GeoClue2.Location");
return proxy;
}

View File

@ -1,22 +0,0 @@
#ifndef ELDBUS_GEO_CLUE2_LOCATION_H
#define ELDBUS_GEO_CLUE2_LOCATION_H
#ifdef EFL_BETA_API_SUPPORT
#include <Eina.h>
#include <Ecore.h>
#include <Eldbus.h>
#include "eldbus_utils.h"
Eldbus_Proxy *geo_clue2_location_proxy_get(Eldbus_Connection *conn, const char *bus, const char *path);
void geo_clue2_location_proxy_unref(Eldbus_Proxy *proxy);
void geo_clue2_location_log_domain_set(int id);
Eldbus_Pending *geo_clue2_location_latitude_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Double_Get_Cb cb, const void *data);
Eldbus_Pending *geo_clue2_location_longitude_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Double_Get_Cb cb, const void *data);
Eldbus_Pending *geo_clue2_location_accuracy_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Double_Get_Cb cb, const void *data);
Eldbus_Pending *geo_clue2_location_altitude_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Double_Get_Cb cb, const void *data);
Eldbus_Pending *geo_clue2_location_description_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_String_Get_Cb cb, const void *data);
#endif /* BETA API */
#endif

View File

@ -1,209 +0,0 @@
#ifndef EFL_BETA_API_SUPPORT
# define EFL_BETA_API_SUPPORT
#endif
#include "eldbus_geo_clue2_manager.h"
static int _log_main = -1;
#undef ERR
#define ERR(...) EINA_LOG_DOM_ERR(_log_main, __VA_ARGS__);
static void
cb_geo_clue2_manager_get_client(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
void *user_data = eldbus_pending_data_del(pending, "__user_data");
Geo_Clue2_Manager_Get_Client_Cb cb = data;
const char *error, *error_msg;
Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
const char *client = NULL;
if (eldbus_message_error_get(msg, &error, &error_msg))
{
Eldbus_Error_Info error_info = {error, error_msg};
cb(proxy, user_data, pending, &error_info, client);
return;
}
if (!eldbus_message_arguments_get(msg, "o", &client))
{
Eldbus_Error_Info error_info = {"", ""};
ERR("Error: Getting arguments from message.");
cb(proxy, user_data, pending, &error_info, client);
return;
}
cb(proxy, user_data, pending, NULL, client);
return;
}
Eldbus_Pending *
geo_clue2_manager_get_client_call(Eldbus_Proxy *proxy, Geo_Clue2_Manager_Get_Client_Cb cb, const void *data)
{
Eldbus_Message *msg;
Eldbus_Pending *p;
EINA_SAFETY_ON_NULL_RETURN_VAL(proxy, NULL);
msg = eldbus_proxy_method_call_new(proxy, "GetClient");
if (!eldbus_message_arguments_append(msg, ""))
{
ERR("Error: Filling message.");
eldbus_message_unref(msg);
return NULL;
}
p = eldbus_proxy_send(proxy, msg, cb_geo_clue2_manager_get_client, cb, -1);
if (data)
eldbus_pending_data_set(p, "__user_data", data);
eldbus_pending_data_set(p, "__proxy", proxy);
return p;
}
static void
cb_geo_clue2_manager_add_agent(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
void *user_data = eldbus_pending_data_del(pending, "__user_data");
Geo_Clue2_Manager_Add_Agent_Cb cb = data;
const char *error, *error_msg;
Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
if (eldbus_message_error_get(msg, &error, &error_msg))
{
Eldbus_Error_Info error_info = {error, error_msg};
cb(proxy, user_data, pending, &error_info);
return;
}
if (!eldbus_message_arguments_get(msg, ""))
{
Eldbus_Error_Info error_info = {"", ""};
ERR("Error: Getting arguments from message.");
cb(proxy, user_data, pending, &error_info);
return;
}
cb(proxy, user_data, pending, NULL);
return;
}
Eldbus_Pending *
geo_clue2_manager_add_agent_call(Eldbus_Proxy *proxy, Geo_Clue2_Manager_Add_Agent_Cb cb, const void *data, const char *id)
{
Eldbus_Message *msg;
Eldbus_Pending *p;
EINA_SAFETY_ON_NULL_RETURN_VAL(proxy, NULL);
msg = eldbus_proxy_method_call_new(proxy, "AddAgent");
if (!eldbus_message_arguments_append(msg, "s", id))
{
ERR("Error: Filling message.");
eldbus_message_unref(msg);
return NULL;
}
p = eldbus_proxy_send(proxy, msg, cb_geo_clue2_manager_add_agent, cb, -1);
if (data)
eldbus_pending_data_set(p, "__user_data", data);
eldbus_pending_data_set(p, "__proxy", proxy);
return p;
}
static void
cb_geo_clue2_manager_in_use(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
void *user_data = eldbus_pending_data_del(pending, "__user_data");
const char *error, *error_msg;
Eldbus_Codegen_Property_Bool_Get_Cb cb = data;
Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
Eldbus_Message_Iter *variant;
Eina_Bool v;
if (eldbus_message_error_get(msg, &error, &error_msg))
{
Eldbus_Error_Info error_info = {error, error_msg};
cb(user_data, pending, "InUse", proxy, &error_info, 0);
return;
}
if (!eldbus_message_arguments_get(msg, "v", &variant))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "InUse", proxy, &error_info, 0);
return;
}
if (!eldbus_message_iter_arguments_get(variant, "b", &v))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "InUse", proxy, &error_info, 0);
return;
}
cb(user_data, pending, "InUse", proxy, NULL, v);
}
Eldbus_Pending *
geo_clue2_manager_in_use_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Bool_Get_Cb cb, const void *data)
{
Eldbus_Pending *p;
EINA_SAFETY_ON_NULL_RETURN_VAL(proxy, NULL);
p = eldbus_proxy_property_get(proxy, "InUse", cb_geo_clue2_manager_in_use, cb);
if (data)
eldbus_pending_data_set(p, "__user_data", data);
eldbus_pending_data_set(p, "__proxy", proxy);
return p;
}
static void
cb_geo_clue2_manager_available_accuracy_level(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
{
void *user_data = eldbus_pending_data_del(pending, "__user_data");
const char *error, *error_msg;
Eldbus_Codegen_Property_Uint32_Get_Cb cb = data;
Eldbus_Proxy *proxy = eldbus_pending_data_del(pending, "__proxy");
Eldbus_Message_Iter *variant;
unsigned int v;
if (eldbus_message_error_get(msg, &error, &error_msg))
{
Eldbus_Error_Info error_info = {error, error_msg};
cb(user_data, pending, "AvailableAccuracyLevel", proxy, &error_info, 0);
return;
}
if (!eldbus_message_arguments_get(msg, "v", &variant))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "AvailableAccuracyLevel", proxy, &error_info, 0);
return;
}
if (!eldbus_message_iter_arguments_get(variant, "u", &v))
{
Eldbus_Error_Info error_info = {"", ""};
cb(user_data, pending, "AvailableAccuracyLevel", proxy, &error_info, 0);
return;
}
cb(user_data, pending, "AvailableAccuracyLevel", proxy, NULL, v);
}
Eldbus_Pending *
geo_clue2_manager_available_accuracy_level_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Uint32_Get_Cb cb, const void *data)
{
Eldbus_Pending *p;
EINA_SAFETY_ON_NULL_RETURN_VAL(proxy, NULL);
p = eldbus_proxy_property_get(proxy, "AvailableAccuracyLevel", cb_geo_clue2_manager_available_accuracy_level, cb);
if (data)
eldbus_pending_data_set(p, "__user_data", data);
eldbus_pending_data_set(p, "__proxy", proxy);
return p;
}
void
geo_clue2_manager_log_domain_set(int id)
{
_log_main = id;
}
void
geo_clue2_manager_proxy_unref(Eldbus_Proxy *proxy)
{
Eldbus_Object *obj = eldbus_proxy_object_get(proxy);
eldbus_proxy_unref(proxy);
eldbus_object_unref(obj);
}
Eldbus_Proxy *
geo_clue2_manager_proxy_get(Eldbus_Connection *conn, const char *bus, const char *path)
{
Eldbus_Object *obj;
Eldbus_Proxy *proxy;
EINA_SAFETY_ON_NULL_RETURN_VAL(conn, NULL);
EINA_SAFETY_ON_NULL_RETURN_VAL(bus, NULL);
if (!path) path = "/";
obj = eldbus_object_get(conn, bus, path);
proxy = eldbus_proxy_get(obj, "org.freedesktop.GeoClue2.Manager");
return proxy;
}

View File

@ -1,23 +0,0 @@
#ifndef ELDBUS_GEO_CLUE2_MANAGER_H
#define ELDBUS_GEO_CLUE2_MANAGER_H
#ifdef EFL_BETA_API_SUPPORT
#include <Eina.h>
#include <Ecore.h>
#include <Eldbus.h>
#include "eldbus_utils.h"
Eldbus_Proxy *geo_clue2_manager_proxy_get(Eldbus_Connection *conn, const char *bus, const char *path);
void geo_clue2_manager_proxy_unref(Eldbus_Proxy *proxy);
void geo_clue2_manager_log_domain_set(int id);
typedef void (*Geo_Clue2_Manager_Get_Client_Cb)(Eldbus_Proxy *proxy, void *data, Eldbus_Pending *pending, Eldbus_Error_Info *error, const char *client);
Eldbus_Pending *geo_clue2_manager_get_client_call(Eldbus_Proxy *proxy, Geo_Clue2_Manager_Get_Client_Cb cb, const void *data);
typedef void (*Geo_Clue2_Manager_Add_Agent_Cb)(Eldbus_Proxy *proxy, void *data, Eldbus_Pending *pending, Eldbus_Error_Info *error);
Eldbus_Pending *geo_clue2_manager_add_agent_call(Eldbus_Proxy *proxy, Geo_Clue2_Manager_Add_Agent_Cb cb, const void *data, const char *id);
Eldbus_Pending *geo_clue2_manager_in_use_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Bool_Get_Cb cb, const void *data);
Eldbus_Pending *geo_clue2_manager_available_accuracy_level_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Uint32_Get_Cb cb, const void *data);
#endif /* BETA API */
#endif

View File

@ -1,24 +0,0 @@
#ifndef ELDBUS_UTILS_H
#define ELDBUS_UTILS_H 1
typedef struct _Eldbus_Error_Info
{
const char *error;
const char *message;
} Eldbus_Error_Info;
typedef void (*Eldbus_Codegen_Property_Set_Cb)(void *data, const char *propname, Eldbus_Proxy *proxy, Eldbus_Pending *p, Eldbus_Error_Info *error_info);
typedef void (*Eldbus_Codegen_Property_String_Get_Cb)(void *data, Eldbus_Pending *p, const char *propname, Eldbus_Proxy *proxy, Eldbus_Error_Info *error_info, const char *value);
typedef void (*Eldbus_Codegen_Property_Int32_Get_Cb)(void *data, Eldbus_Pending *p, const char *propname, Eldbus_Proxy *proxy, Eldbus_Error_Info *error_info, int value);
typedef void (*Eldbus_Codegen_Property_Byte_Get_Cb)(void *data, Eldbus_Pending *p, const char *propname, Eldbus_Proxy *proxy, Eldbus_Error_Info *error_info, unsigned char value);
typedef void (*Eldbus_Codegen_Property_Bool_Get_Cb)(void *data, Eldbus_Pending *p, const char *propname, Eldbus_Proxy *proxy, Eldbus_Error_Info *error_info, Eina_Bool value);
typedef void (*Eldbus_Codegen_Property_Int16_Get_Cb)(void *data, Eldbus_Pending *p, const char *propname, Eldbus_Proxy *proxy, Eldbus_Error_Info *error_info, short int value);
typedef void (*Eldbus_Codegen_Property_Uint16_Get_Cb)(void *data, Eldbus_Pending *p, const char *propname, Eldbus_Proxy *proxy, Eldbus_Error_Info *error_info, unsigned short int value);
typedef void (*Eldbus_Codegen_Property_Uint32_Get_Cb)(void *data, Eldbus_Pending *p, const char *propname, Eldbus_Proxy *proxy, Eldbus_Error_Info *error_info, unsigned int value);
typedef void (*Eldbus_Codegen_Property_Double_Get_Cb)(void *data, Eldbus_Pending *p, const char *propname, Eldbus_Proxy *proxy, Eldbus_Error_Info *error_info, double value);
typedef void (*Eldbus_Codegen_Property_Int64_Get_Cb)(void *data, Eldbus_Pending *p, const char *propname, Eldbus_Proxy *proxy, Eldbus_Error_Info *error_info, int64_t value);
typedef void (*Eldbus_Codegen_Property_Uint64_Get_Cb)(void *data, Eldbus_Pending *p, const char *propname, Eldbus_Proxy *proxy, Eldbus_Error_Info *error_info, uint64_t value);
typedef void (*Eldbus_Codegen_Property_Complex_Get_Cb)(void *data, Eldbus_Pending *p, const char *propname, Eldbus_Proxy *proxy, Eldbus_Error_Info *error_info, Eina_Value *value);
#endif

View File

@ -1,5 +0,0 @@
elocation_src += files([
'eldbus_geo_clue2_client.c',
'eldbus_geo_clue2_location.c',
'eldbus_geo_clue2_manager.c'])

View File

@ -1,199 +0,0 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<!--
GeoClue 2.0 Interface Specification
Copyright (C) 2013 Red Hat, Inc.
-->
<node>
<!--
org.freedesktop.GeoClue2.Manager:
@short_description: The GeoClue service manager
This is the interface you use to talk to main GeoClue2 manager object at
path "/org/freedesktop/GeoClue2/Manager". The only thing you do with this
interface is to call org.freedesktop.GeoClue2.Manager.GetClient() on it
to get your application specific client object.
-->
<interface name="org.freedesktop.GeoClue2.Manager">
<!--
InUse:
Whether service is currently is use by any application.
-->
<property name="InUse" type="b" access="read"/>
<!--
AvailableAccuracyLevel:
The level of available accuracy, as
<link linkend="GClueAccuracyLevel">GClueAccuracyLevel</link>.
-->
<property name="AvailableAccuracyLevel" type="u" access="read"/>
<!--
GetClient:
@client: The path for newly created client object
Retrieves a client object which can only be used by the calling
application only.
-->
<method name="GetClient">
<arg name="client" type="o" direction="out"/>
</method>
<!--
AddAgent:
@id: The Desktop ID (excluding .desktop) of the agent
An API for user authorization agents to register themselves. Each agent
is responsible for the user it is running as. Application developers
can and should simply ignore this API.
-->
<method name="AddAgent">
<arg name="id" type="s" direction="in"/>
</method>
</interface>
<!--
org.freedesktop.GeoClue2.Client:
@short_description: The Application-specific client API
This is the interface you use to retrieve location information and receive
location update signals from GeoClue service. You get the client object to
use this interface on from org.freedesktop.GeoClue2.Manager.GetClient()
method.
-->
<interface name="org.freedesktop.GeoClue2.Client">
<!--
Location:
Current location as path to a #org.freedesktop.GeoClue2.Location object.
-->
<property name="Location" type="o" access="read"/>
<!--
DistanceThreshold:
Contains the current distance threshold in meters. This value is used
by the service when it gets new location info. If the distance moved is
below the threshold, it won't emit the LocationUpdated signal.
-->
<property name="DistanceThreshold" type="u" access="readwrite"/>
<!--
DesktopId:
The desktop file id (the basename of the desktop file). This property
must be set by applications for authorization to work.
-->
<property name="DesktopId" type="s" access="readwrite"/>
<!--
RequestedAccuracyLevel:
The level of accuracy requested by client, as
<link linkend="GClueAccuracyLevel">GClueAccuracyLevel</link>.
Please keep in mind that the actual accuracy of location information is
dependent on available hardware on your machine, external resources
and/or how much accuracy user agrees to be confortable with.
-->
<property name="RequestedAccuracyLevel" type="u" access="readwrite"/>
<!--
Active:
If client is active, i-e started successfully using
org.freedesktop.GeoClue2.Client.Start() and receiving location updates.
Please keep in mind that geoclue can at any time stop and start the
client on user (agent) request. Applications that are interested in
in these changes, should watch for changes in this property.
-->
<property name="Active" type="b" access="read"/>
<!--
Start:
Start receiving events about the current location. Applications should
hook-up to #org.freedesktop.GeoClue2.Client::LocationUpdated signal
before calling this method.
-->
<method name="Start"/>
<!--
Stop:
Stop receiving events about the current location.
-->
<method name="Stop"/>
<!--
LocationUpdated:
@old: old location as path to a #org.freedesktop.GeoClue2.Location object
@new: new location as path to a #org.freedesktop.GeoClue2.Location object
The signal is emitted every time the location changes.
The client should set the DistanceThreshold property to control how
often this signal is emitted.
-->
<signal name="LocationUpdated">
<arg name="old" type="o"/>
<arg name="new" type="o"/>
</signal>
</interface>
<!--
org.freedesktop.GeoClue2.Location:
@short_description: The Location interface
This is the interface you use on location objects.
-->
<interface name="org.freedesktop.GeoClue2.Location">
<!--
Latitude:
The latitude of the location, in degrees.
-->
<property name="Latitude" type="d" access="read"/>
<!--
Longitude:
The longitude of the location, in degrees.
-->
<property name="Longitude" type="d" access="read"/>
<!--
Accuracy:
The accuracy of the location fix, in meters.
-->
<property name="Accuracy" type="d" access="read"/>
<!--
Altitude:
The altitude of the location fix, in meters. When unknown, its set to
minimum double value, -1.7976931348623157e+308.
-->
<property name="Altitude" type="d" access="read"/>
<!--
Description:
A human-readable description of the location, if available.
WARNING: Applications should not rely on this property since not all
sources provide a description. If you really need a description (or
more details) about current location, use a reverse-geocoding API, e.g
geocode-glib.
-->
<property name="Description" type="s" access="read"/>
</interface>
</node>

View File

@ -1,28 +0,0 @@
elocation_deps = [eina, eo, efl, ecore, eldbus]
elocation_pub_deps = [ecore, eldbus]
elocation_src = files(['elocation.c'])
subdir('gen')
elocation_header_src = ['Elocation.h']
elocation_lib = library('elocation',
elocation_src,
dependencies: [m] + elocation_deps + elocation_pub_deps,
include_directories : config_dir + [include_directories(join_paths('..','..'))],
install: true,
c_args : package_c_args,
version : meson.project_version()
)
elocation = declare_dependency(
include_directories: [include_directories('.')],
link_with: elocation_lib,
dependencies: elocation_pub_deps,
)
install_headers(elocation_header_src,
install_dir : dir_package_include,
)

View File

@ -1,235 +0,0 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif /* ifdef HAVE_CONFIG_H */
#include <stdlib.h>
#include <stdio.h>
#include <check.h>
#include <Elocation.h>
/* Test the init and shutdown pathes only. Good to do that as we don't set up
* other things and already triggered problems with this.
*/
EFL_START_TEST(elocation_test_init)
{
Eina_Bool ret;
ret = elocation_init();
fail_if(ret != EINA_TRUE);
elocation_shutdown();
}
EFL_END_TEST
/* Basic address object testing. Creating and freeing the object */
EFL_START_TEST(elocation_test_address_object)
{
Eina_Bool ret;
Elocation_Address *address = NULL;
ret = elocation_init();
fail_if(ret != EINA_TRUE);
address = elocation_address_new();
fail_if(address == NULL);
elocation_address_free(address);
elocation_shutdown();
}
EFL_END_TEST
/* Basic position object testing. Creating and freeing the object */
EFL_START_TEST(elocation_test_position_object)
{
Eina_Bool ret;
Elocation_Position *position = NULL;
ret = elocation_init();
fail_if(ret != EINA_TRUE);
position = elocation_position_new();
fail_if(position == NULL);
elocation_position_free(position);
elocation_shutdown();
}
EFL_END_TEST
/* Basic testing for the various functions of the GeoCode API */
static int cb_count = 0;
static Eina_Bool
event_cb(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event)
{
fail_if(event == NULL);
/* We expect 3 callbacks right now */
if (++cb_count == 3)
ecore_main_loop_quit();
return ECORE_CALLBACK_DONE;
}
EFL_START_TEST(elocation_test_api_geocode)
{
Eina_Bool ret;
Elocation_Position *position = NULL;
Elocation_Address *address = NULL;
Ecore_Event_Handler *handler;
ret = elocation_init();
fail_if(ret != EINA_TRUE);
handler = ecore_event_handler_add(ELOCATION_EVENT_GEOCODE, event_cb, NULL);
fail_if(handler == NULL);
handler = ecore_event_handler_add(ELOCATION_EVENT_REVERSEGEOCODE, event_cb, NULL);
fail_if(handler == NULL);
position = elocation_position_new();
fail_if(position == NULL);
address = elocation_address_new();
fail_if(address == NULL);
ret = elocation_freeform_address_to_position("London", position);
fail_if(ret != EINA_TRUE);
position->latitude = 51.7522;
position->longitude = -1.25596;
position->accur->level = 3;
ret = elocation_position_to_address(position, address);
fail_if(ret != EINA_TRUE);
address->locality = strdup("Cambridge");
address->countrycode = strdup("UK");
ret = elocation_address_to_position(address, position);
fail_if(ret != EINA_TRUE);
ecore_main_loop_begin();
elocation_position_free(position);
elocation_address_free(address);
elocation_shutdown();
}
EFL_END_TEST
/* Basic testing for position API */
EFL_START_TEST(elocation_test_api_position)
{
Eina_Bool ret;
Elocation_Position *position = NULL;
ret = elocation_init();
fail_if(ret != EINA_TRUE);
position = elocation_position_new();
fail_if(position == NULL);
ret = elocation_position_get(position);
fail_if(ret != EINA_TRUE);
elocation_position_free(position);
elocation_shutdown();
}
EFL_END_TEST
/* Basic testing for address API */
EFL_START_TEST(elocation_test_api_address)
{
Eina_Bool ret;
Elocation_Address *address = NULL;
ret = elocation_init();
fail_if(ret != EINA_TRUE);
address = elocation_address_new();
fail_if(address == NULL);
ret = elocation_address_get(address);
fail_if(ret != EINA_TRUE);
elocation_address_free(address);
elocation_shutdown();
}
EFL_END_TEST
/* Basic testing for status API */
EFL_START_TEST(elocation_test_api_status)
{
Eina_Bool ret;
int status = 0;
ret = elocation_init();
fail_if(ret != EINA_TRUE);
ret = elocation_status_get(&status);
fail_if(ret != EINA_TRUE);
elocation_shutdown();
}
EFL_END_TEST
Suite *
elocation_suite(void)
{
Suite *s;
TCase *tc;
s = suite_create("Elocation");
tc = tcase_create("Elocation_Init");
tcase_add_test(tc, elocation_test_init);
suite_add_tcase(s, tc);
tc = tcase_create("Elocation_Objects");
tcase_add_test(tc, elocation_test_address_object);
tcase_add_test(tc, elocation_test_position_object);
suite_add_tcase(s, tc);
tc = tcase_create("Elocation_API_Geocode");
tcase_add_test(tc, elocation_test_api_geocode);
suite_add_tcase(s, tc);
tc = tcase_create("Elocation_API_Position");
tcase_add_test(tc, elocation_test_api_position);
suite_add_tcase(s, tc);
tc = tcase_create("Elocation_API_Address");
tcase_add_test(tc, elocation_test_api_address);
suite_add_tcase(s, tc);
/*
tc = tcase_create("Elocation_API_Status");
tcase_add_test(tc, elocation_test_api_status);
suite_add_tcase(s, tc);
*/
return s;
}
int
main(void)
{
Suite *s;
SRunner *sr;
int failed_count;
#ifdef NEED_RUN_IN_TREE
putenv("EFL_RUN_IN_TREE=1");
#endif
s = elocation_suite();
sr = srunner_create(s);
srunner_set_xml(sr, TESTS_BUILD_DIR "/check-results.xml");
srunner_run_all(sr, CK_ENV);
failed_count = srunner_ntests_failed(sr);
srunner_free(sr);
return (failed_count == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}