Data Structures

struct  _Eldbus_Arg_Info
 
struct  _Eldbus_Method
 
struct  _Eldbus_Signal
 
struct  _Eldbus_Property
 
struct  _Eldbus_Service_Interface_Desc
 

Macros

#define ELDBUS_METHOD_FLAG_DEPRECATED   1
 
#define ELDBUS_METHOD_FLAG_NOREPLY   (1 << 1)
 
#define ELDBUS_SIGNAL_FLAG_DEPRECATED   1
 
#define ELDBUS_PROPERTY_FLAG_DEPRECATED   1
 
#define ELDBUS_ARGS(args...)   (const Eldbus_Arg_Info[]){ args, { NULL, NULL } }
 Used to insert complete types to signature of methods or signals. More...
 

Typedefs

typedef struct _Eldbus_Arg_Info Eldbus_Arg_Info
 
typedef struct _Eldbus_Service_Interface Eldbus_Service_Interface
 
typedef Eldbus_Message *(* Eldbus_Method_Cb) (const Eldbus_Service_Interface *iface, const Eldbus_Message *message)
 
typedef Eina_Bool(* Eldbus_Property_Get_Cb) (const Eldbus_Service_Interface *iface, const char *propname, Eldbus_Message_Iter *iter, const Eldbus_Message *request_msg, Eldbus_Message **error)
 Callback function to append property value to message. More...
 
typedef Eldbus_Message *(* Eldbus_Property_Set_Cb) (const Eldbus_Service_Interface *iface, const char *propname, Eldbus_Message_Iter *iter, const Eldbus_Message *input_msg)
 Callback function to set property value from message. More...
 
typedef struct _Eldbus_Method Eldbus_Method
 
typedef struct _Eldbus_Signal Eldbus_Signal
 
typedef struct _Eldbus_Property Eldbus_Property
 
typedef struct _Eldbus_Service_Interface_Desc Eldbus_Service_Interface_Desc
 

Functions

Eldbus_Service_Interface * eldbus_service_interface_register (Eldbus_Connection *conn, const char *path, const Eldbus_Service_Interface_Desc *desc)
 Register an interface in the given path and connection. More...
 
void eldbus_service_interface_unregister (Eldbus_Service_Interface *iface)
 Unregister a interface. More...
 
void eldbus_service_object_unregister (Eldbus_Service_Interface *iface)
 Unregister all interfaces of the object path that this interface belongs and the object path.
 
Eldbus_Connectioneldbus_service_connection_get (const Eldbus_Service_Interface *iface)
 
const char * eldbus_service_object_path_get (const Eldbus_Service_Interface *iface)
 
Eina_Bool eldbus_service_signal_emit (const Eldbus_Service_Interface *iface, unsigned int signal_id,...)
 Emit a signal handler of the interface with non-complex types. More...
 
Eldbus_Messageeldbus_service_signal_new (const Eldbus_Service_Interface *iface, unsigned int signal_id)
 Create signal message. More...
 
Eina_Bool eldbus_service_signal_send (const Eldbus_Service_Interface *iface, Eldbus_Message *signal_msg)
 Send a signal message. More...
 
void eldbus_service_object_data_set (Eldbus_Service_Interface *iface, const char *key, const void *data)
 Store data at object path, this data can be obtained from all interfaces of the same object. More...
 
void * eldbus_service_object_data_get (const Eldbus_Service_Interface *iface, const char *key)
 Get data stored in object path. More...
 
void * eldbus_service_object_data_del (Eldbus_Service_Interface *iface, const char *key)
 Del data stored in object path. More...
 
Eina_Bool eldbus_service_property_changed (const Eldbus_Service_Interface *iface, const char *name)
 Add property to list of changed properties A DBus.PropertiesChanged signal will be sent in an idler with all properties that have changed. More...
 
Eina_Bool eldbus_service_property_invalidate_set (const Eldbus_Service_Interface *iface, const char *name, Eina_Bool is_invalidate)
 
Eina_Bool eldbus_service_object_manager_attach (Eldbus_Service_Interface *iface)
 Attach ObjectManager interface. More...
 
Eina_Bool eldbus_service_object_manager_detach (Eldbus_Service_Interface *iface)
 Detach ObjectManager interface. More...
 

Detailed Description

Macro Definition Documentation

#define ELDBUS_ARGS (   args...)    (const Eldbus_Arg_Info[]){ args, { NULL, NULL } }

Used to insert complete types to signature of methods or signals.

Example: ELDBUS_ARGS({"s", "interface"}, {"s", "property"}) The signature will be "ss" and each string will have a tag name on introspect XML with the respective name.

Examples:
complex-types-server.c, server.c, and simple-signal-emit.c.

Typedef Documentation

typedef Eina_Bool(* Eldbus_Property_Get_Cb) (const Eldbus_Service_Interface *iface, const char *propname, Eldbus_Message_Iter *iter, const Eldbus_Message *request_msg, Eldbus_Message **error)

Callback function to append property value to message.

Parameters
ifaceinterface of property
propnamename of property
itervariant iterator in which value must be appended
request_msgmessage that request property
errorif a error happen you must set a message error to be send caller
Returns
EINA_TRUE if success
Note
request_msg and error arguments are only different from NULL when a client request a property with Properties.Get or Properties.GetAll. Upon calls to eldbus_service_property_changed(), this callback will also be called. It's a mistake to return an error in this case because if a property changed, it must have a new value set and it should be able to be read.
typedef Eldbus_Message*(* Eldbus_Property_Set_Cb) (const Eldbus_Service_Interface *iface, const char *propname, Eldbus_Message_Iter *iter, const Eldbus_Message *input_msg)

Callback function to set property value from message.

Parameters
ifaceinterface of property
propnamename of property
input_msgmessage call where you have to get value
Returns
Message of response, could be a simple method_return, error or NULL to send response later.

Function Documentation

Eldbus_Service_Interface* eldbus_service_interface_register ( Eldbus_Connection conn,
const char *  path,
const Eldbus_Service_Interface_Desc desc 
)

Register an interface in the given path and connection.

Parameters
connwhere the interface should listen
pathobject path
descdescription of interface
Returns
Interface

References _Eldbus_Service_Interface_Desc::default_get, _Eldbus_Service_Interface_Desc::default_set, eina_array_free(), eina_hash_population(), EINA_TRUE, _Eldbus_Service_Interface_Desc::interface, _Eldbus_Service_Interface_Desc::methods, _Eldbus_Service_Interface_Desc::properties, and _Eldbus_Service_Interface_Desc::signals.

void eldbus_service_interface_unregister ( Eldbus_Service_Interface *  iface)

Unregister a interface.

Note: This doesn't unregister the object path if interface count reaches 0. Use eldbus_service_object_unregister() to unregister the object.

References eina_hash_del(), and EINA_TRUE.

Eina_Bool eldbus_service_signal_emit ( const Eldbus_Service_Interface *  iface,
unsigned int  signal_id,
  ... 
)

Emit a signal handler of the interface with non-complex types.

Each signal handler have a internal id, the first signal handler of interface is = 0 the second = 1 and go on.

Parameters
ifaceinterface of the signal
signal_idid of signal
...values that will be send on signal

References EINA_TRUE, eldbus_message_arguments_vappend(), eldbus_service_signal_new(), and eldbus_service_signal_send().

Eldbus_Message* eldbus_service_signal_new ( const Eldbus_Service_Interface *  iface,
unsigned int  signal_id 
)

Create signal message.

Each signal handler have a internal id, the first signal handler of interface is = 0 the second = 1 and go on. This function is used when the signal has complex types.

Parameters
ifaceinterface of the signal
signal_idid of signal

Referenced by eldbus_service_signal_emit().

Eina_Bool eldbus_service_signal_send ( const Eldbus_Service_Interface *  iface,
Eldbus_Message signal_msg 
)

Send a signal message.

On success this will call eldbus_message_unref() on the

Parameters
signal_msg,whichis the intended behavior in 99% of the cases. Remember to increment the refcount if you want to keep it alive.

References EINA_TRUE.

Referenced by eldbus_service_signal_emit().

void eldbus_service_object_data_set ( Eldbus_Service_Interface *  iface,
const char *  key,
const void *  data 
)

Store data at object path, this data can be obtained from all interfaces of the same object.

Parameters
ifaceinterface that belong to the object path where data will be stored
keyto identify data
data
void* eldbus_service_object_data_get ( const Eldbus_Service_Interface *  iface,
const char *  key 
)

Get data stored in object path.

Parameters
ifaceinterface that belongs to the object path where data are stored
keythat identify data
Returns
pointer to data if found otherwise NULL
void* eldbus_service_object_data_del ( Eldbus_Service_Interface *  iface,
const char *  key 
)

Del data stored in object path.

Parameters
ifaceinterface that belongs to the object path where data are stored
keythat identify data
Returns
pointer to data if found otherwise NULL
Eina_Bool eldbus_service_property_changed ( const Eldbus_Service_Interface *  iface,
const char *  name 
)

Add property to list of changed properties A DBus.PropertiesChanged signal will be sent in an idler with all properties that have changed.

Parameters
ifaceInterface containing the changed property
nameProperty name

References ecore_idler_add(), eina_array_new(), and eina_hash_find().

Eina_Bool eldbus_service_object_manager_attach ( Eldbus_Service_Interface *  iface)

Attach ObjectManager interface.

Parameters
ifaceObjectManager will be attach in object path of this interface.
Returns
EINA_TRUE if success

References ecore_idler_del(), EINA_FALSE, eina_hash_add(), eina_hash_find(), and EINA_TRUE.

Eina_Bool eldbus_service_object_manager_detach ( Eldbus_Service_Interface *  iface)

Detach ObjectManager interface.

Parameters
ifaceObjectManager of object path of this interface will be detach.
Returns
EINA_TRUE if success

Flush the iface_add/removed of all children objects that this object is the ObjectManager

References eina_hash_del(), EINA_INLIST_FOREACH, and EINA_TRUE.