Commit Graph

228 Commits

Author SHA1 Message Date
José Roberto de Souza b9c1dfdf03 eldbus: Add timeout parameter to eldbus_proxy_send_and_block()
As all other send functions have, we need to have here.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2014-12-05 09:53:08 -05:00
José Roberto de Souza 8b193c145e eldbus: Fix _eldbus_connection_send_and_block()
Some problems with the actual implementation:
- the reply should not be writable, as it can only be read.
- if an error happen dbus_connection_send_with_reply_and_block()
will return NULL so we need check before use it
- all other send calls remove one reference of the message

Now also it is creating a error message, so the caller can know why it fail.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2014-12-05 09:53:08 -05:00
Chris Michael e62dfdd79e eldbus: Add actual API function code for eldbus_proxy_send_and_block
Summary: This adds the actual code to send a dbus message and block
while waiting for a reply.

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2014-12-04 09:49:02 -05:00
Chris Michael 34dd248551 eldbus: Add code for _eldbus_connection_send_and_block function
Summary: This function will send a message to dbus and block while
waiting for a reply

NB: This is needed for our 'port to libinput', and for our 'opening up the
drm card without systemd' efforts

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2014-12-04 09:49:02 -05:00
Chris Michael 14332f5d0d eldbus: Add API function declaration for eldbus_proxy_send_and_block
Summary: This adds a public facing API function to make dbus calls
which will block and wait for a reply. This is needed for a couple of
use cases in our Wayland efforts (libinput, etc).

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2014-12-04 09:49:02 -05:00
Chris Michael 7e7a715164 eldbus: Add function prototype for send_and_block
Summary: This just adds the function prototype into the eldbus private
header. It will be used in the new proxy function
"eldbus_proxy_send_and_block"

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2014-12-04 09:49:02 -05:00
Pierre Le Magourou ebaba7f20a eldbus: Fix wrong comments. 2014-10-21 23:42:03 +02:00
Pierre Le Magourou f50f321562 eldbus: update missing eldbus_proxy API documentation. 2014-10-20 18:32:28 +02:00
Pierre Le Magourou a86a8e1e4a eldbus: update missing eldbus_pending.h API documentation. 2014-10-20 18:32:28 +02:00
Pierre Le Magourou 321f6482cd eldbus: update missing eldbus_object API documentation. 2014-10-20 18:32:28 +02:00
Pierre Le Magourou de5e028d7d eldbus: update missing eldbus_message API documentation. 2014-10-20 18:32:28 +02:00
Pierre Le Magourou 11b875b6ce eldbus: update missing eldbus_freedesktop.h API documentation. 2014-10-20 18:32:28 +02:00
Pierre Le Magourou 163773ff9f eldbus: update missing API documentation. 2014-10-20 18:32:27 +02:00
Pierre Le Magourou 65db5e981b eldbus: add missing API documentation in Eldbus.h. 2014-10-20 18:32:27 +02:00
Nicolas Aguirre f15d462737 eldbus: add documentation for Eldbus_Version structure. 2014-10-20 18:02:10 +02:00
Stefan Schmidt 7d4c063fbb eldbus: Only call va_end() if the signature does not match after rewrite
If git log is right this is patch number 4 for this CID. Lets hope we handle all
cases for starting and ending va now.

CID 1039883
2014-09-04 10:35:05 +02:00
Carsten Haitzler 7957721849 eldbus - fix missing varags va_end
fix CID 1039883
2014-09-01 19:40:47 +09:00
Carsten Haitzler 463f5a29f9 eldbus - fix varargs usage - missing va_end on return
this fixes CID 1039883
2014-08-25 11:50:36 +09:00
Carsten Haitzler e263af08c9 eldbus - fix varargs missing end in iter get and next
there was an error return handler that would return without doing
va_end(). coverity picked this up. this fixes CID 1039883
2014-08-14 18:53:40 +09:00
Wonguk Jeong f796679af6 eldbus: do not ignore numeric "0" in property_set
"0" value was considered to be error even if signature was numeric

@fix
2014-08-10 22:55:38 +02:00
Felipe Magno de Almeida 835b8756ec Fixes ABI breakage in Eldbus for use with C++ Eldbus
Summary:
This fixes the breakage when Eldbus_Service_Interface_Desc added a
wrongfully methods2 field to a class that is allocated by the user.

This patch adds the respective eldbus_service_interface_register2 and
eldbus_service_interface_fallback_register2 for registration of
Eldbus_Service_Interface_Desc2 which is now versioned. So future the
functions can be backwards compatible and the struct be forward
compatible and leaves the Eldbus_Service_Interface_Desc and
eldbus_service_interface_register and
eldbus_service_interface_fallback_register intact as it was in EFL
1.10.

This fixes T1408

Reviewers: cedric, stefan_schmidt, raster

Reviewed By: raster

Subscribers: cedric

Maniphest Tasks: T1408

Differential Revision: https://phab.enlightenment.org/D1188
2014-07-15 08:01:14 +09:00
Carsten Haitzler fc2c00c67b fix eldbus warnings 2014-07-08 12:45:44 +09:00
Felipe Magno de Almeida 1baf9e4825 eldbus: Fixes ABI break in Eldbus_Method with appended void* data
Summary:
Removed the void* data variable from Eldbus_Method and created another
struct that has the void* data and added an array of Eldbus_Method2 in
the descriptor for the Eldbus_Service_Interface_Desc and making the
appropriate modifications in the implementation to use both
descriptions.

Reviewers: cedric, stefan_schmidt, raster

CC: cedric

Maniphest Tasks: T1408

Differential Revision: https://phab.enlightenment.org/D1139
2014-07-08 11:57:08 +09:00
Felipe Magno de Almeida 30df128be5 eldbus-cxx: Implementation of eldbus C++ API
Summary:
Applications can:

  void method_callback(void* data, const Eldbus_Service_Interface* iface,
                       const Eldbus_Message* message);
  struct { ... } data_struct;

  Eldbus_Method methods[] =
   {
     "method1", ELDBUS_ARGS("b", "bool"), ELDBUS_ARGS("b", "bool"), ELDBUS_METHOD_FLAG_HAS_DATA
     , (Eldbus_Method_Cb)&method_callback, &data_struct
   };

   And method_callback will be called with data parameter pointing to data_struct global object.

Also, Eldbus-cxx supports registering an interface passing a lambda or
function object as method. For example:

  edb::service_interface iface = edb::service_interface_register
    (c, path, interface
     , es::method("SendStringAndBool"
                  , [expected_string, expected_bool] (std::string const& n, bool b
                                                      , bool* out)
                  {
                    std::cout << "Running SendStringAndBool" << std::endl;
                    ck_assert(n == expected_string);
                    ck_assert(b == expected_bool);
                    *out = b;
                    return n;
                  }
                  , es::ins<std::string, bool>("string", "bool")
                  , es::outs<std::string, bool>("string", "bool")
                  )
    );

When a request for "SendStringAndBool" with the proper signature is
called, executes the lambda and replies with the return value and
its bool* out parameter value.

Reviewers: cedric, woohyun, raster

CC: savio, cedric

Differential Revision: https://phab.enlightenment.org/D1052
2014-07-03 16:28:23 +09:00
Jérémy Zurcher f8c2c57406 do not use EINA_FALSE instead of NULL 2014-05-07 17:45:11 +02:00
Carsten Haitzler 86d9b4ed71 Registers a fallback handler for a given subsection of the object hierarchy.
Summary:
Goal of this patch is cover in Eldbus library function dbus_connection_register_fallback.
http://dbus.freedesktop.org/doc/api/html/group__DBusConnection.html#gac4473b37bfa74ccf7459959d27e7bc59

Reviewers: stanluk, raster

Reviewed By: raster

Differential Revision: https://phab.enlightenment.org/D479
2014-01-23 15:45:22 +09:00
Daniel Juyung Seo 76d8532b54 efl: Unified eina critical manro to CRI.
Being annoyed by different types of eina critical macros - CRI, CRIT,
 CRITICAL -, I concluded to unify them to one. Discussed on IRC and
 finally, CRI was chosen to meet the consistency with other macros -
 ERR, WRN, INF, DBG - in terms of the number of characters.
If there is any missing bits, please let me know.
2013-12-26 12:27:13 +09:00
Cedric BAIL 0a6ce62bb2 eldbus: don't do a double initialization due to ecore module using eldbus now. 2013-12-23 11:24:49 +09:00
Sebastian Dransfeld 6f56406f59 eldbus: Check return value of eina_value_pget
If eina_value_pget returns FALSE, we shouldn't continue.

Fixes CID 1039685
2013-12-07 21:11:33 +01:00
Sebastian Dransfeld 2b9710431e eldbus: use alloca to allocate local mem
Since we free the allocated mem some lines down, we can use alloca. This
also fixes CID 1039179
2013-12-07 21:11:33 +01:00
Sebastian Dransfeld 831d17a8e8 eldbus: unref msg on error
If we return here, the msg isn't sent, so unref it.

Fixes CID 1039178
2013-12-07 21:11:33 +01:00
Sebastian Dransfeld c5caea03e3 eldbus: on error unref msg
This is done on all other errors, EINA_SAFETY macros ain't no silver
bullet.

Fixes CID 1039177
2013-12-07 21:11:33 +01:00
Sebastian Dransfeld f950e7990f eldbus: free allocated mem on error
Fixes CID 1039177
2013-12-07 21:11:33 +01:00
Sebastian Dransfeld 1d1feea572 eldbus: Check return value of _type_size
_type_size could return 0, which would fail in the modulo call next.
Check for 0, and return.

Fixes CID 1039436
2013-12-07 21:11:32 +01:00
Carsten Haitzler 0b605c5daa Eldbus: added function for getting bus unique name
Summary:
Hello guys,

We are now working on a accessibility support for elementary (ATSPI2) and we need following function to correctly register application.

Reviewers: cedric, raster, lucasdemarchi

Reviewed By: raster

Differential Revision: https://phab.enlightenment.org/D327
2013-12-02 14:57:07 +09:00
José Roberto de Souza 64687356b0 eldbus: Fix crash caused when the object of an monitored proxy is deleted
This happen because proxy was already freed and we try print some information
about the proxy in error message.

This fix: https://phab.enlightenment.org/T543
2013-11-29 17:21:14 -02:00
José Roberto de Souza b25fd77827 Revert "workaround for T543"
This reverts commit b663b5b8c7.
2013-11-29 16:39:10 -02:00
Mike Blumenkrantz b663b5b8c7 workaround for T543
this prevents crashing in efm:u2, but is really bad and needs to be fixed more competently before release
2013-11-21 14:44:43 -05:00
Carsten Haitzler b07c0a76ce alpha1 release autofoo/build tree work to pass distcheck and actually work 2013-11-04 18:33:35 +09:00
José Roberto de Souza 2266bf8904 eldbus: Use FDO error message to timeout 2013-09-19 15:47:22 -03:00
José Roberto de Souza 932a7a00cd eldbus: Check if interface of signal match with signal handler
Thanks fgau for pointing this issue.
2013-09-02 17:07:16 -03:00
José Roberto de Souza bcba4779c8 eldbus: Add timeout message error as a macro 2013-09-02 16:14:47 -03:00
José Roberto de Souza 356a4aa8e9 eldbus: Add eldbus_object_manager_interfaces_added/removed() 2013-09-02 16:14:47 -03:00
José Roberto de Souza 928f0e4f83 eldbus: Make properties_monitor() return a boolean indicating if props are already cached 2013-09-02 16:14:47 -03:00
José Roberto de Souza 8b69231897 eldbus: Add a new proxy event to notify when properties are cached 2013-09-02 16:14:43 -03:00
José Roberto de Souza 091c5425c6 eldbus: Handle correclty the last unref of a object path or conn in service callback
This allow user remove the last reference of service object path or last
last reference of connection be removed inside of a method callback.
2013-08-26 16:11:31 -03:00
José Roberto de Souza 547313ece9 eldbus: Send all object manager signals of all childrens before delete path or detach object manager 2013-08-26 15:17:02 -03:00
José Roberto de Souza 74bf97600f eldbus: ecore_idler_del() return is the data 2013-08-26 15:16:53 -03:00
José Roberto de Souza 9b49791de0 eldbus: Only a explicit call should unregister a object path 2013-08-26 15:16:43 -03:00
José Roberto de Souza 97ad61df93 eldbus: Empty list of interfaces add/del if there is no parent object manager 2013-08-26 15:16:33 -03:00
José Roberto de Souza d1d298e4c2 eldbus: Use EINA_LIST_FREE instead of EINA_LIST_FOREACH to send interfaces add 2013-08-26 15:16:26 -03:00
José Roberto de Souza 36b71d867c eldbus: Send property changed signals before close connection 2013-08-26 15:16:18 -03:00
José Roberto de Souza 26a6b01369 eldbus: Correctly append name of interface removed 2013-08-23 16:05:18 -03:00
José Roberto de Souza fe6a51f7e9 eldbus: Mark introspection of parent object as dirty when adding a child object 2013-08-23 16:05:06 -03:00
José Roberto de Souza 914e05c2ad eldbus: Improve error message when connection get fail 2013-08-15 14:46:30 -03:00
Stefan Schmidt d7d347da0a eldbus: Fix copy and paste error.
We are in the remove case here. The interfaces_added looks like a missed change
from the copy and paste of the add case.

CID 1039671
2013-08-09 10:27:54 +01:00
José Roberto de Souza cbd0ccbbbe eldbus: Check if property_get_all() returned a error before read properties 2013-07-25 14:22:40 -03:00
José Roberto de Souza 353de50898 eldbus: Correclty check if user already create a object manager iface to object
CID: 1039421
2013-07-08 13:52:12 -03:00
José Roberto de Souza 8f69b20a6d eldbus: Remove unnecessary function - _eldbus_connection_unref()
Neither internal function call this function.
2013-07-05 16:08:06 -03:00
José Roberto de Souza 20d9e486a8 eldbus: Handle removal of last reference of connection inside of callback 2013-07-05 16:08:01 -03:00
Carsten Haitzler bf482c7742 eldbus - better fix for dbus_conn becoming null in dispatch 2013-07-04 10:56:43 +09:00
Carsten Haitzler bdd57af113 eldbus - only unref client conns that are not null after dispatch 2013-07-04 08:41:45 +09:00
Eduardo Lima (Etrunko) 2e7479f8db eldbus: Missing dbus_connection_unref() in error path
Signed-off-by: Eduardo Lima (Etrunko) <eduardo.lima@intel.com>
2013-06-27 17:31:22 -03:00
Eduardo Lima (Etrunko) f6295c5828 eldbus: Call dbus_bus_register() for TYPE_ADDRESS connections
From D-Bus documentation:

http://dbus.freedesktop.org/doc/api/html/group__DBusBus.html

dbus_bus_register():

    If you open a bus connection with dbus_connection_open() or
    dbus_connection_open_private() you will have to dbus_bus_register()
    yourself, or make the appropriate registration method calls yourself.

Signed-off-by: Eduardo Lima (Etrunko) <eduardo.lima@intel.com>
2013-06-27 17:24:46 -03:00
Eduardo Lima (Etrunko) 6f255a7ccc eldbus: Add proxy call to org.freedesktop.DBus.Hello
Signed-off-by: Eduardo Lima (Etrunko) <eduardo.lima@intel.com>
2013-06-27 16:43:24 -03:00
Carsten Haitzler 29b3c80385 eldbus: error message iters should be initted as readonly. 2013-06-22 20:15:44 +09:00
Mike Blumenkrantz 5ca64106a2 more descriptive error message in eldbus when property fetching fails 2013-06-20 08:13:55 +01:00
José Roberto de Souza 274799cb08 eldbus: Fix crash when eldbus is shutdown and we have a live connection of type address
Also show info about each connection of type address live.
2013-06-10 11:30:49 -03:00
Eduardo Lima (Etrunko) 4fc274253d eldbus: Welcome two new APIs and one connection type
eldbus_address_connection_get() and eldbus_private_address_connection_get()
are similar to the respective _connection_get() counterparts, but enables
users to connect to buses other than system or session.

The new type introduced for those connections is ELDBUS_CONNECTION_TYPE_ADDRESS
and they require an additional address parameter, which will be passed to
dbus_connection_open().

Signed-off-by: Eduardo Lima (Etrunko) <eduardo.lima@intel.com>
2013-05-28 09:42:29 -03:00
Eduardo Lima (Etrunko) 1ac40b5502 eldbus: New internal function _eldbus_connection_free()
This is actually a split on the _eldbus_connection_unref() function, that
will be called either when the refcount reaches 0 or to force the deletion
of an Eldus_Connection.

The second use case will be contemplated in a following patch.

Signed-off-by: Eduardo Lima (Etrunko) <eduardo.lima@intel.com>
2013-05-28 09:42:29 -03:00
Eduardo Lima (Etrunko) fb0dc85bc3 eldbus: Reset value of fd_handler after deletion
Signed-off-by: Eduardo Lima (Etrunko) <eduardo.lima@intel.com>
2013-05-28 09:42:29 -03:00
Jérémy Zurcher 57b2cb5239 eldbus_service: explicitly set flags to 0 in static _Signal and _Method structs 2013-05-07 22:16:37 +02:00
José Roberto de Souza 12855e5fe7 eldbus: Fix interface_unregister() 2013-05-04 10:38:55 -03:00
José Roberto de Souza 9e4dc299a7 eldbus: Fix eldbus_service_*_get() functions over FDO interfaces 2013-05-04 10:38:55 -03:00
José Roberto de Souza d6c7732931 eldbus: Fix eldbus_pending_destination_get(), it was returnig the method name 2013-05-04 10:38:55 -03:00
Lucas De Marchi 49f16237c0 eldbus: Add EINA_ARG_NONNULL to new API function 2013-05-04 10:38:55 -03:00
José Roberto de Souza dd25e02d5c eldbus: Add eldbus_message_iter_fixed_array_append() 2013-05-04 10:38:55 -03:00
Lucas De Marchi 4e3804041f Rename edbus->eldbus
git grep -l edbus2 | while read f; do sed -i 's/edbus2/eldbus/g' "$f"; done
find . -name '*edbus2*' -exec rename edbus2 eldbus {} \;

git grep -l "EDBUS" | while read f; do sed -i 's/EDBUS/ELDBUS/g' "$f"; done
git grep -l "EDBus" | while read f; do sed -i 's/EDBus/Eldbus/g' "$f"; done
git grep -l "edbus (v2)" | while read f; do sed -i 's/edbus (v2)/eldbus/g' "$f"; done
git grep -l "Edbus" | while read f; do sed -i 's/Edbus/Eldbus/g' "$f"; done
git grep -l "edbus" | while read f; do sed -i 's/edbus/eldbus/g' "$f"; done

find . -name '*edbus*' -exec rename edbus eldbus {} \;
find . -name '*EDBus*' -exec rename EDBus Eldbus {} \;
2013-04-23 12:36:29 -03:00