diff --git a/doc/elementary_examples.dox b/doc/elementary_examples.dox index dc7acbab47..76aa37e953 100644 --- a/doc/elementary_examples.dox +++ b/doc/elementary_examples.dox @@ -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 */ diff --git a/doc/elementary_examples_cxx.dox b/doc/elementary_examples_cxx.dox index 6197450ac1..b0e083f331 100644 --- a/doc/elementary_examples_cxx.dox +++ b/doc/elementary_examples_cxx.dox @@ -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 diff --git a/doc/main.dox b/doc/main.dox index a0e32886e4..46f3c4edca 100644 --- a/doc/main.dox +++ b/doc/main.dox @@ -43,7 +43,6 @@ *

Early stage libraries (BETA testing)

* * @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 module listing. diff --git a/meson.build b/meson.build index 8cffb359d8..222a79bcff 100644 --- a/meson.build +++ b/meson.build @@ -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'], []], diff --git a/src/examples/elementary/location_example_01.c b/src/examples/elementary/location_example_01.c deleted file mode 100644 index 7b8ad6f897..0000000000 --- a/src/examples/elementary/location_example_01.c +++ /dev/null @@ -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 -#ifdef ELM_ELOCATION -#include -#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), - "### Position Detail ###
" - "GeoClue position reply with data from timestamp %i
" - "Latitude: %f
" - "Longitude: %f
" - "Altitude: %f
" - "Accuracy level: %i
" - "Accuracy horizontal: %f
" - "Accuracy vertical: %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), - "### Address Detail ###
" - "Address update with data from timestamp: %i
" - "Country: %s
" - "Countrycode: %s
" - "Locality: %s
" - "Postalcode: %s
" - "Region: %s
" - "Timezone: %s
" - "Accuracy level: %i
" - "Accuracy horizontal: %f
" - "Accuracy vertical: %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() diff --git a/src/examples/elementary/meson.build b/src/examples/elementary/meson.build index 380d3ef446..e88ddfe567 100644 --- a/src/examples/elementary/meson.build +++ b/src/examples/elementary/meson.build @@ -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', diff --git a/src/examples/elocation/.gitignore b/src/examples/elocation/.gitignore deleted file mode 100644 index 5945c2ea49..0000000000 --- a/src/examples/elocation/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/elocation diff --git a/src/examples/elocation/elocation.c b/src/examples/elocation/elocation.c deleted file mode 100644 index b9c8b99d87..0000000000 --- a/src/examples/elocation/elocation.c +++ /dev/null @@ -1,167 +0,0 @@ -#include - -#define EFL_BETA_API_SUPPORT - -#include -#include - -/* 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; -} diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h index cf5875255a..a3fa4f4412 100644 --- a/src/lib/elementary/Elementary.h +++ b/src/lib/elementary/Elementary.h @@ -73,10 +73,6 @@ #include #include -#ifdef ELM_ELOCATION -#include -#endif - #ifdef ELM_EMAP #include #endif diff --git a/src/lib/elementary/Elementary_Options.h.in b/src/lib/elementary/Elementary_Options.h.in index a52444dddc..2110b58385 100644 --- a/src/lib/elementary/Elementary_Options.h.in +++ b/src/lib/elementary/Elementary_Options.h.in @@ -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 diff --git a/src/lib/elementary/elm_deprecated.h b/src/lib/elementary/elm_deprecated.h index ee449cc00c..2bb7294f72 100644 --- a/src/lib/elementary/elm_deprecated.h +++ b/src/lib/elementary/elm_deprecated.h @@ -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); diff --git a/src/lib/elementary/elm_main.c b/src/lib/elementary/elm_main.c index 069d1ceb11..d6c2b2a82f 100644 --- a/src/lib/elementary/elm_main.c +++ b/src/lib/elementary/elm_main.c @@ -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(); diff --git a/src/lib/elementary/elm_need.h b/src/lib/elementary/elm_need.h index ad290dbf04..5e873da117 100644 --- a/src/lib/elementary/elm_need.h +++ b/src/lib/elementary/elm_need.h @@ -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 * diff --git a/src/lib/elementary/meson.build b/src/lib/elementary/meson.build index cd88ccebf4..0e8ebc3e3e 100644 --- a/src/lib/elementary/meson.build +++ b/src/lib/elementary/meson.build @@ -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') diff --git a/src/lib/elocation/Elocation.h b/src/lib/elocation/Elocation.h deleted file mode 100644 index 6ebec636fa..0000000000 --- a/src/lib/elocation/Elocation.h +++ /dev/null @@ -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 - -#include -#include - -#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 diff --git a/src/lib/elocation/elocation.c b/src/lib/elocation/elocation.c deleted file mode 100644 index 33c77d2e89..0000000000 --- a/src/lib/elocation/elocation.c +++ /dev/null @@ -1,1414 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include -#include -#include -#include -#include - -/* FIXME: These globals really need to get reduced before leaving the PROTO - * area. - */ -static char *unique_name = NULL; -static Eldbus_Connection *conn = NULL; -static Elocation_Provider *address_provider = NULL; -static Elocation_Provider *position_provider = NULL; -static Eldbus_Object *obj_meta = NULL; -static Eldbus_Proxy *manager_master = NULL; -static Eldbus_Proxy *meta_geoclue = NULL; -static Eldbus_Proxy *meta_address = NULL; -static Eldbus_Proxy *meta_position = NULL; -static Eldbus_Proxy *meta_masterclient = NULL; -static Eldbus_Proxy *meta_velocity = NULL; -static Eldbus_Proxy *meta_nmea = NULL; -static Eldbus_Proxy *meta_satellite = NULL; -static Eldbus_Proxy *geonames_geocode = NULL; -static Eldbus_Proxy *geonames_rgeocode = NULL; -static Eldbus_Proxy *master_poi = NULL; -static Elocation_Address *address = NULL; -static Elocation_Position *position = NULL; -static Elocation_Address *addr_geocode = NULL; -static Elocation_Position *pos_geocode = NULL; -static Elocation_Velocity *velocity = NULL; -static int status = -1; /* 0 is a valid status code */ -static char nmea_sentence[256]; - -int _elocation_log_dom = -1; - -/* Elocation ecore event types we provide to the application. */ -EAPI int ELOCATION_EVENT_STATUS = 0; -EAPI int ELOCATION_EVENT_POSITION = 0; -EAPI int ELOCATION_EVENT_ADDRESS = 0; -EAPI int ELOCATION_EVENT_VELOCITY = 0; -EAPI int ELOCATION_EVENT_GEOCODE = 0; -EAPI int ELOCATION_EVENT_REVERSEGEOCODE = 0; -EAPI int ELOCATION_EVENT_NMEA = 0; -EAPI int ELOCATION_EVENT_SATELLITE = 0; -EAPI int ELOCATION_EVENT_POI = 0; -EAPI int ELOCATION_EVENT_META_READY = 0; - -/* Internal events */ -int ELOCATION_EVENT_IN = 0; -int ELOCATION_EVENT_OUT = 0; - -static void -_dummy_free(void *user_data EINA_UNUSED, void *func_data EINA_UNUSED) -{ - /* Don't free the event data after dispatching the event. We keep track of - * it on our own - */ -} - -/* Generic provider message unmarshaller. Used from all different provider - * calbacks that receive such a message - */ -static Eina_Bool -unmarshall_provider(const Eldbus_Message *reply, Elocation_Provider *provider) -{ - char *name = NULL, *desc = NULL, *service = NULL, *path = NULL; - - if (!eldbus_message_arguments_get(reply, "ssss", &name, &desc, &service, &path)) - return EINA_FALSE; - - provider->name = strdup(name); - provider->description = strdup(desc); - provider->service = strdup(service); - provider->path = strdup(path); - return EINA_TRUE; -} - -static void -meta_address_provider_info_cb(void *data, const Eldbus_Message *reply, Eldbus_Pending *pending EINA_UNUSED) -{ - const char *err, *errmsg; - Elocation_Provider *addr_provider; - - addr_provider = data; - - if (eldbus_message_error_get(reply, &err, &errmsg)) - { - ERR("Error: %s %s", err, errmsg); - return; - } - - if (!unmarshall_provider(reply, addr_provider)) - { - ERR("Error: Unable to unmarshall address provider"); - return; - } - - DBG("Meta address provider name: %s, %s, %s, %s", addr_provider->name, - addr_provider->description, - addr_provider->service, - addr_provider->path); -} - -static void -meta_position_provider_info_cb(void *data, const Eldbus_Message *reply, Eldbus_Pending *pending EINA_UNUSED) -{ - const char *err, *errmsg; - Elocation_Provider *pos_provider; - - pos_provider = data; - - if (eldbus_message_error_get(reply, &err, &errmsg)) - { - ERR("Error: %s %s", err, errmsg); - return; - } - - if (!unmarshall_provider(reply, pos_provider)) - { - ERR("Error: Unable to unmarshall position provider"); - return; - } - - DBG("Meta position provider name: %s, %s, %s, %s", pos_provider->name, - pos_provider->description, - pos_provider->service, - pos_provider->path); -} - -static void -meta_address_provider_info_signal_cb(void *data, const Eldbus_Message *reply) -{ - Elocation_Provider *addr_provider; - addr_provider = data; - - if (!unmarshall_provider(reply, addr_provider)) - { - ERR("Error: Unable to unmarshall address provider"); - return; - } - - DBG("Meta address provider name changed: %s, %s, %s, %s", addr_provider->name, - addr_provider->description, - addr_provider->service, - addr_provider->path); -} - -static void -meta_position_provider_info_signal_cb(void *data, const Eldbus_Message *reply) -{ - Elocation_Provider *pos_provider; - pos_provider = data; - - if (!unmarshall_provider(reply, pos_provider)) - { - ERR("Error: Unable to unmarshall position provider"); - return; - } - - DBG("Meta position provider name changed: %s, %s, %s, %s", pos_provider->name, - pos_provider->description, - pos_provider->service, - pos_provider->path); -} - -/* A address is quite flexible what kind of key value pairs it contains in the - * dict. Similar to a reverse GeoCode message as both return an address object. - */ -static Eina_Bool -unmarshall_address(const Eldbus_Message *reply, Elocation_Address *addr) -{ - int32_t level, timestamp; - Eldbus_Message_Iter *sub, *dict, *entry; - double horizontal; - double vertical; - const char *key, *signature; - char *value; - - signature = eldbus_message_signature_get(reply); - - if (!strcmp(signature, "ia{ss}(idd)")) - { - if (!eldbus_message_arguments_get(reply, "ia{ss}(idd)", ×tamp, &dict, &sub)) - return EINA_FALSE; - addr->timestamp = timestamp; - } - else if (!strcmp(signature, "a{ss}(idd)")) - { - if (!eldbus_message_arguments_get(reply, "a{ss}(idd)", &dict, &sub)) - return EINA_FALSE; - addr->timestamp = 0; - } - else - return EINA_FALSE; - - - /* Cleanup potential old entries before re-using */ - addr->country = NULL; - addr->countrycode = NULL; - addr->locality = NULL; - addr->postalcode = NULL; - addr->region = NULL; - addr->timezone = NULL; - - while (eldbus_message_iter_get_and_next(dict, 'e', &entry)) - { - if (!eldbus_message_iter_arguments_get(entry, "ss", &key, &value)) - continue; - - if (!strcmp(key, "country")) - { - free(addr->country); - addr->country = strdup(value); - } - else if (!strcmp(key, "countrycode")) - { - free(addr->countrycode); - addr->countrycode = strdup(value); - } - else if (!strcmp(key, "locality")) - { - free(addr->locality); - addr->locality = strdup(value); - } - else if (!strcmp(key, "postalcode")) - { - free(addr->postalcode); - addr->postalcode = strdup(value); - } - else if (!strcmp(key, "region")) - { - free(addr->region); - addr->region = strdup(value); - } - else if (!strcmp(key, "timezone")) - { - free(addr->timezone); - addr->timezone = strdup(value); - } - } - - if (!eldbus_message_iter_arguments_get(sub, "idd", &level, &horizontal, &vertical)) - return EINA_FALSE; - - addr->accur->level = level; - addr->accur->horizontal = horizontal; - addr->accur->vertical = vertical; - return EINA_TRUE; -} - -/* Receive and unmarshall a reverse GeoCode message. The dict can contain a - * variable set of key value pairs so we need to handle this with care - */ -static void -rgeocode_cb(void *data EINA_UNUSED, const Eldbus_Message *reply, Eldbus_Pending *pending EINA_UNUSED) -{ - const char *err, *errmsg; - - if (eldbus_message_error_get(reply, &err, &errmsg)) - { - ERR("Error: %s %s", err, errmsg); - return; - } - - if (!unmarshall_address(reply, addr_geocode)) - { - ERR("Error: Unable to unmarshall address"); - return; - } - - /* Send out an event to all interested parties that we have an update */ - ecore_event_add(ELOCATION_EVENT_REVERSEGEOCODE, addr_geocode, _dummy_free, NULL); -} - -/* Point of Interest (POI) aka landmark message unmarshalling. Thsi interface is - * not in standard GeoClue but currently a Tizen extension. - */ -static void -poi_cb(void *data EINA_UNUSED, const Eldbus_Message *reply, Eldbus_Pending *pending EINA_UNUSED) -{ - int32_t count, id, rank; - double lat, lon, bound_left, bound_top, bound_right, bound_bottom; - const char *name, *icon, *house, *road, *village, *suburb, *postcode; - const char *city, *county, *country, *country_code; - Eldbus_Message_Iter *array, *struct_landmark; - const char *err, *errmsg; - - if (eldbus_message_error_get(reply, &err, &errmsg)) - { - ERR("Error: %s %s", err, errmsg); - return; - } - - /* Yeah, its quite a horrible message. The POI interface could use a better design */ - if (!eldbus_message_arguments_get(reply, "ia(iiddddddsssssssssss", &count ,&array)) - return; - - /* TODO re-check that the parameter ordering is what we expect */ - while (eldbus_message_iter_get_and_next(array, 'r', &struct_landmark)) - { - if (!eldbus_message_iter_arguments_get(struct_landmark, "iiddddddsssssssssss", &id, &rank, - &lat, &lon, &bound_left, &bound_top, &bound_right, - &bound_bottom, &name, &icon, &house, &road, - &village, &suburb, &postcode, &city, &county, - &country, &country_code)) - return; - - DBG("Landmark received: %i, %i, %f, %f, %f, %f, %f, %f, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,", - id, rank, lat, lon, bound_left, bound_top, bound_right, - bound_bottom, name, icon, house, road, village, - suburb, postcode, city, county, country, country_code); - } - - /* Send out an event to all interested parties that we have an update */ - ecore_event_add(ELOCATION_EVENT_POI, NULL, _dummy_free, NULL); -} - -/* Unmarshall a GeoCode message */ -static void -geocode_cb(void *data EINA_UNUSED, const Eldbus_Message *reply, Eldbus_Pending *pending EINA_UNUSED) -{ - GeocluePositionFields fields; - int32_t level; - double horizontal = 0.0; - double vertical = 0.0; - double latitude = 0.0; - double longitude = 0.0; - double altitude = 0.0; - Eldbus_Message_Iter *sub; - const char *err, *errmsg; - - if (eldbus_message_error_get(reply, &err, &errmsg)) - { - ERR("Error: %s %s", err, errmsg); - return; - } - - if (!eldbus_message_arguments_get(reply, "iddd(idd)", &fields,&latitude, - &longitude, &altitude, &sub)) - return; - - /* GeoClue uses some flags to mark position fields as valid. We set invalid - * fields to 0.0 */ - if (fields & GEOCLUE_POSITION_FIELDS_LATITUDE) - pos_geocode->latitude = latitude; - else - pos_geocode->latitude = 0.0; - - if (fields & GEOCLUE_POSITION_FIELDS_LONGITUDE) - pos_geocode->longitude = longitude; - else - pos_geocode->longitude = 0.0; - - if (fields & GEOCLUE_POSITION_FIELDS_ALTITUDE) - pos_geocode->altitude = altitude; - else - pos_geocode->altitude = 0.0; - - if (!eldbus_message_iter_arguments_get(sub, "idd", &level, &horizontal, &vertical)) - return; - - pos_geocode->accur->level = level; - pos_geocode->accur->horizontal = horizontal; - pos_geocode->accur->vertical = vertical; - /* Send out an event to all interested parties that we have an update */ - ecore_event_add(ELOCATION_EVENT_GEOCODE, pos_geocode, _dummy_free, NULL); -} - -static void -address_cb(void *data EINA_UNUSED, const Eldbus_Message *reply, Eldbus_Pending *pending EINA_UNUSED) -{ - const char *err, *errmsg; - - if (eldbus_message_error_get(reply, &err, &errmsg)) - { - ERR("Error: %s %s", err, errmsg); - return; - } - - if (!unmarshall_address(reply, address)) - { - ERR("Error: Unable to unmarshall address"); - return; - } - - /* Send out an event to all interested parties that we have an update */ - ecore_event_add(ELOCATION_EVENT_ADDRESS, address, _dummy_free, NULL); -} - -static void -address_signal_cb(void *data EINA_UNUSED, const Eldbus_Message *reply) -{ - const char *err, *errmsg; - - if (eldbus_message_error_get(reply, &err, &errmsg)) - { - ERR("Error: %s %s", err, errmsg); - return; - } - - if (!unmarshall_address(reply, address)) - { - ERR("Error: Unable to unmarshall address"); - return; - } - - /* Send out an event to all interested parties that we have an update */ - ecore_event_add(ELOCATION_EVENT_ADDRESS, address, _dummy_free, NULL); -} - -/* Unmarshall a velocity message. This is only available if we use a GPS - * provider from GeoClue. None of the other providers offer this currently. - */ -static Eina_Bool -unmarshall_velocity(const Eldbus_Message *reply) -{ - GeoclueVelocityFields fields; - int32_t timestamp = 0; - double speed = 0.0; - double direction = 0.0; - double climb = 0.0; - - if (!eldbus_message_arguments_get(reply, "iiddd", &fields, ×tamp, - &speed, &direction, &climb)) - return EINA_FALSE; - - velocity->timestamp = timestamp; - - /* GeoClue uses some flags to mark velocity fields as valid. We set invalid - * fields to 0.0 */ - if (fields & GEOCLUE_VELOCITY_FIELDS_SPEED) - velocity->speed = speed; - else - velocity->speed = 0.0; - - if (fields & GEOCLUE_VELOCITY_FIELDS_DIRECTION) - velocity->direction = direction; - else - velocity->direction = 0.0; - - if (fields & GEOCLUE_VELOCITY_FIELDS_CLIMB) - velocity->climb = climb; - else - velocity->climb = 0.0; - - return EINA_TRUE; -} - -static void -velocity_cb(void *data EINA_UNUSED, const Eldbus_Message *reply, Eldbus_Pending *pending EINA_UNUSED) -{ - const char *err, *errmsg; - - if (eldbus_message_error_get(reply, &err, &errmsg)) - { - WARN("Warning: %s %s", err, errmsg); - return; - } - - if (!unmarshall_velocity(reply)) - { - ERR("Error: Unable to unmarshall velocity"); - return; - } - - /* Send out an event to all interested parties that we have an update */ - ecore_event_add(ELOCATION_EVENT_VELOCITY, velocity, _dummy_free, NULL); -} - -static void -velocity_signal_cb(void *data EINA_UNUSED, const Eldbus_Message *reply) -{ - if (!unmarshall_velocity(reply)) - { - ERR("Error: Unable to unmarshall velocity"); - return; - } - - /* Send out an event to all interested parties that we have an update */ - ecore_event_add(ELOCATION_EVENT_VELOCITY, velocity, _dummy_free, NULL); -} - -/* Unmarshall an raw NMEA message. It conatins a raw NMEA sentence which we can - * pass on to applications that want to use their own NMEA parser. This is not - * reommended. Better use the other interfaces to access the needed data. - * - * This is currently a Tizen only interface and not in GeoClue upstream. - */ -static Eina_Bool -unmarshall_nmea(const Eldbus_Message *reply) -{ - int32_t timestamp = 0; - - if (!eldbus_message_arguments_get(reply, "is", ×tamp, &nmea_sentence)) - return EINA_FALSE; - - return EINA_TRUE; -} - -static void -nmea_cb(void *data EINA_UNUSED, const Eldbus_Message *reply, Eldbus_Pending *pending EINA_UNUSED) -{ - const char *err, *errmsg; - - if (eldbus_message_error_get(reply, &err, &errmsg)) - { - WARN("Warning: %s %s", err, errmsg); - return; - } - - if (!unmarshall_nmea(reply)) - { - ERR("Error: Unable to unmarshall nmea"); - return; - } - - /* Send out an event to all interested parties that we have an update */ - ecore_event_add(ELOCATION_EVENT_NMEA, nmea_sentence, _dummy_free, NULL); -} - -static void -nmea_signal_cb(void *data EINA_UNUSED, const Eldbus_Message *reply) -{ - if (!unmarshall_nmea(reply)) - { - ERR("Error: Unable to unmarshall nmea"); - return; - } - - ecore_event_add(ELOCATION_EVENT_NMEA, nmea_sentence, _dummy_free, NULL); -} - -/* Unmarshall a satellite information message. This offers GPS specific - * information about the used satellites and its properties. It can be used for - * applications that rely on GPS and want to show more information like a 3D fix - * or used satellites. - * - * This is currently a Tizen only interface and not available in GeoClue upstream. - */ -static Eina_Bool -unmarshall_satellite(const Eldbus_Message *reply) -{ - int32_t timestamp = 0, satellite_used = 0, satellite_visible = 0; - int32_t snr = 0, elevation = 0, azimuth = 0, prn = 0, used_prn = 0; - Eldbus_Message_Iter *sub_prn, *sub_info, *struct_info; - - if (!eldbus_message_arguments_get(reply, "iiiaia(iiii)", ×tamp, &satellite_used, - &satellite_visible, &sub_prn, &sub_info)) - return EINA_FALSE; - - while (eldbus_message_iter_get_and_next(sub_prn, 'i', &used_prn)) - { - DBG("Satellite used PRN %i", used_prn); - } - - /* TODO re-check that the parameter ordering is what we expect */ - while (eldbus_message_iter_get_and_next(sub_info, 'r', &struct_info)) - { - if (!eldbus_message_iter_arguments_get(struct_info, "iiii", &prn, &elevation, &azimuth, &snr)) - return EINA_FALSE; - - DBG("Satellite info %i, %i, %i, %i", prn, elevation, azimuth, snr); - } - - return EINA_TRUE; -} - -static void -satellite_cb(void *data EINA_UNUSED, const Eldbus_Message *reply, Eldbus_Pending *pending EINA_UNUSED) -{ - const char *err, *errmsg; - - if (eldbus_message_error_get(reply, &err, &errmsg)) - { - WARN("Warning: %s %s", err, errmsg); - return; - } - - if (!unmarshall_satellite(reply)) - { - ERR("Error: Unable to unmarshall satellite"); - return; - } - - /* Send out an event to all interested parties that we have an update */ - ecore_event_add(ELOCATION_EVENT_SATELLITE, NULL, _dummy_free, NULL); -} - -static void -last_satellite_cb(void *data EINA_UNUSED, const Eldbus_Message *reply, Eldbus_Pending *pending EINA_UNUSED) -{ - const char *err, *errmsg; - - if (eldbus_message_error_get(reply, &err, &errmsg)) - { - WARN("Warning: %s %s", err, errmsg); - return; - } - - if (!unmarshall_satellite(reply)) - { - ERR("Error: Unable to unmarshall last satellite"); - return; - } - - /* Send out an event to all interested parties that we have an update */ - ecore_event_add(ELOCATION_EVENT_SATELLITE, NULL, _dummy_free, NULL); -} - -static void -satellite_signal_cb(void *data EINA_UNUSED, const Eldbus_Message *reply) -{ - if (!unmarshall_satellite(reply)) - { - ERR("Error: Unable to unmarshall satellite"); - return; - } - - /* Send out an event to all interested parties that we have an update */ - ecore_event_add(ELOCATION_EVENT_SATELLITE, NULL, _dummy_free, NULL); -} - -/* Unmarshall position coordination message */ -static Eina_Bool -unmarshall_position(const Eldbus_Message *reply) -{ - GeocluePositionFields fields; - int32_t level, timestamp; - double horizontal = 0.0; - double vertical = 0.0; - double latitude = 0.0; - double longitude = 0.0; - double altitude = 0.0; - Eldbus_Message_Iter *sub; - - if (!eldbus_message_arguments_get(reply, "iiddd(idd)", &fields, ×tamp, - &latitude, &longitude, &altitude, &sub)) - return EINA_FALSE; - - if (!eldbus_message_iter_arguments_get(sub, "idd", &level, &horizontal, &vertical)) - return EINA_FALSE; - - position->timestamp = timestamp; - - /* GeoClue uses some flags to mark position fields as valid. We set invalid - * fields to 0.0 */ - if (fields & GEOCLUE_POSITION_FIELDS_LATITUDE) - position->latitude = latitude; - else - position->latitude = 0.0; - - if (fields & GEOCLUE_POSITION_FIELDS_LONGITUDE) - position->longitude = longitude; - else - position->longitude = 0.0; - - if (fields & GEOCLUE_POSITION_FIELDS_ALTITUDE) - position->altitude = altitude; - else - position->altitude = 0.0; - - position->accur->level = level; - position->accur->horizontal = horizontal; - position->accur->vertical = vertical; - - return EINA_TRUE; -} - -static void -position_cb(void *data EINA_UNUSED, const Eldbus_Message *reply, Eldbus_Pending *pending EINA_UNUSED) -{ - const char *err, *errmsg; - - if (eldbus_message_error_get(reply, &err, &errmsg)) - { - ERR("Error: %s %s", err, errmsg); - return; - } - - if (!unmarshall_position(reply)) - { - ERR("Error: Unable to unmarshall position"); - return; - } - - /* Send out an event to all interested parties that we have an update */ - ecore_event_add(ELOCATION_EVENT_POSITION, position, _dummy_free, NULL); -} - -static void -position_signal_cb(void *data EINA_UNUSED, const Eldbus_Message *reply) -{ - if (!unmarshall_position(reply)) - { - ERR("Error: Unable to unmarshall position"); - return; - } - - /* Send out an event to all interested parties that we have an update */ - ecore_event_add(ELOCATION_EVENT_POSITION, position, _dummy_free, NULL); -} - -static Eina_Bool -geoclue_start(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event EINA_UNUSED) -{ - DBG("GeoClue start event at %s", unique_name); - return ECORE_CALLBACK_DONE; -} - -static Eina_Bool -geoclue_stop(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event EINA_UNUSED) -{ - DBG("GeoClue stop event"); - return ECORE_CALLBACK_DONE; -} - -static void -_reference_add_cb(void *data EINA_UNUSED, const Eldbus_Message *reply, Eldbus_Pending *pending EINA_UNUSED) -{ - const char *err, *errmsg; - - if (eldbus_message_error_get(reply, &err, &errmsg)) - { - ERR("Error: %s %s", err, errmsg); - return; - } - - DBG("Reference added"); -} - -static void -_reference_del_cb(void *data EINA_UNUSED, const Eldbus_Message *reply EINA_UNUSED, Eldbus_Pending *pending EINA_UNUSED) -{ - /* Dummy callback. We are not waiting for any reply here on shutdown */ -} - -static void -status_cb(void *data EINA_UNUSED, const Eldbus_Message *reply, Eldbus_Pending *pending EINA_UNUSED) -{ - const char *err, *errmsg; - - if (eldbus_message_error_get(reply, &err, &errmsg)) - { - ERR("Error: %s %s", err, errmsg); - return; - } - - if (!eldbus_message_arguments_get(reply,"i", &status)) - { - ERR("Error: Unable to unmarshall status"); - return; - } - - address_provider->status = position_provider->status = status; - /* Send out an event to all interested parties that we have an update */ - ecore_event_add(ELOCATION_EVENT_STATUS, &status, _dummy_free, NULL); -} - -static void -status_signal_cb(void *data EINA_UNUSED, const Eldbus_Message *reply) -{ - if (!eldbus_message_arguments_get(reply,"i", &status)) - { - ERR("Error: Unable to unmarshall status"); - return; - } - - address_provider->status = position_provider->status = status; - /* Send out an event to all interested parties that we have an update */ - ecore_event_add(ELOCATION_EVENT_STATUS, &status, _dummy_free, NULL); -} - -static void -_dummy_cb(void *data EINA_UNUSED, const Eldbus_Message *msg EINA_UNUSED, Eldbus_Pending *pending EINA_UNUSED) -{ -} - -/* We got notified from GeoClue that the meta-provider we asked for is now - * ready. That means we can finish up our initialization and set up all - * callbacks and handling for the interfaces we use on the meta-provider. - * - * We also call the interfaces to get an initial set of data that we can provide - * to eager aplications. - */ -static void -create_cb(void *data EINA_UNUSED, const Eldbus_Message *reply, Eldbus_Pending *pending EINA_UNUSED) -{ - const char *object_path; - Eina_Bool updates; - int accur_level, min_time, resources; - const char *err, *errmsg; - - if (eldbus_message_error_get(reply, &err, &errmsg)) - { - ERR("Error: %s %s", err, errmsg); - return; - } - - if (!eldbus_message_arguments_get(reply, "o", &object_path)) return; - - DBG("Object path for client: %s", object_path); - - /* With the created object path we now have a meta provider we can operate on. - * Geoclue handles the selection of the best provider internally for the meta - * provider */ - obj_meta = eldbus_object_get(conn, GEOCLUE_DBUS_NAME, object_path); - if (!obj_meta) - { - ERR("Error: could not get object for client"); - return; - } - - meta_geoclue = eldbus_proxy_get(obj_meta, GEOCLUE_GEOCLUE_IFACE); - if (!meta_geoclue) - { - ERR("Error: could not get proxy for geoclue"); - return; - } - - meta_address = eldbus_proxy_get(obj_meta, GEOCLUE_ADDRESS_IFACE); - if (!meta_address) - { - ERR("Error: could not get proxy address"); - return; - } - - meta_position = eldbus_proxy_get(obj_meta, GEOCLUE_POSITION_IFACE); - if (!meta_position) - { - ERR("Error: could not get proxy for position"); - return; - } - - meta_masterclient = eldbus_proxy_get(obj_meta, GEOCLUE_MASTERCLIENT_IFACE); - if (!meta_masterclient) - { - ERR("Error: could not get proxy for master client"); - return; - } - - meta_velocity = eldbus_proxy_get(obj_meta, GEOCLUE_VELOCITY_IFACE); - if (!meta_velocity) - { - ERR("Error: could not get proxy for velocity"); - return; - } - - meta_nmea = eldbus_proxy_get(obj_meta, GEOCLUE_NMEA_IFACE); - if (!meta_nmea) - { - ERR("Error: could not get proxy for nmea"); - return; - } - - meta_satellite = eldbus_proxy_get(obj_meta, GEOCLUE_SATELLITE_IFACE); - if (!meta_satellite) - { - ERR("Error: could not get proxy for satellite"); - return; - } - - /* Send Geoclue a set of requirements we have for the provider and start the address and position - * meta provider afterwards. After this we should be ready for operation. */ - updates = EINA_FALSE; /* Especially the web providers do not offer updates */ - accur_level = ELOCATION_ACCURACY_LEVEL_COUNTRY; - min_time = 0; /* Minimal times between updates (no implemented yet) */ - resources = ELOCATION_RESOURCE_ALL; - - eldbus_proxy_signal_handler_add(meta_masterclient, "AddressProviderChanged", - meta_address_provider_info_signal_cb, address_provider); - eldbus_proxy_signal_handler_add(meta_masterclient, "PositionProviderChanged", - meta_position_provider_info_signal_cb, position_provider); - - if (!eldbus_proxy_call(meta_masterclient, "SetRequirements", _dummy_cb, NULL, -1, "iibi", - accur_level, min_time, updates, resources)) - { - ERR("Error: could not call SetRequirements"); - return; - } - - if (!eldbus_proxy_call(meta_masterclient, "AddressStart", _dummy_cb, NULL, -1, "")) - { - ERR("Error: could not call AddressStart"); - return; - } - - if (!eldbus_proxy_call(meta_masterclient, "PositionStart", _dummy_cb, NULL, -1, "")) - { - ERR("Error: could not call PositionStart"); - return; - } - - if (!eldbus_proxy_call(meta_geoclue, "AddReference", _reference_add_cb, NULL, -1, "")) - { - ERR("Error: could not call AddReference"); - return; - } - - if (!eldbus_proxy_call(meta_address, "GetAddress", address_cb, NULL, -1, "")) - { - ERR("Error: could not call GetAddress"); - return; - } - - if (!eldbus_proxy_call(meta_position, "GetPosition", position_cb, NULL, -1, "")) - { - ERR("Error: could not call GetPosition"); - return; - } - - if (!eldbus_proxy_call(meta_geoclue, "GetStatus", status_cb, NULL, -1, "")) - { - ERR("Error: could not call GetStatus"); - return; - } - - if (!eldbus_proxy_call(meta_velocity, "GetVelocity", velocity_cb, NULL, -1, "")) - { - ERR("Error: could not call GetVelocity"); - return; - } - - if (!eldbus_proxy_call(meta_nmea, "GetNmea", nmea_cb, NULL, -1, "")) - { - ERR("Error: could not call GetNmea"); - return; - } - - if (!eldbus_proxy_call(meta_satellite, "GetSatellite", satellite_cb, NULL, -1, "")) - { - ERR("Error: could not call GetSatellite"); - return; - } - - if (!eldbus_proxy_call(meta_satellite, "GetLastSatellite", last_satellite_cb, NULL, -1, "")) - { - ERR("Error: could not call GetLastSatellite"); - return; - } - - if (!eldbus_proxy_call(meta_masterclient, "GetAddressProvider", meta_address_provider_info_cb, - address_provider, -1, "")) - { - ERR("Error: could not call GetAddressProvider"); - return; - } - - if (!eldbus_proxy_call(meta_masterclient, "GetPositionProvider", meta_position_provider_info_cb, - position_provider, -1, "")) - { - ERR("Error: could not call GetPositionProvider"); - return; - } - - eldbus_proxy_signal_handler_add(meta_address, "AddressChanged", address_signal_cb, NULL); - eldbus_proxy_signal_handler_add(meta_position, "PositionChanged", position_signal_cb, NULL); - eldbus_proxy_signal_handler_add(meta_geoclue, "StatusChanged", status_signal_cb, NULL); - eldbus_proxy_signal_handler_add(meta_velocity, "VelocityChanged", velocity_signal_cb, NULL); - eldbus_proxy_signal_handler_add(meta_nmea, "NmeaChanged", nmea_signal_cb, NULL); - eldbus_proxy_signal_handler_add(meta_satellite, "SatelliteChanged", satellite_signal_cb, NULL); - - ecore_event_add(ELOCATION_EVENT_META_READY, NULL, NULL, NULL); -} - -static void -_name_owner_changed(void *data EINA_UNUSED, const char *bus EINA_UNUSED, const char *old, const char *new) -{ - if (old[0] == '\0' && new[0] != '\0') - { - ecore_event_add(ELOCATION_EVENT_IN, NULL, NULL, NULL); - unique_name = strdup(new); - } - else if (old[0] != '\0' && new[0] == '\0') - { - if (strcmp(unique_name, old) != 0) - WARN("%s was not the known name %s, ignored.", old, unique_name); - else - ecore_event_add(ELOCATION_EVENT_OUT, NULL, NULL, NULL); - } - else - { - DBG("unknown change from %s to %s", old, new); - } -} - -/* Public API function to request a landmarks position based on an address object */ -EAPI Eina_Bool -elocation_landmarks_get(Elocation_Position *position_shadow EINA_UNUSED, Elocation_Address *address_shadow EINA_UNUSED) -{ - Eldbus_Message *msg; - Eldbus_Message_Iter *iter; - const char *keyword = NULL, *lang = NULL, *country_code = NULL; - int limit = 0; - double left= 0.0, top = 0.0, right = 0.0, bottom = 0.0; - - msg = eldbus_proxy_method_call_new(master_poi, "SearchByPosition"); - iter = eldbus_message_iter_get(msg); - eldbus_message_iter_basic_append(iter, 's', keyword); - eldbus_message_iter_basic_append(iter, 's', lang); - eldbus_message_iter_basic_append(iter, 's', country_code); - eldbus_message_iter_basic_append(iter, 'i', limit); - eldbus_message_iter_basic_append(iter, 'd', left); - eldbus_message_iter_basic_append(iter, 'd', top); - eldbus_message_iter_basic_append(iter, 'd', right); - eldbus_message_iter_basic_append(iter, 'd', bottom); - if (!eldbus_proxy_send(master_poi, msg, poi_cb, NULL, -1)) - { - ERR("Error: could not call SearchByPosition"); - eldbus_message_unref(msg); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -/* Public API function to get an address from a position */ -EAPI Eina_Bool -elocation_position_to_address(Elocation_Position *position_shadow, Elocation_Address *address_shadow EINA_UNUSED) -{ - Eldbus_Message *msg; - Eldbus_Message_Iter *iter, *structure; - - msg = eldbus_proxy_method_call_new(geonames_rgeocode, "PositionToAddress"); - iter = eldbus_message_iter_get(msg); - eldbus_message_iter_basic_append(iter, 'd', position_shadow->latitude); - eldbus_message_iter_basic_append(iter, 'd', position_shadow->longitude); - structure = eldbus_message_iter_container_new(iter, 'r', NULL); - eldbus_message_iter_basic_append(structure, 'i', position_shadow->accur->level); - eldbus_message_iter_basic_append(structure, 'd', position_shadow->accur->horizontal); - eldbus_message_iter_basic_append(structure, 'd', position_shadow->accur->vertical); - eldbus_message_iter_container_close(iter, structure); - if (!eldbus_proxy_send(geonames_rgeocode, msg, rgeocode_cb, NULL, -1)) - { - ERR("Error: could not call PositionToAddress"); - eldbus_message_unref(msg); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -/* Public API function to get a position from and address */ -EAPI Eina_Bool -elocation_address_to_position(Elocation_Address *address_shadow, Elocation_Position *position_shadow EINA_UNUSED) -{ - Eldbus_Message *msg; - Eldbus_Message_Iter *iter, *array; - - /* In function macro to generate a key value pair structure for the dict */ - #define ENTRY(key) { #key, address_shadow->key } - struct keyval { - const char *key; - const char *val; - } keyval[] = { - ENTRY(country), - ENTRY(countrycode), - ENTRY(locality), - ENTRY(postalcode), - ENTRY(region), - ENTRY(timezone), - { NULL, NULL } - }; - #undef ENTRY - - struct keyval *k; - - msg = eldbus_proxy_method_call_new(geonames_geocode, "AddressToPosition"); - iter = eldbus_message_iter_get(msg); - - array = eldbus_message_iter_container_new(iter, 'a', "{ss}"); - - for (k = keyval; k && k->key; k++) - { - Eldbus_Message_Iter *entry; - - if (!k->val) continue; - - entry = eldbus_message_iter_container_new(array, 'e', NULL); - eldbus_message_iter_arguments_append(entry, "ss", k->key, k->val); - eldbus_message_iter_container_close(array, entry); - } - - eldbus_message_iter_container_close(iter, array); - - if (!eldbus_proxy_send(geonames_geocode, msg, geocode_cb, NULL, -1)) - { - ERR("Error: could not call AddressToPosition"); - eldbus_message_unref(msg); - return EINA_FALSE; - } - - return EINA_TRUE; -} - -/* Public API function to get the position from a freeform text input style - * address - */ -EAPI Eina_Bool -elocation_freeform_address_to_position(const char *freeform_address, Elocation_Position *position_shadow EINA_UNUSED) -{ - if (!eldbus_proxy_call(geonames_geocode, "FreeformAddressToPosition", geocode_cb, NULL, -1, "s", freeform_address)) - { - ERR("Error: could not call FreeformAddressToPosition"); - return EINA_FALSE; - } - return EINA_TRUE; -} - -/* Public API function to request the current address */ -EAPI Eina_Bool -elocation_address_get(Elocation_Address *address_shadow) -{ - if (!address) return EINA_FALSE; - if (address == address_shadow) return EINA_TRUE; - - *address_shadow = *address; - return EINA_TRUE; -} - -/* Public API function to request the current position */ -EAPI Eina_Bool -elocation_position_get(Elocation_Position *position_shadow) -{ - if (!position) return EINA_FALSE; - if (position == position_shadow) return EINA_TRUE; - - *position_shadow = *position; - return EINA_TRUE; -} - -/* Public API function to request the status */ -EAPI Eina_Bool -elocation_status_get(int *status_shadow) -{ - if (status < 0) return EINA_FALSE; - if (&status == status_shadow) return EINA_TRUE; - - *status_shadow = status; - return EINA_TRUE; -} - -/* Public API function to create a new position object */ -EAPI Elocation_Position * -elocation_position_new(void) -{ - /* Malloc the global struct we operate on here in this lib. This shadows the - * updated data we are giving to the application */ - position = calloc(1, sizeof(Elocation_Position)); - if (!position) return NULL; - - position->accur = calloc(1, sizeof(Elocation_Accuracy)); - if (!position->accur) return NULL; - - return position; -} - -/* Public API function to create an new address object */ -EAPI Elocation_Address * -elocation_address_new(void) -{ - /* Malloc the global struct we operate on here in this lib. This shadows the - * updated data we are giving to the application */ - address = calloc(1, sizeof(Elocation_Address)); - if (!address) return NULL; - - address->accur = calloc(1, sizeof(Elocation_Accuracy)); - if (!address->accur) return NULL; - - return address; -} - -/* Public API function to free an position object */ -EAPI void -elocation_position_free(Elocation_Position *position_shadow) -{ - if (position != position_shadow) - { - ERR("Corrupted position object"); - return; - } - - free(position->accur); - free(position); -} - -/* Public API function to free an address object */ -EAPI void -elocation_address_free(Elocation_Address *address_shadow) -{ - if (address != address_shadow) - { - ERR("Corrupted address object"); - return; - } - - if (address) - { - free(address->country); - free(address->countrycode); - free(address->locality); - free(address->postalcode); - free(address->region); - free(address->timezone); - free(address->accur); - free(address); - } -} - -/* Public API function to initialize the elocation library */ -EAPI Eina_Bool -elocation_init(void) -{ - Eldbus_Object *obj_master = NULL; - Eldbus_Object *obj_geonames = NULL; - - if (!eina_init()) return EINA_FALSE; - if (!ecore_init()) return EINA_FALSE; - if (!eldbus_init()) return EINA_FALSE; - - _elocation_log_dom = eina_log_domain_register("elocation", EINA_COLOR_BLUE); - if (_elocation_log_dom < 0) - { - EINA_LOG_ERR("Could not register 'elocation' log domain."); - } - - /* Create objects, one for each kind, we operate on internally */ - address_provider = calloc(1, sizeof(Elocation_Provider)); - position_provider = calloc(1, sizeof(Elocation_Provider)); - - addr_geocode = calloc(1, sizeof(Elocation_Address)); - if (!addr_geocode) return EINA_FALSE; - - addr_geocode->accur = calloc(1, sizeof(Elocation_Accuracy)); - if (!addr_geocode->accur) return EINA_FALSE; - - pos_geocode = calloc(1, sizeof(Elocation_Position)); - if (!pos_geocode) return EINA_FALSE; - - pos_geocode->accur = calloc(1, sizeof(Elocation_Accuracy)); - if (!pos_geocode->accur) return EINA_FALSE; - - conn = eldbus_connection_get(ELDBUS_CONNECTION_TYPE_SESSION); - if (!conn) - { - ERR("Error: could not connect to session bus."); - return EXIT_FAILURE; - } - - /* Create all ecore event types we send out to interested applications */ - ELOCATION_EVENT_IN = ecore_event_type_new(); - ELOCATION_EVENT_OUT = ecore_event_type_new(); - ELOCATION_EVENT_STATUS = ecore_event_type_new(); - ELOCATION_EVENT_POSITION = ecore_event_type_new(); - ELOCATION_EVENT_ADDRESS = ecore_event_type_new(); - ELOCATION_EVENT_VELOCITY = ecore_event_type_new(); - ELOCATION_EVENT_GEOCODE = ecore_event_type_new(); - ELOCATION_EVENT_REVERSEGEOCODE = ecore_event_type_new(); - ELOCATION_EVENT_NMEA = ecore_event_type_new(); - ELOCATION_EVENT_SATELLITE = ecore_event_type_new(); - ELOCATION_EVENT_POI = ecore_event_type_new(); - ELOCATION_EVENT_META_READY = ecore_event_type_new(); - - obj_master= eldbus_object_get(conn, GEOCLUE_DBUS_NAME, GEOCLUE_OBJECT_PATH); - if (!obj_master) - { - ERR("Error: could not get object"); - return EXIT_FAILURE; - } - - manager_master = eldbus_proxy_get(obj_master, GEOCLUE_MASTER_IFACE); - if (!manager_master) - { - ERR("Error: could not get proxy"); - return EXIT_FAILURE; - } - - /* Create a meta provider for all normal use cases. This will allow GeoClue - * to decide which provider is the best for us internally. - * Right now we don't have the functionality in place to specifically request - * a provider but we maybe need this in the future. We will try without it - * for now. - */ - if (!eldbus_proxy_call(manager_master, "Create", create_cb, NULL, -1, "")) - { - ERR("Error: could not call Create"); - return EXIT_FAILURE; - } - - master_poi = eldbus_proxy_get(obj_master, GEOCLUE_POI_IFACE); - if (!master_poi) - { - ERR("Error: could not get proxy"); - return EXIT_FAILURE; - } - - /* Geocode and reverse geocode never show up as meta provider. Still we want - * to be able to convert so we keep them around directly here. */ - obj_geonames= eldbus_object_get(conn, GEONAMES_DBUS_NAME, GEONAMES_OBJECT_PATH); - if (!obj_geonames) - { - ERR("Error: could not get object for geonames"); - return EXIT_FAILURE; - } - - geonames_geocode = eldbus_proxy_get(obj_geonames, GEOCLUE_GEOCODE_IFACE); - if (!geonames_geocode) - { - ERR("Error: could not get proxy"); - return EXIT_FAILURE; - } - - geonames_rgeocode = eldbus_proxy_get(obj_geonames, GEOCLUE_REVERSEGEOCODE_IFACE); - if (!geonames_rgeocode) - { - ERR("Error: could not get proxy"); - return EXIT_FAILURE; - } - - eldbus_name_owner_changed_callback_add(conn, GEOCLUE_DBUS_NAME, _name_owner_changed, - NULL, EINA_TRUE); - - ecore_event_handler_add(ELOCATION_EVENT_IN, geoclue_start, NULL); - ecore_event_handler_add(ELOCATION_EVENT_OUT, geoclue_stop, NULL); - - return EINA_TRUE; -} - -/* Public API function to shutdown the elocation library form the application */ -EAPI void -elocation_shutdown(void) -{ - /* Depending on if the create_cb was successfully received meta_geoclue is - * setup or not. So we * need to check here if this is not the case - */ - if (meta_geoclue) - { - /* To allow geoclue freeing unused providers we free our reference on it here */ - if (!eldbus_proxy_call(meta_geoclue, "RemoveReference", _reference_del_cb, NULL, -1, "")) - { - ERR("Error: could not call RemoveReference"); - } - } - - ecore_event_type_flush(ELOCATION_EVENT_IN, - ELOCATION_EVENT_OUT, - ELOCATION_EVENT_STATUS, - ELOCATION_EVENT_POSITION, - ELOCATION_EVENT_ADDRESS, - ELOCATION_EVENT_VELOCITY, - ELOCATION_EVENT_GEOCODE, - ELOCATION_EVENT_REVERSEGEOCODE, - ELOCATION_EVENT_NMEA, - ELOCATION_EVENT_SATELLITE, - ELOCATION_EVENT_POI, - ELOCATION_EVENT_META_READY); - - /* Quite a bit of allocated string and generic memory cleanup. This should be - *less when we went away from all this global var business. - */ - if (address_provider) - { - free(address_provider->name); - free(address_provider->description); - free(address_provider->service); - free(address_provider->path); - free(address_provider); - } - - if (position_provider) - { - free(position_provider->name); - free(position_provider->description); - free(position_provider->service); - free(position_provider->path); - free(position_provider); - } - - if (pos_geocode) - { - free(pos_geocode->accur); - free(pos_geocode); - } - - if (addr_geocode) - { - free(addr_geocode->country); - free(addr_geocode->countrycode); - free(addr_geocode->locality); - free(addr_geocode->postalcode); - free(addr_geocode->region); - free(addr_geocode->timezone); - free(addr_geocode->accur); - free(addr_geocode); - } - - /* Unreference some eldbus strcutures we now longer use. To allow eldbus to - * free them internally. - */ - if (manager_master) - eldbus_proxy_unref(manager_master); - - eldbus_name_owner_changed_callback_del(conn, GEOCLUE_DBUS_NAME, _name_owner_changed, NULL); - eldbus_connection_unref(conn); - eldbus_shutdown(); - ecore_shutdown(); - eina_log_domain_unregister(_elocation_log_dom); - eina_shutdown(); -} diff --git a/src/lib/elocation/elocation_private.h b/src/lib/elocation/elocation_private.h deleted file mode 100644 index b0d48657a9..0000000000 --- a/src/lib/elocation/elocation_private.h +++ /dev/null @@ -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 - -#include -#include -#include - -#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 diff --git a/src/lib/elocation/gen/eldbus_geo_clue2_client.c b/src/lib/elocation/gen/eldbus_geo_clue2_client.c deleted file mode 100644 index b116647998..0000000000 --- a/src/lib/elocation/gen/eldbus_geo_clue2_client.c +++ /dev/null @@ -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; -} diff --git a/src/lib/elocation/gen/eldbus_geo_clue2_client.h b/src/lib/elocation/gen/eldbus_geo_clue2_client.h deleted file mode 100644 index 3626e6df16..0000000000 --- a/src/lib/elocation/gen/eldbus_geo_clue2_client.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef ELDBUS_GEO_CLUE2_CLIENT_H -#define ELDBUS_GEO_CLUE2_CLIENT_H - -#ifdef EFL_BETA_API_SUPPORT - -#include -#include -#include -#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 diff --git a/src/lib/elocation/gen/eldbus_geo_clue2_location.c b/src/lib/elocation/gen/eldbus_geo_clue2_location.c deleted file mode 100644 index 57728c1724..0000000000 --- a/src/lib/elocation/gen/eldbus_geo_clue2_location.c +++ /dev/null @@ -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; -} diff --git a/src/lib/elocation/gen/eldbus_geo_clue2_location.h b/src/lib/elocation/gen/eldbus_geo_clue2_location.h deleted file mode 100644 index 91f2c75b4f..0000000000 --- a/src/lib/elocation/gen/eldbus_geo_clue2_location.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef ELDBUS_GEO_CLUE2_LOCATION_H -#define ELDBUS_GEO_CLUE2_LOCATION_H - -#ifdef EFL_BETA_API_SUPPORT - -#include -#include -#include -#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 diff --git a/src/lib/elocation/gen/eldbus_geo_clue2_manager.c b/src/lib/elocation/gen/eldbus_geo_clue2_manager.c deleted file mode 100644 index 838a530d4d..0000000000 --- a/src/lib/elocation/gen/eldbus_geo_clue2_manager.c +++ /dev/null @@ -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; -} diff --git a/src/lib/elocation/gen/eldbus_geo_clue2_manager.h b/src/lib/elocation/gen/eldbus_geo_clue2_manager.h deleted file mode 100644 index 572e1fac5c..0000000000 --- a/src/lib/elocation/gen/eldbus_geo_clue2_manager.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef ELDBUS_GEO_CLUE2_MANAGER_H -#define ELDBUS_GEO_CLUE2_MANAGER_H - -#ifdef EFL_BETA_API_SUPPORT - -#include -#include -#include -#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 diff --git a/src/lib/elocation/gen/eldbus_utils.h b/src/lib/elocation/gen/eldbus_utils.h deleted file mode 100644 index db4f9ae391..0000000000 --- a/src/lib/elocation/gen/eldbus_utils.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src/lib/elocation/gen/meson.build b/src/lib/elocation/gen/meson.build deleted file mode 100644 index 58de776fa5..0000000000 --- a/src/lib/elocation/gen/meson.build +++ /dev/null @@ -1,5 +0,0 @@ - -elocation_src += files([ - 'eldbus_geo_clue2_client.c', - 'eldbus_geo_clue2_location.c', - 'eldbus_geo_clue2_manager.c']) diff --git a/src/lib/elocation/gen/org.freedesktop.GeoClue2.xml b/src/lib/elocation/gen/org.freedesktop.GeoClue2.xml deleted file mode 100644 index ab14565438..0000000000 --- a/src/lib/elocation/gen/org.freedesktop.GeoClue2.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/lib/elocation/meson.build b/src/lib/elocation/meson.build deleted file mode 100644 index 080ea57278..0000000000 --- a/src/lib/elocation/meson.build +++ /dev/null @@ -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, -) diff --git a/src/tests/elocation/elocation_suite.c b/src/tests/elocation/elocation_suite.c deleted file mode 100644 index afae6e03b1..0000000000 --- a/src/tests/elocation/elocation_suite.c +++ /dev/null @@ -1,235 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include -#endif /* ifdef HAVE_CONFIG_H */ - -#include -#include - -#include - -#include - -/* 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; -}