From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 02/11] gdbus: Introduce G_DBUS_SIGNAL_FLAG_EXPERIMENTAL
Date: Fri, 28 Dec 2012 14:51:00 +0200 [thread overview]
Message-ID: <1356699069-5469-3-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1356699069-5469-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
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.
---
gdbus/gdbus.h | 8 +++++++-
gdbus/object.c | 19 ++++++++++++++++---
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
index 01ff9d4..edc1f53 100644
--- a/gdbus/gdbus.h
+++ b/gdbus/gdbus.h
@@ -100,7 +100,8 @@ enum GDBusMethodFlags {
};
enum GDBusSignalFlags {
- G_DBUS_SIGNAL_FLAG_DEPRECATED = (1 << 0),
+ G_DBUS_SIGNAL_FLAG_DEPRECATED = (1 << 0),
+ G_DBUS_SIGNAL_FLAG_EXPERIMENTAL = (1 << 1),
};
enum GDBusPropertyFlags {
@@ -208,6 +209,11 @@ struct GDBusSecurityTable {
.args = _args, \
.flags = G_DBUS_SIGNAL_FLAG_DEPRECATED
+#define GDBUS_EXPERIMENTAL_SIGNAL(_name, _args) \
+ .name = _name, \
+ .args = _args, \
+ .flags = G_DBUS_SIGNAL_FLAG_EXPERIMENTAL
+
void g_dbus_set_flags(int flags);
gboolean g_dbus_register_interface(DBusConnection *connection,
diff --git a/gdbus/object.c b/gdbus/object.c
index 89e2a75..13a183f 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -164,6 +164,12 @@ static void generate_interface_xml(GString *gstr, struct interface_data *iface)
for (signal = iface->signals; signal && signal->name; signal++) {
gboolean deprecated = signal->flags &
G_DBUS_SIGNAL_FLAG_DEPRECATED;
+ gboolean experimental = signal->flags &
+ G_DBUS_SIGNAL_FLAG_EXPERIMENTAL;
+
+ if (!(global_flags & G_DBUS_FLAG_ENABLE_EXPERIMENTAL) &&
+ experimental)
+ continue;
if (!deprecated && !(signal->args && signal->args->name))
g_string_append_printf(gstr,
@@ -1266,10 +1272,17 @@ static gboolean check_signal(DBusConnection *conn, const char *path,
}
for (signal = iface->signals; signal && signal->name; signal++) {
- if (!strcmp(signal->name, name)) {
- *args = signal->args;
- return TRUE;
+ if (strcmp(signal->name, name) != 0)
+ continue;
+
+ if (signal->flags & G_DBUS_SIGNAL_FLAG_EXPERIMENTAL) {
+ const char *env = g_getenv("GDBUS_EXPERIMENTAL");
+ if (g_strcmp0(env, "1") != 0)
+ break;
}
+
+ *args = signal->args;
+ return TRUE;
}
error("No signal named %s on interface %s", name, interface);
--
1.8.0.1
next prev parent reply other threads:[~2012-12-28 12:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-28 12:50 [PATCH BlueZ 00/11] Add experimental command line switch option Luiz Augusto von Dentz
2012-12-28 12:50 ` [PATCH BlueZ 01/11] gdbus: Introduce G_DBUS_METHOD_FLAG_EXPERIMENTAL Luiz Augusto von Dentz
2012-12-28 12:51 ` Luiz Augusto von Dentz [this message]
2012-12-28 12:51 ` [PATCH BlueZ 03/11] gdbus: Introduce G_DBUS_PROPERTY_FLAG_EXPERIMENTAL Luiz Augusto von Dentz
2012-12-28 12:51 ` [PATCH BlueZ 04/11] gdbus: Check if the interface being registered is valid Luiz Augusto von Dentz
2012-12-28 12:51 ` [PATCH BlueZ 05/11] gdbus: Call check_signals when sending signals with g_dbus_send_message Luiz Augusto von Dentz
2012-12-28 12:51 ` [PATCH BlueZ 06/11] gdbus: Introduce G_DBUS_FLAG_ENABLE_DEPRECATED Luiz Augusto von Dentz
2012-12-30 18:52 ` Marcel Holtmann
2012-12-28 12:51 ` [PATCH BlueZ 07/11] core: Add command line switch for enabling experimental interfaces Luiz Augusto von Dentz
2012-12-28 12:51 ` [PATCH BlueZ 08/11] core: Reuse --compat/-C switch for enabling deprecated interfaces Luiz Augusto von Dentz
2012-12-28 12:51 ` [PATCH BlueZ 09/11] media: Enable RegisterPlayer and UnregisterPlayer methods as experimental Luiz Augusto von Dentz
2012-12-28 12:51 ` [PATCH BlueZ 10/11] player: Enable MediaPlayer1 interface " Luiz Augusto von Dentz
2012-12-28 12:51 ` [PATCH BlueZ 11/11] AVRCP: Fix not checking for media_player_controller_create Luiz Augusto von Dentz
2012-12-30 19:02 ` [PATCH BlueZ 00/11] Add experimental command line switch option Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1356699069-5469-3-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).