#include "Eldbus.h"
#include <Ecore.h>
#define BUS "org.Enlightenment"
#define PATH "/org/enlightenment"
#define INTERFACE "org.enlightenment.Test"
#define NTESTS 8
static int _client_log_dom = -1;
#define ERR(...) EINA_LOG_DOM_ERR(_client_log_dom, __VA_ARGS__)
static void
{
printf("Alive\n\n");
}
static void
{
const char *txt;
printf("%s\n", txt);
}
#include <inttypes.h>
static struct expected
{
uint8_t y;
uint32_t u;
int32_t i;
int16_t n;
double d;
const char *s;
} expected = {
.y = 0xAA,
.u = 0xFFFFFFFF,
.i = 0xFFFFFFFF,
.n = 0xFFFF,
.d = 3.1415926,
.s = "test",
};
static void
test(void)
{
static int n = 0;
n++;
if (n >= NTESTS)
{
printf("Passed in all tests\nExiting...\n");
conn = NULL;
}
else
printf("Passed in %d/%d tests\n", n, NTESTS);
}
static void
{
const char *errname, *errmsg;
{
ERR(
"%s %s", errname, errmsg);
return;
}
{
ERR(
"Could not get entry contents");
return;
}
if (b != expected.b)
{
ERR(
"Bool value doesn't match");
return;
}
test();
}
static void
{
const char *errname, *errmsg;
uint8_t y;
{
ERR(
"%s %s", errname, errmsg);
return;
}
{
ERR(
"Could not get entry contents");
return;
}
if (y != expected.y)
{
ERR(
"Byte value doesn't match expected value");
return;
}
test();
}
static void
{
const char *errname, *errmsg;
unsigned int u;
{
ERR(
"%s %s", errname, errmsg);
return;
}
{
ERR(
"Could not get entry contents");
return;
}
if (u != expected.u)
{
ERR(
"Uint32 value doesn't match expected value");
return;
}
test();
}
static void
{
const char *errname, *errmsg;
int32_t i;
{
ERR(
"%s %s", errname, errmsg);
return;
}
{
ERR(
"Could not get entry contents");
return;
}
if (i != expected.i)
{
ERR(
"Int32 value doesn't match expected value");
return;
}
test();
}
static void
{
const char *errname, *errmsg;
int16_t n;
{
ERR(
"%s %s", errname, errmsg);
return;
}
{
ERR(
"Could not get entry contents");
return;
}
if (n != expected.n)
{
ERR(
"Int16 value doesn't match expected value");
return;
}
test();
}
static void
{
const char *errname, *errmsg;
double d;
{
ERR(
"%s %s", errname, errmsg);
return;
}
{
ERR(
"Could not get entry contents");
return;
}
{
ERR(
"Double value doesn't match expected value");
return;
}
test();
}
static void
{
const char *errname, *errmsg;
char *s;
{
ERR(
"%s %s", errname, errmsg);
return;
}
{
ERR(
"Could not get entry contents");
return;
}
if (strcmp(s, expected.s) != 0)
{
ERR(
"Uint32 value doesn't match expected value");
return;
}
test();
}
static void
{
const char *errname, *errmsg;
{
ERR(
"%s %s", errname, errmsg);
return;
}
test();
}
static void
on_name_owner_changed(
void *data
EINA_UNUSED,
const char *bus,
const char *old_id,
const char *new_id
EINA_UNUSED)
{
printf("Bus=%s | old=%s | new=%s\n", bus, old_id, new_id);
}
{
ERR(
"Timeout\nSome error happened or server is taking too much time to respond.");
timeout = NULL;
}
int
main(void)
{
if (_client_log_dom < 0)
{
goto exit_eina;
}
expected.b);
expected.y);
expected.u);
expected.i);
expected.n);
expected.d);
expected.s);
if (timeout)
if (conn)
exit_eina:
return 0;
}
EAPI int ecore_shutdown(void)
Shuts down connections, signal handlers sockets etc.
Definition: ecore.c:371
EAPI int ecore_init(void)
Sets up connections, signal handlers, sockets etc.
Definition: ecore.c:230
void ecore_main_loop_quit(void)
Quits the main loop once all the events currently on the queue have been processed.
Definition: ecore_main.c:1321
#define ECORE_CALLBACK_CANCEL
Return value to remove a callback.
Definition: Ecore_Common.h:152
void ecore_main_loop_begin(void)
Runs the application main loop.
Definition: ecore_main.c:1311
void * ecore_timer_del(Ecore_Timer *timer)
Deletes the specified timer from the timer list.
Definition: ecore_timer.c:238
Ecore_Timer * ecore_timer_add(double in, Ecore_Task_Cb func, const void *data)
Creates a timer to call the given function in the given period of time.
Definition: ecore_timer.c:189
Eo Ecore_Timer
A handle for timers.
Definition: Ecore_Common.h:3079
#define ERR(...)
Macro for logging Eina errors.
Definition: eina_file_common.h:161
#define EINA_LOG_ERR(fmt,...)
Logs a message with level ERROR on the default domain with the specified format.
Definition: eina_log.h:376
EINA_API void eina_log_domain_unregister(int domain)
Forgets about a logging domain registered by eina_log_domain_register()
Definition: eina_log.c:1904
EINA_API int eina_log_domain_register(const char *name, const char *color)
Definition: eina_log.c:1885
EINA_API int eina_shutdown(void)
Shuts down the Eina library.
Definition: eina_main.c:379
EINA_API int eina_init(void)
Initializes the Eina library.
Definition: eina_main.c:291
#define EINA_TRUE
boolean value TRUE (numerical value 1)
Definition: eina_types.h:539
unsigned char Eina_Bool
Type to mimic a boolean.
Definition: eina_types.h:527
#define EINA_UNUSED
Used to indicate that a function parameter is purposely unused.
Definition: eina_types.h:339
void eldbus_name_owner_changed_callback_add(Eldbus_Connection *conn, const char *bus, Eldbus_Name_Owner_Changed_Cb cb, const void *cb_data, Eina_Bool allow_initial_call)
Add a callback to be called when unique id of a bus name changed.
Definition: eldbus_core.c:1397
void eldbus_connection_unref(Eldbus_Connection *conn)
Decrement connection reference count.
Definition: eldbus_core.c:1306
Eldbus_Connection * eldbus_connection_get(Eldbus_Connection_Type type)
Establish a connection to bus and integrate it with the ecore main loop.
Definition: eldbus_core.c:1102
struct _Eldbus_Message Eldbus_Message
Represents the way data is sent and received in DBus.
Definition: Eldbus.h:173
EAPI int eldbus_shutdown(void)
Shutdown eldbus.
Definition: eldbus_core.c:246
struct _Eldbus_Pending Eldbus_Pending
Represents a message that has been sent but has not yet reached its destination.
Definition: Eldbus.h:188
EAPI int eldbus_init(void)
Initialize eldbus.
Definition: eldbus_core.c:128
Eina_Bool eldbus_message_error_get(const Eldbus_Message *msg, const char **name, const char **text)
Get the error text and name from a Eldbus_Message.
Definition: eldbus_message.c:233
Eina_Bool eldbus_message_arguments_get(const Eldbus_Message *msg, const char *signature,...)
Get the arguments from an Eldbus_Message.
Definition: eldbus_message.c:274
Eldbus_Object * eldbus_object_get(Eldbus_Connection *conn, const char *bus, const char *path)
Get an object of the given bus and path.
Definition: eldbus_object.c:188
Eldbus_Signal_Handler * eldbus_proxy_signal_handler_add(Eldbus_Proxy *proxy, const char *member, Eldbus_Signal_Cb cb, const void *cb_data)
Add a signal handler.
Definition: eldbus_proxy.c:658
Eldbus_Pending * eldbus_proxy_call(Eldbus_Proxy *proxy, const char *member, Eldbus_Message_Cb cb, const void *cb_data, double timeout, const char *signature,...)
Call a method in proxy.
Definition: eldbus_proxy.c:621
Eldbus_Proxy * eldbus_proxy_get(Eldbus_Object *obj, const char *interface)
Get a proxy of the following interface name in a Eldbus_Object.
Definition: eldbus_proxy.c:208
struct _Eldbus_Connection Eldbus_Connection
Represents a connection of one the type of connection with the DBus daemon.
Definition: Eldbus.h:227
struct _Eldbus_Proxy Eldbus_Proxy
Represents a client object bound to an interface.
Definition: Eldbus.h:221
struct _Eldbus_Object Eldbus_Object
Represents an object path already attached with bus name or unique id.
Definition: Eldbus.h:233