Data Structures | Macros | Typedefs | Functions
Service

Data Structures

struct  _Eldbus_Arg_Info
 
struct  _Eldbus_Method
 
struct  _Eldbus_Method2
 
struct  _Eldbus_Signal
 
struct  _Eldbus_Property
 
struct  _Eldbus_Service_Interface_Desc
 
struct  _Eldbus_Service_Interface_Desc2
 

Macros

#define ELDBUS_METHOD_FLAG_DEPRECATED   1
 
#define ELDBUS_METHOD_FLAG_NOREPLY   (1 << 1)
 
#define ELDBUS_METHOD_FLAG_HAS_DATA   (1 << 2)
 
#define ELDBUS_SIGNAL_FLAG_DEPRECATED   1
 
#define ELDBUS_PROPERTY_FLAG_DEPRECATED   1
 
#define ELDBUS_INTERFACE_DESCRIPTOR_VERSION   2
 
#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 Eldbus_Message *(* Eldbus_Method_Data_Cb) (void *data, 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_Method2 Eldbus_Method2
 
typedef struct _Eldbus_Signal Eldbus_Signal
 
typedef struct _Eldbus_Property Eldbus_Property
 
typedef struct _Eldbus_Service_Interface_Desc Eldbus_Service_Interface_Desc
 
typedef struct _Eldbus_Service_Interface_Desc2 Eldbus_Service_Interface_Desc2
 

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...
 
Eldbus_Service_Interface * eldbus_service_interface_fallback_register (Eldbus_Connection *conn, const char *path, const Eldbus_Service_Interface_Desc *desc)
 Register a fallback interface handler for a given subsection of the object hierarchy. More...
 
Eldbus_Service_Interface * eldbus_service_interface_register2 (Eldbus_Connection *conn, const char *path, const Eldbus_Service_Interface_Desc2 *desc)
 Register an interface in the given path and connection. More...
 
Eldbus_Service_Interface * eldbus_service_interface_fallback_register2 (Eldbus_Connection *conn, const char *path, const Eldbus_Service_Interface_Desc2 *desc)
 Register a fallback interface handler for a given subsection of the object hierarchy. 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. More...
 
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

◆ ELDBUS_ARGS

#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

◆ Eldbus_Property_Get_Cb

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.

◆ Eldbus_Property_Set_Cb

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_register()

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 EINA_FALSE.

◆ eldbus_service_interface_fallback_register()

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

Register a fallback interface handler for a given subsection of the object hierarchy.

Note: Use eldbus_service_interface_unregister() to unregister a interface.

Parameters
connwhere the interface should listen
patha '/' delimited string of path elements
descdescription of interface
See also
eldbus_service_interface_unregister()
Since
1.9
Returns
Interface

References EINA_TRUE.

◆ eldbus_service_interface_register2()

Eldbus_Service_Interface* eldbus_service_interface_register2 ( Eldbus_Connection conn,
const char *  path,
const Eldbus_Service_Interface_Desc2 desc 
)

Register an interface in the given path and connection.

This extended register function allows the registration of stateful methods, with void* data.

Note: Use eldbus_service_interface_unregister() to unregister a interface.

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

References EINA_FALSE, and _Eldbus_Service_Interface_Desc2::version.

◆ eldbus_service_interface_fallback_register2()

Eldbus_Service_Interface* eldbus_service_interface_fallback_register2 ( Eldbus_Connection conn,
const char *  path,
const Eldbus_Service_Interface_Desc2 desc 
)

Register a fallback interface handler for a given subsection of the object hierarchy.

This extended register function allows the registration of stateful methods, with void* data.

Note: Use eldbus_service_interface_unregister() to unregister a interface.

Parameters
connwhere the interface should listen
patha '/' delimited string of path elements
descdescription of interface
See also
eldbus_service_interface_unregister()
Since
1.11
Returns
Interface

References EINA_TRUE, and _Eldbus_Service_Interface_Desc2::version.

◆ eldbus_service_interface_unregister()

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.

Parameters
ifaceinterface to unregister

References eina_hash_del(), and EINA_TRUE.

◆ eldbus_service_object_unregister()

void eldbus_service_object_unregister ( Eldbus_Service_Interface *  iface)

Unregister all interfaces of the object path that this interface belongs and the object path.

Parameters
ifaceinterface to unregister

References eldbus_connection_free_cb_del().

◆ eldbus_service_signal_emit()

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
Returns
EINA_TRUE if success

References eina_array_count(), eina_array_data_get(), EINA_FALSE, EINA_SAFETY_ON_FALSE_RETURN_VAL, EINA_SAFETY_ON_NULL_RETURN_VAL, EINA_TRUE, eldbus_message_arguments_vappend(), eldbus_message_unref(), eldbus_service_signal_new(), and eldbus_service_signal_send().

◆ eldbus_service_signal_new()

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
Returns
EINA_TRUE if success

References eina_array_count(), EINA_SAFETY_ON_FALSE_RETURN_VAL, and eldbus_message_signal_new().

Referenced by eldbus_service_signal_emit().

◆ eldbus_service_signal_send()

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 signal_msg, which is the intended behavior in 99% of the cases. Remember to increment the refcount if you want to keep it alive.

Parameters
ifaceinterface of the signal
signal_msgmessage of signal
Returns
EINA_TRUE if success

References EINA_FALSE, EINA_SAFETY_ON_NULL_RETURN_VAL, and EINA_TRUE.

Referenced by eldbus_service_signal_emit().

◆ eldbus_service_object_data_set()

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

References EINA_SAFETY_ON_NULL_RETURN.

◆ eldbus_service_object_data_get()

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

References EINA_SAFETY_ON_NULL_RETURN_VAL.

◆ eldbus_service_object_data_del()

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

References EINA_SAFETY_ON_NULL_RETURN_VAL.

◆ eldbus_service_property_changed()

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
Returns
EINA_TRUE if success

References ecore_idle_enterer_add(), eina_array_new(), eina_array_push(), EINA_FALSE, eina_hash_find(), and EINA_SAFETY_ON_NULL_RETURN_VAL.

◆ eldbus_service_object_manager_attach()

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_idle_enterer_del(), EINA_FALSE, eina_hash_add(), eina_hash_find(), and EINA_TRUE.

◆ eldbus_service_object_manager_detach()

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_FALSE, eina_hash_del(), EINA_INLIST_FOREACH, and EINA_TRUE.