geolocation module build: now with fewer generated files!
also fix distcheck of geolocation edj file by not compiling it
This commit is contained in:
parent
8a5ce37b99
commit
f6e8305309
|
@ -1,34 +1,36 @@
|
|||
EXTRA_DIST += src/modules/geolocation/module.desktop.in \
|
||||
src/modules/geolocation/e-module-geolocation.edc \
|
||||
src/modules/tiling/images/location_on.png \
|
||||
src/modules/tiling/images/location_off.png
|
||||
src/modules/geolocation/e-module-geolocation.edj \
|
||||
src/modules/geolocation/org.freedesktop.GeoClue2.xml
|
||||
|
||||
if USE_MODULE_GEOLOCATION
|
||||
geolocationdir = $(MDIR)/geolocation
|
||||
geolocation_DATA = src/modules/geolocation/e-module-geolocation.edj \
|
||||
src/modules/geolocation/module.desktop
|
||||
CLEANFILES += src/modules/geolocation/e-module-geolocation.edj
|
||||
|
||||
|
||||
geolocationpkgdir = $(MDIR)/geolocation/$(MODULE_ARCH)
|
||||
geolocationpkg_LTLIBRARIES = src/modules/geolocation/module.la
|
||||
|
||||
GEOLOCATION_EDJE_FLAGS = $(EDJE_FLAGS) -id $(top_srcdir)/src/modules/geolocation/images
|
||||
GEO_GEN = \
|
||||
src/modules/geolocation/eldbus_geo_clue2_client.c \
|
||||
src/modules/geolocation/eldbus_geo_clue2_client.h \
|
||||
src/modules/geolocation/eldbus_geo_clue2_location.c \
|
||||
src/modules/geolocation/eldbus_geo_clue2_location.h \
|
||||
src/modules/geolocation/eldbus_geo_clue2_manager.c \
|
||||
src/modules/geolocation/eldbus_geo_clue2_manager.h \
|
||||
src/modules/geolocation/eldbus_utils.h
|
||||
|
||||
src/modules/geolocation/%.edj: src/modules/geolocation/%.edc Makefile
|
||||
$(EDJE_CC) $(GEOLOCATION_EDJE_FLAGS) $< $@
|
||||
MAINTAINERCLEANFILES += $(GEO_GEN)
|
||||
|
||||
$(GEO_GEN): src/modules/geolocation/org.freedesktop.GeoClue2.xml
|
||||
@cd $(top_builddir)/src/modules/geolocation && \
|
||||
eldbus-codegen $(abs_top_srcdir)/src/modules/geolocation/org.freedesktop.GeoClue2.xml
|
||||
|
||||
src_modules_geolocation_module_la_LIBADD = $(MOD_LIBS)
|
||||
src_modules_geolocation_module_la_CPPFLAGS = $(MOD_CPPFLAGS)
|
||||
src_modules_geolocation_module_la_LDFLAGS = $(MOD_LDFLAGS)
|
||||
src_modules_geolocation_module_la_SOURCES = \
|
||||
src/modules/geolocation/e_mod_main.c \
|
||||
src/modules/geolocation/gen/eldbus_geo_clue2_client.c \
|
||||
src/modules/geoclocation/gen/eldbus_geo_clue2_client.h \
|
||||
src/modules/geolocation/gen/eldbus_geo_clue2_location.c \
|
||||
src/modules/geolocation/gen/eldbus_geo_clue2_location.h \
|
||||
src/modules/geolocation/gen/eldbus_geo_clue2_manager.c \
|
||||
src/modules/geolocation/gen/eldbus_geo_clue2_manager.h \
|
||||
src/modules/geolocation/gen/eldbus_utils.h
|
||||
$(GEO_GEN)
|
||||
|
||||
PHONIES += geolocation install-geolocation
|
||||
geolocation: $(geolocationpkg_LTLIBRARIES) $(geolocation_DATA)
|
||||
|
|
|
@ -1 +1,7 @@
|
|||
/e-module-geolocation.edj
|
||||
/eldbus_geo_clue2_client.c
|
||||
/eldbus_geo_clue2_client.h
|
||||
/eldbus_geo_clue2_location.c
|
||||
/eldbus_geo_clue2_location.h
|
||||
/eldbus_geo_clue2_manager.c
|
||||
/eldbus_geo_clue2_manager.h
|
||||
/eldbus_utils.h
|
||||
|
|
Binary file not shown.
|
@ -1,8 +1,8 @@
|
|||
#include "e.h"
|
||||
|
||||
#include "gen/eldbus_geo_clue2_manager.h"
|
||||
#include "gen/eldbus_geo_clue2_client.h"
|
||||
#include "gen/eldbus_geo_clue2_location.h"
|
||||
#include "eldbus_geo_clue2_manager.h"
|
||||
#include "eldbus_geo_clue2_client.h"
|
||||
#include "eldbus_geo_clue2_location.h"
|
||||
|
||||
/* gadcon requirements */
|
||||
static E_Gadcon_Client *_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style);
|
||||
|
|
|
@ -1,442 +0,0 @@
|
|||
#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.");
|
||||
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.");
|
||||
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, 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(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, 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(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, data);
|
||||
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;
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
#ifndef ELDBUS_GEO_CLUE2_CLIENT_H
|
||||
#define ELDBUS_GEO_CLUE2_CLIENT_H
|
||||
|
||||
#include <Eina.h>
|
||||
#include <Ecore.h>
|
||||
#include <Eldbus.h>
|
||||
#include "eldbus_utils.h"
|
||||
|
||||
Eldbus_Proxy *geo_clue2_client_proxy_get(Eldbus_Connection *conn, const char *bus, const char *path);
|
||||
void geo_clue2_client_proxy_unref(Eldbus_Proxy *proxy);
|
||||
void geo_clue2_client_log_domain_set(int id);
|
||||
typedef void (*Geo_Clue2_Client_Start_Cb)(Eldbus_Proxy *proxy, void *data, Eldbus_Pending *pending, Eldbus_Error_Info *error);
|
||||
Eldbus_Pending *geo_clue2_client_start_call(Eldbus_Proxy *proxy, Geo_Clue2_Client_Start_Cb cb, const void *data);
|
||||
typedef void (*Geo_Clue2_Client_Stop_Cb)(Eldbus_Proxy *proxy, void *data, Eldbus_Pending *pending, Eldbus_Error_Info *error);
|
||||
Eldbus_Pending *geo_clue2_client_stop_call(Eldbus_Proxy *proxy, Geo_Clue2_Client_Stop_Cb cb, const void *data);
|
||||
extern int GEO_CLUE2_CLIENT_LOCATION_UPDATED_EVENT;
|
||||
typedef struct _Geo_Clue2_Client_LocationUpdated_Data
|
||||
{
|
||||
Eldbus_Proxy *proxy;
|
||||
char *old;
|
||||
char *new;
|
||||
} Geo_Clue2_Client_LocationUpdated_Data;
|
||||
Eldbus_Pending *geo_clue2_client_location_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_String_Get_Cb cb, const void *data);
|
||||
Eldbus_Pending *geo_clue2_client_distance_threshold_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Uint32_Get_Cb cb, const void *data);
|
||||
Eldbus_Pending *geo_clue2_client_distance_threshold_propset(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Set_Cb cb, const void *data, const void *value);
|
||||
Eldbus_Pending *geo_clue2_client_desktop_id_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_String_Get_Cb cb, const void *data);
|
||||
Eldbus_Pending *geo_clue2_client_desktop_id_propset(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Set_Cb cb, const void *data, const void *value);
|
||||
Eldbus_Pending *geo_clue2_client_requested_accuracy_level_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Uint32_Get_Cb cb, const void *data);
|
||||
Eldbus_Pending *geo_clue2_client_requested_accuracy_level_propset(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Set_Cb cb, const void *data, const void *value);
|
||||
Eldbus_Pending *geo_clue2_client_active_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Bool_Get_Cb cb, const void *data);
|
||||
|
||||
#endif
|
|
@ -1,242 +0,0 @@
|
|||
#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;
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
#ifndef ELDBUS_GEO_CLUE2_LOCATION_H
|
||||
#define ELDBUS_GEO_CLUE2_LOCATION_H
|
||||
|
||||
#include <Eina.h>
|
||||
#include <Ecore.h>
|
||||
#include <Eldbus.h>
|
||||
#include "eldbus_utils.h"
|
||||
|
||||
Eldbus_Proxy *geo_clue2_location_proxy_get(Eldbus_Connection *conn, const char *bus, const char *path);
|
||||
void geo_clue2_location_proxy_unref(Eldbus_Proxy *proxy);
|
||||
void geo_clue2_location_log_domain_set(int id);
|
||||
Eldbus_Pending *geo_clue2_location_latitude_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Double_Get_Cb cb, const void *data);
|
||||
Eldbus_Pending *geo_clue2_location_longitude_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Double_Get_Cb cb, const void *data);
|
||||
Eldbus_Pending *geo_clue2_location_accuracy_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Double_Get_Cb cb, const void *data);
|
||||
Eldbus_Pending *geo_clue2_location_altitude_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Double_Get_Cb cb, const void *data);
|
||||
Eldbus_Pending *geo_clue2_location_description_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_String_Get_Cb cb, const void *data);
|
||||
|
||||
#endif
|
|
@ -1,203 +0,0 @@
|
|||
#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.");
|
||||
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.");
|
||||
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;
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
#ifndef ELDBUS_GEO_CLUE2_MANAGER_H
|
||||
#define ELDBUS_GEO_CLUE2_MANAGER_H
|
||||
|
||||
#include <Eina.h>
|
||||
#include <Ecore.h>
|
||||
#include <Eldbus.h>
|
||||
#include "eldbus_utils.h"
|
||||
|
||||
Eldbus_Proxy *geo_clue2_manager_proxy_get(Eldbus_Connection *conn, const char *bus, const char *path);
|
||||
void geo_clue2_manager_proxy_unref(Eldbus_Proxy *proxy);
|
||||
void geo_clue2_manager_log_domain_set(int id);
|
||||
typedef void (*Geo_Clue2_Manager_Get_Client_Cb)(Eldbus_Proxy *proxy, void *data, Eldbus_Pending *pending, Eldbus_Error_Info *error, const char *client);
|
||||
Eldbus_Pending *geo_clue2_manager_get_client_call(Eldbus_Proxy *proxy, Geo_Clue2_Manager_Get_Client_Cb cb, const void *data);
|
||||
typedef void (*Geo_Clue2_Manager_Add_Agent_Cb)(Eldbus_Proxy *proxy, void *data, Eldbus_Pending *pending, Eldbus_Error_Info *error);
|
||||
Eldbus_Pending *geo_clue2_manager_add_agent_call(Eldbus_Proxy *proxy, Geo_Clue2_Manager_Add_Agent_Cb cb, const void *data, const char *id);
|
||||
Eldbus_Pending *geo_clue2_manager_in_use_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Bool_Get_Cb cb, const void *data);
|
||||
Eldbus_Pending *geo_clue2_manager_available_accuracy_level_propget(Eldbus_Proxy *proxy, Eldbus_Codegen_Property_Uint32_Get_Cb cb, const void *data);
|
||||
|
||||
#endif
|
|
@ -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
|
|
@ -0,0 +1,199 @@
|
|||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
|
||||
<!--
|
||||
GeoClue 2.0 Interface Specification
|
||||
|
||||
Copyright (C) 2013 Red Hat, Inc.
|
||||
-->
|
||||
|
||||
<node>
|
||||
|
||||
<!--
|
||||
org.freedesktop.GeoClue2.Manager:
|
||||
@short_description: The GeoClue service manager
|
||||
|
||||
This is the interface you use to talk to main GeoClue2 manager object at
|
||||
path "/org/freedesktop/GeoClue2/Manager". The only thing you do with this
|
||||
interface is to call org.freedesktop.GeoClue2.Manager.GetClient() on it
|
||||
to get your application specific client object.
|
||||
-->
|
||||
<interface name="org.freedesktop.GeoClue2.Manager">
|
||||
<!--
|
||||
InUse:
|
||||
|
||||
Whether service is currently is use by any application.
|
||||
-->
|
||||
<property name="InUse" type="b" access="read"/>
|
||||
|
||||
<!--
|
||||
AvailableAccuracyLevel:
|
||||
|
||||
The level of available accuracy, as
|
||||
<link linkend="GClueAccuracyLevel">GClueAccuracyLevel</link>.
|
||||
-->
|
||||
<property name="AvailableAccuracyLevel" type="u" access="read"/>
|
||||
|
||||
<!--
|
||||
GetClient:
|
||||
@client: The path for newly created client object
|
||||
|
||||
Retrieves a client object which can only be used by the calling
|
||||
application only.
|
||||
-->
|
||||
<method name="GetClient">
|
||||
<arg name="client" type="o" direction="out"/>
|
||||
</method>
|
||||
|
||||
<!--
|
||||
AddAgent:
|
||||
@id: The Desktop ID (excluding .desktop) of the agent
|
||||
|
||||
An API for user authorization agents to register themselves. Each agent
|
||||
is responsible for the user it is running as. Application developers
|
||||
can and should simply ignore this API.
|
||||
-->
|
||||
<method name="AddAgent">
|
||||
<arg name="id" type="s" direction="in"/>
|
||||
</method>
|
||||
</interface>
|
||||
|
||||
<!--
|
||||
org.freedesktop.GeoClue2.Client:
|
||||
@short_description: The Application-specific client API
|
||||
|
||||
This is the interface you use to retrieve location information and receive
|
||||
location update signals from GeoClue service. You get the client object to
|
||||
use this interface on from org.freedesktop.GeoClue2.Manager.GetClient()
|
||||
method.
|
||||
-->
|
||||
<interface name="org.freedesktop.GeoClue2.Client">
|
||||
<!--
|
||||
Location:
|
||||
|
||||
Current location as path to a #org.freedesktop.GeoClue2.Location object.
|
||||
-->
|
||||
<property name="Location" type="o" access="read"/>
|
||||
|
||||
<!--
|
||||
DistanceThreshold:
|
||||
|
||||
Contains the current distance threshold in meters. This value is used
|
||||
by the service when it gets new location info. If the distance moved is
|
||||
below the threshold, it won't emit the LocationUpdated signal.
|
||||
-->
|
||||
<property name="DistanceThreshold" type="u" access="readwrite"/>
|
||||
|
||||
<!--
|
||||
DesktopId:
|
||||
|
||||
The desktop file id (the basename of the desktop file). This property
|
||||
must be set by applications for authorization to work.
|
||||
-->
|
||||
<property name="DesktopId" type="s" access="readwrite"/>
|
||||
|
||||
<!--
|
||||
RequestedAccuracyLevel:
|
||||
|
||||
The level of accuracy requested by client, as
|
||||
<link linkend="GClueAccuracyLevel">GClueAccuracyLevel</link>.
|
||||
|
||||
Please keep in mind that the actual accuracy of location information is
|
||||
dependent on available hardware on your machine, external resources
|
||||
and/or how much accuracy user agrees to be confortable with.
|
||||
-->
|
||||
<property name="RequestedAccuracyLevel" type="u" access="readwrite"/>
|
||||
|
||||
<!--
|
||||
Active:
|
||||
|
||||
If client is active, i-e started successfully using
|
||||
org.freedesktop.GeoClue2.Client.Start() and receiving location updates.
|
||||
|
||||
Please keep in mind that geoclue can at any time stop and start the
|
||||
client on user (agent) request. Applications that are interested in
|
||||
in these changes, should watch for changes in this property.
|
||||
-->
|
||||
<property name="Active" type="b" access="read"/>
|
||||
|
||||
<!--
|
||||
Start:
|
||||
|
||||
Start receiving events about the current location. Applications should
|
||||
hook-up to #org.freedesktop.GeoClue2.Client::LocationUpdated signal
|
||||
before calling this method.
|
||||
-->
|
||||
<method name="Start"/>
|
||||
|
||||
<!--
|
||||
Stop:
|
||||
|
||||
Stop receiving events about the current location.
|
||||
-->
|
||||
<method name="Stop"/>
|
||||
|
||||
<!--
|
||||
LocationUpdated:
|
||||
@old: old location as path to a #org.freedesktop.GeoClue2.Location object
|
||||
@new: new location as path to a #org.freedesktop.GeoClue2.Location object
|
||||
|
||||
The signal is emitted every time the location changes.
|
||||
The client should set the DistanceThreshold property to control how
|
||||
often this signal is emitted.
|
||||
-->
|
||||
<signal name="LocationUpdated">
|
||||
<arg name="old" type="o"/>
|
||||
<arg name="new" type="o"/>
|
||||
</signal>
|
||||
</interface>
|
||||
|
||||
<!--
|
||||
org.freedesktop.GeoClue2.Location:
|
||||
@short_description: The Location interface
|
||||
|
||||
This is the interface you use on location objects.
|
||||
-->
|
||||
<interface name="org.freedesktop.GeoClue2.Location">
|
||||
|
||||
<!--
|
||||
Latitude:
|
||||
|
||||
The latitude of the location, in degrees.
|
||||
-->
|
||||
<property name="Latitude" type="d" access="read"/>
|
||||
|
||||
<!--
|
||||
Longitude:
|
||||
|
||||
The longitude of the location, in degrees.
|
||||
-->
|
||||
<property name="Longitude" type="d" access="read"/>
|
||||
|
||||
<!--
|
||||
Accuracy:
|
||||
|
||||
The accuracy of the location fix, in meters.
|
||||
-->
|
||||
<property name="Accuracy" type="d" access="read"/>
|
||||
|
||||
<!--
|
||||
Altitude:
|
||||
|
||||
The altitude of the location fix, in meters. When unknown, its set to
|
||||
minimum double value, -1.7976931348623157e+308.
|
||||
-->
|
||||
<property name="Altitude" type="d" access="read"/>
|
||||
|
||||
<!--
|
||||
Description:
|
||||
|
||||
A human-readable description of the location, if available.
|
||||
|
||||
WARNING: Applications should not rely on this property since not all
|
||||
sources provide a description. If you really need a description (or
|
||||
more details) about current location, use a reverse-geocoding API, e.g
|
||||
geocode-glib.
|
||||
-->
|
||||
<property name="Description" type="s" access="read"/>
|
||||
</interface>
|
||||
</node>
|
Loading…
Reference in New Issue