Commit Graph

131 Commits

Author SHA1 Message Date
Luiz Augusto von Dentz dcf4ccb947 gdbus: Fix not calling property_changed callback
In case a property did not appear by the time proxy_added was called
property_changed has to be called if it appear latter otherwise the
application will be unaware of it.
2013-04-08 20:09:51 -07:00
Lucas De Marchi de4aa7266b gdbus: Use gcc builtin instead of g_atomic
g_atomic_* end up using G_STATIC_ASSERT, causing gcc 4.8 to yell due to
-Wunused-local-typedefs.

gdbus/client.c: In function ‘g_dbus_client_ref’:
/usr/include/glib-2.0/glib/gmacros.h:162:53: error: typedef ‘_GStaticAssertCompileTimeAssertion_2’ locally defined but not used [-Werror=unused-local-typedefs]
 #define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]
2013-04-08 20:07:37 -07:00
Tomasz Bursztyka 7b0b28bb41 gdbus: Always unreference the message in g_dbus_send_message()
A quick fix on g_dbus_send_message(), if check_signal() fails it returns
FALSE without unreferencing the message as it should. This patch fixes
it.
2013-02-23 11:50:16 +01:00
Denis Kenzior 1d4d3f1fb9 gdbus: Add g_dbus_proxy_set_removed_watch 2013-02-14 08:47:10 -06:00
Vinicius Costa Gomes f93a6a2d06 gdbus: Fix missing PropertiesChanged signal
If D-Bus ObjectManager is not supported, InterfacesAdded signal
checking needs to be ignored otherwise PropertiesChanged signal
will never be sent.
2013-02-14 15:17:39 +01:00
Marcel Holtmann 8910e64f84 gdbus: Don't call property changed callback during client init
When the client uses ObjectManager to init properties, do not call
property changed callbacks. They should only be called once the proxy
added has been successfully signaled since the proxy itself provides
a full copy of available properties.
2013-02-11 20:22:42 +01:00
Johan Hedberg 0b1694f4ba gdbus: Fix unpublished interface signal emission
If we haven't published an interface yet (i.e. it's in the data->added
list), we should just ignore any property changed indications as the
values for the properties will anyway be part of the InterfacesAdded
signal.
2013-02-01 22:06:14 +01:00
Marcel Holtmann abb54f4aa5 gdbus: Check for valid path before handling properties 2013-01-20 18:45:56 -08:00
Anderson Lizardo 45bc35e534 gdbus: Fix memory leak on properties_set()
The pointer returned by dbus_message_iter_get_signature() must be freed
with dbus_free().

Fixes this memory leak:

==1857== 16 bytes in 1 blocks are definitely lost in loss record 104 of
251
==1857==    at 0x402BF52: realloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==1857==    by 0x415E286: dbus_realloc (in
/lib/i386-linux-gnu/libdbus-1.so.3.5.8)
==1857==    by 0x415E70B: ??? (in
/lib/i386-linux-gnu/libdbus-1.so.3.5.8)
==1857==    by 0x415F17B: ??? (in
/lib/i386-linux-gnu/libdbus-1.so.3.5.8)
==1857==    by 0x414CB33: dbus_message_iter_get_signature (in
/lib/i386-linux-gnu/libdbus-1.so.3.5.8)
==1857==    by 0x8053239: properties_set (object.c:899)
==1857==    by 0x5FFFFF: ???
==1857==
2013-01-06 14:49:03 -08:00
Marcel Holtmann 3143ea126e gdbus: Check signature of property value before calling setter 2013-01-05 00:45:35 -08:00
Lucas De Marchi a39520e1be gdbus: Don't include just added interfaces in GetManagedObjects
If we received a call to ObjectManager.GetManagedObject we should not
include in the response the interfaces in data->added. This is because
it's not guaranteed that those interfaces will trigger an
InterfacesAdded signal, which is the case if the interface is removed in
the same mainloop iteration.
2013-01-03 21:34:18 -08:00
Lucas De Marchi 7482480294 gdbus: Simplify generated introspection
The generated introspection is not supposed to be read as is by human,
so there's no point in printing the indentation or writing more code to
use auto-close tags.

If it's desired to read the raw xml file, user can always use other
tools to transform the output such as "xmllint --format".

This also fixes a missing </property> when property is deprecated.
2013-01-03 21:34:18 -08:00
Marcel Holtmann 7738e3a92c gdbus: Hold client reference during get name owner reply 2013-01-02 07:37:35 -08:00
Luiz Augusto von Dentz a559a4993b gdbus: Call check_signals when sending signals with g_dbus_send_message
If message passed to g_dbus_send_message is a signal verify if it is a
valid and there really exists an interface with respective signal name.
2012-12-30 10:49:27 -08:00
Luiz Augusto von Dentz 9ed7b17ca3 gdbus: Check if the interface being registered is valid
This prevent registering interfaces that are empty or have all members
marked as experiemental.
2012-12-30 10:49:27 -08:00
Luiz Augusto von Dentz 5f8485bcc1 gdbus: Introduce G_DBUS_PROPERTY_FLAG_EXPERIMENTAL
This flag can be used to mark properties as experimental, marked
properties are disabled by default and can be enabled by setting
G_DBUS_FLAG_ENABLE_EXPERIMENTAL using g_dbus_set_flags.
2012-12-30 10:49:27 -08:00
Luiz Augusto von Dentz 4b14fcc9a1 gdbus: Introduce G_DBUS_SIGNAL_FLAG_EXPERIMENTAL
This flag can be used to mark signals as experimental, marked
signals are disabled by default and can be enabled by setting
G_DBUS_FLAG_ENABLE_EXPERIMENTAL using g_dbus_set_flags.
2012-12-30 10:49:27 -08:00
Luiz Augusto von Dentz 4b50c0bd05 gdbus: Introduce G_DBUS_METHOD_FLAG_EXPERIMENTAL
This flag can be used to mark methods as experimental, marked
methods are disable by default and can be enabled by setting
G_DBUS_FLAG_ENABLE_EXPERIMENTAL using g_dbus_set_flags.
2012-12-30 10:49:27 -08:00
Marcel Holtmann 37a54d0433 gdbus: Include changed properties only once per signal 2012-12-30 00:58:59 -08:00
Marcel Holtmann 2f3da9cdf4 gdbus: Update properties on D-Bus client re-connections 2012-12-29 14:49:38 -08:00
Marcel Holtmann f9f6536b2b gdbus: Add function to manually refresh properties 2012-12-29 14:49:38 -08:00
Marcel Holtmann 816c028a94 gdbus: Add support for proxy property change notifications 2012-12-29 14:49:38 -08:00
Marcel Holtmann d3899c7af6 gdbus: Fix handling of client connect/disconnect signals 2012-12-29 14:49:38 -08:00
Marcel Holtmann cdd1febd4d gdbus: Protect standalone proxy creation with client reference 2012-12-29 14:49:37 -08:00
Marcel Holtmann 9ba681ddcd gdbus: Use object manager only if callback functions are set 2012-12-27 23:59:19 -08:00
Marcel Holtmann 91e3369a38 gdbus: Use client service name and not hardcoded org.bluez 2012-12-27 23:59:19 -08:00
Marcel Holtmann 8bef871cff gdbus: Add support for creating D-Bus proxies without object manager 2012-12-27 23:59:19 -08:00
Marcel Holtmann d1bd840d2e gdbus: Avoid using g_ptr_array_new_full convenience function
The g_ptr_array_new_full function only got introduced with GLib 2.30
and to avoid requiring a newer GLib use g_ptr_array_set_free_func instead.
2012-12-22 12:09:58 -08:00
Marcel Holtmann fcab2080be gdbus: Increase the method call timeout to 5 minutes 2012-12-19 03:50:43 +01:00
Marcel Holtmann e7ca33f908 gdbus: Add helper for sending async error replies 2012-12-19 03:50:42 +01:00
Marcel Holtmann 5de077a604 gdbus: Fix race condition with creating duplicate client proxies 2012-12-19 03:50:42 +01:00
Marcel Holtmann 4a0cab2f85 gdbus: Fix issue with unref of client while parsing interfaces 2012-12-19 03:50:42 +01:00
Marcel Holtmann c3d3a3a661 gdbus: Fix issue with unref of client in connect handler 2012-12-19 03:50:42 +01:00
Marcel Holtmann 33ff02e3a4 gdbus: Add support for D-Bus client method calls 2012-12-19 03:50:42 +01:00
Marcel Holtmann 90c719f29c gdbus: Add callback support for handling property changes 2012-12-19 03:50:42 +01:00
Marcel Holtmann f40f27cd44 gdbus: Handle property changed signals and update property 2012-12-19 03:50:42 +01:00
Marcel Holtmann 64103f35a1 gdbus: Set property changed filter match rule for each proxy 2012-12-19 03:50:42 +01:00
Marcel Holtmann ec448e4d36 gdbus: Use a GPtrArray for the match rules 2012-12-19 03:50:42 +01:00
Marcel Holtmann 7ba21da7f3 gdbus: Add support for setting D-Bus client basic properties 2012-12-19 03:50:42 +01:00
Marcel Holtmann 37a3708928 gdbus: Deep copy of variants also requires a signature 2012-12-19 03:50:42 +01:00
Marcel Holtmann ada304fb01 gdbus: Add support for complex D-Bus client properties 2012-12-19 03:50:42 +01:00
Marcel Holtmann 8ec0dab7fa gdbus: Add support for D-Bus client properties 2012-12-19 03:50:42 +01:00
Marcel Holtmann b30177d961 gdbus: Add support for D-Bus client proxies 2012-12-19 03:50:42 +01:00
Marcel Holtmann 8d5bb26e43 gdbus: Add helper functions for simple D-Bus clients 2012-12-19 03:50:42 +01:00
Luiz Augusto von Dentz 4e95013040 gdbus: Add g_dbus_add_properties_watch function
Convenient function to create watches for D-Bus properties.
2012-11-30 09:59:34 +01:00
Lucas De Marchi 2e9bea7af6 gdbus: Don't automatically attach ObjectManager
Let each project attach the object manager interface instead of
registering it automatically.
2012-11-29 17:38:55 +01:00
Lucas De Marchi 959d23833f gdbus: Don't register DBus.Properties with no properties
Delay registering DBus.Properties interface until the moment there are
properties on that path. This is needed for objects that currently don't
expose any property to not export the interface.
2012-11-29 17:38:55 +01:00
Szymon Janc c091a5c5e7 gdbus: Remove not needed NULL pointer checks
g_strdup returns NULL if argument passed is NULL and there is no need
to double check that.
2012-11-26 12:59:48 +01:00
Syam Sidhardhan 682bf79a83 gdbus: Replace leading spaces with tabs
Trivial formatting fix.
2012-11-26 12:59:30 +01:00
Syam Sidhardhan 0581ec199c gdbus: Fix compilation error due to missing #defines
Since these are simple #define strings, we are defining it here
instead of upgrading to D-Bus 1.5 or later.

Log:
  CC     gdbus/object.o
gdbus/object.c: In function ‘properties_set’:
gdbus/object.c:876:7: error: ‘DBUS_ERROR_UNKNOWN_PROPERTY’ undeclared
 (first use in this function)
gdbus/object.c:876:7: note: each undeclared identifier is reported
 only once for each function it appears in
gdbus/object.c:881:6: error: ‘DBUS_ERROR_PROPERTY_READ_ONLY’
 undeclared (first use in this function)
make[1]: *** [gdbus/object.o] Error 1
make: *** [all] Error 2
2012-11-26 12:59:16 +01:00