2012-05-16 23:33:00

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ v5 00/13] gdbus: Better D-Bus introspection

v5: only rebase

Message from v4:


This is v4 of this series. The biggest difference from v3 is that we are not
adding a decorated signature anymore. Instead we define the type GDBusArgInfo
and add fields in_args, out_args and args into the tables.

First 4 patches are the same as before and are independent from the others.

Patches 5, 6, 7, 8 and 9 are split like this because gdbus is used in projects
other than BlueZ, so the first 2 patches can be easily ported there.

Patches 10 and 11 add annotations, just as in v3.

Last 2 patches are minor fixes, because checking the same thing twice don't
make it a stronger check.


Lucas De Marchi (13):
gdbus: return if method signature is malformed
gdbus: do not call memset for terminating NUL
Constify GDBus method tables
Constify GDBus signal tables
gdbus: add argument info to methods and signals
Convert GDBus methods and signals to use GDBusArgInfo
gdbus: use GDBusArgInfo to generate introspection
gdbus: loop over args to check message signature
gdbus: remove signatures from tables
gdbus: add Deprecated annotation in introspection
gdbus: add Method.NoReply annotation in introspection
gdbus: do not check signature twice
adapter: do not check signature twice

attrib/client.c | 35 ++++++++----
audio/control.c | 33 +++++++----
audio/device.c | 23 +++++---
audio/gateway.c | 30 ++++++----
audio/headset.c | 93 +++++++++++++++++++------------
audio/media.c | 23 ++++++--
audio/sink.c | 37 ++++++------
audio/source.c | 24 ++++----
audio/telephony-dummy.c | 38 +++++++++----
audio/telephony-maemo5.c | 8 ++-
audio/transport.c | 30 +++++++---
gdbus/gdbus.h | 11 +++-
gdbus/object.c | 136 ++++++++++++++++++++++-----------------------
health/hdp.c | 69 ++++++++++++++++-------
input/device.c | 19 ++++---
network/connection.c | 23 +++++---
network/server.c | 11 +++-
plugins/dbusoob.c | 18 ++++--
plugins/service.c | 24 +++++---
proximity/monitor.c | 19 +++++--
proximity/reporter.c | 14 +++--
sap/sap-dummy.c | 18 ++++--
sap/server.c | 16 ++++--
serial/port.c | 17 ++++--
serial/proxy.c | 38 +++++++++----
src/adapter.c | 94 ++++++++++++++++++++-----------
src/device.c | 32 +++++++----
src/manager.c | 40 +++++++++----
thermometer/thermometer.c | 35 ++++++++----
29 files changed, 655 insertions(+), 353 deletions(-)

--
1.7.10.2



2012-05-16 23:43:23

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH BlueZ v5 09/13] gdbus: remove signatures from tables

Hi Lucas,

> attrib/client.c | 12 +++++-----
> audio/control.c | 18 +++++++--------
> audio/device.c | 13 +++++------
> audio/gateway.c | 16 ++++++-------
> audio/headset.c | 55 +++++++++++++++++++++------------------------
> audio/media.c | 8 +++----
> audio/sink.c | 25 +++++++++------------
> audio/source.c | 14 +++++-------
> audio/telephony-dummy.c | 18 +++++++--------
> audio/telephony-maemo5.c | 2 +-
> audio/transport.c | 10 ++++-----
> gdbus/gdbus.h | 3 ---
> gdbus/object.c | 2 +-

you can not intermix this. I want gdbus/ patches separated.

> diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
> index 610cb19..e9e8929 100644
> --- a/gdbus/gdbus.h
> +++ b/gdbus/gdbus.h
> @@ -91,8 +91,6 @@ typedef struct {
>
> typedef struct {
> const char *name;
> - const char *signature;
> - const char *reply;
> GDBusMethodFunction function;
> GDBusMethodFlags flags;
> unsigned int privilege;
> @@ -102,7 +100,6 @@ typedef struct {
>
> typedef struct {
> const char *name;
> - const char *signature;
> GDBusSignalFlags flags;
> const GDBusArgInfo *args;
> } GDBusSignalTable;

instead of removing these, why don't we make them NULL and start
using .function and .flags syntax for the method/signal tables as a
first step.

Regards

Marcel



2012-05-16 23:33:13

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ v5 13/13] adapter: do not check signature twice

Message signature is already checked in generic_message(), so there's no
need to check again in the callback.
---
src/adapter.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 071fac9..ba12de0 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1317,9 +1317,6 @@ static DBusMessage *list_devices(DBusConnection *conn,
DBusMessageIter array_iter;
const gchar *dev_path;

- if (!dbus_message_has_signature(msg, DBUS_TYPE_INVALID_AS_STRING))
- return btd_error_invalid_args(msg);
-
reply = dbus_message_new_method_return(msg);
if (!reply)
return NULL;
--
1.7.10.2


2012-05-16 23:33:12

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ v5 12/13] gdbus: do not check signature twice

Message signature is already checked in generic_message(), so there's no
need to check again in the callback.
---
gdbus/object.c | 5 -----
1 file changed, 5 deletions(-)

diff --git a/gdbus/object.c b/gdbus/object.c
index e7b118c..c17d635 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -174,11 +174,6 @@ static DBusMessage *introspect(DBusConnection *connection,
struct generic_data *data = user_data;
DBusMessage *reply;

- if (!dbus_message_has_signature(message, DBUS_TYPE_INVALID_AS_STRING)) {
- error("Unexpected signature to introspect call");
- return NULL;
- }
-
if (data->introspect == NULL)
generate_introspection_xml(connection, data,
dbus_message_get_path(message));
--
1.7.10.2


2012-05-16 23:33:11

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ v5 11/13] gdbus: add Method.NoReply annotation in introspection

---
gdbus/object.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdbus/object.c b/gdbus/object.c
index 1511e88..e7b118c 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -84,8 +84,10 @@ static void generate_interface_xml(GString *gstr, struct interface_data *iface)
for (method = iface->methods; method && method->name; method++) {
gboolean deprecated = method->flags &
G_DBUS_METHOD_FLAG_DEPRECATED;
+ gboolean noreply = method->flags &
+ G_DBUS_METHOD_FLAG_NOREPLY;

- if (!deprecated &&
+ if (!deprecated && !noreply &&
!(method->in_args && method->in_args->name) &&
!(method->out_args && method->out_args->name))
g_string_append_printf(gstr, "\t\t<method name=\"%s\"/>\n",
@@ -99,6 +101,9 @@ static void generate_interface_xml(GString *gstr, struct interface_data *iface)
if (deprecated)
g_string_append_printf(gstr, "\t\t\t<annotation name=\"org.freedesktop.DBus.Deprecated\" value=\"true\"/>\n");

+ if (noreply)
+ g_string_append_printf(gstr, "\t\t\t<annotation name=\"org.freedesktop.DBus.Method.NoReply\" value=\"true\"/>\n");
+
g_string_append_printf(gstr, "\t\t</method>\n");
}
}
--
1.7.10.2


2012-05-16 23:33:09

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ v5 09/13] gdbus: remove signatures from tables

---
attrib/client.c | 12 +++++-----
audio/control.c | 18 +++++++--------
audio/device.c | 13 +++++------
audio/gateway.c | 16 ++++++-------
audio/headset.c | 55 +++++++++++++++++++++------------------------
audio/media.c | 8 +++----
audio/sink.c | 25 +++++++++------------
audio/source.c | 14 +++++-------
audio/telephony-dummy.c | 18 +++++++--------
audio/telephony-maemo5.c | 2 +-
audio/transport.c | 10 ++++-----
gdbus/gdbus.h | 3 ---
gdbus/object.c | 2 +-
health/hdp.c | 24 ++++++++++----------
input/device.c | 9 ++++----
network/connection.c | 9 ++++----
network/server.c | 4 ++--
plugins/dbusoob.c | 7 +++---
plugins/service.c | 10 ++++-----
proximity/monitor.c | 6 ++---
proximity/reporter.c | 4 ++--
sap/sap-dummy.c | 8 +++----
sap/server.c | 6 ++---
serial/port.c | 6 ++---
serial/proxy.c | 18 +++++++--------
src/adapter.c | 43 ++++++++++++++++-------------------
src/device.c | 14 ++++++------
src/manager.c | 17 +++++++-------
thermometer/thermometer.c | 14 ++++++------
29 files changed, 187 insertions(+), 208 deletions(-)

diff --git a/attrib/client.c b/attrib/client.c
index cd948c1..b15a375 100644
--- a/attrib/client.c
+++ b/attrib/client.c
@@ -517,10 +517,10 @@ static DBusMessage *set_property(DBusConnection *conn,

static const GDBusMethodTable char_methods[] = {
{
- "GetProperties", "", "a{sv}", get_properties,
+ "GetProperties", get_properties,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
}, {
- "SetProperty", "sv", "", set_property, G_DBUS_METHOD_FLAG_ASYNC,
+ "SetProperty", set_property, G_DBUS_METHOD_FLAG_ASYNC,
.in_args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
},
{ }
@@ -1021,17 +1021,17 @@ static DBusMessage *prim_get_properties(DBusConnection *conn, DBusMessage *msg,

static const GDBusMethodTable prim_methods[] = {
{
- "DiscoverCharacteristics", "", "ao", discover_char,
+ "DiscoverCharacteristics", discover_char,
G_DBUS_METHOD_FLAG_ASYNC,
.out_args = GDBUS_ARGS_INFO({ "characteristics", "ao" })
}, {
- "RegisterCharacteristicsWatcher", "o", "", register_watcher,
+ "RegisterCharacteristicsWatcher", register_watcher,
.in_args = GDBUS_ARGS_INFO({ "agent", "o" })
}, {
- "UnregisterCharacteristicsWatcher", "o", "", unregister_watcher,
+ "UnregisterCharacteristicsWatcher", unregister_watcher,
.in_args = GDBUS_ARGS_INFO({ "agent", "o" })
}, {
- "GetProperties", "", "a{sv}", prim_get_properties,
+ "GetProperties", prim_get_properties,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
},
{ }
diff --git a/audio/control.c b/audio/control.c
index 9a1e3c8..ab4ce7d 100644
--- a/audio/control.c
+++ b/audio/control.c
@@ -199,27 +199,27 @@ static DBusMessage *control_get_properties(DBusConnection *conn,

static const GDBusMethodTable control_methods[] = {
{
- "IsConnected", "", "b", control_is_connected,
+ "IsConnected", control_is_connected,
G_DBUS_METHOD_FLAG_DEPRECATED,
.out_args = GDBUS_ARGS_INFO({ "connected", "b" })
},
{
- "GetProperties", "", "a{sv}", control_get_properties,
+ "GetProperties", control_get_properties,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
},
- { "VolumeUp", "", "", volume_up },
- { "VolumeDown", "", "", volume_down },
- { NULL, NULL, NULL, NULL }
+ { "VolumeUp", volume_up },
+ { "VolumeDown", volume_down },
+ { }
};

static const GDBusSignalTable control_signals[] = {
- { "Connected", "", G_DBUS_SIGNAL_FLAG_DEPRECATED},
- { "Disconnected", "", G_DBUS_SIGNAL_FLAG_DEPRECATED},
+ { "Connected", G_DBUS_SIGNAL_FLAG_DEPRECATED},
+ { "Disconnected", G_DBUS_SIGNAL_FLAG_DEPRECATED},
{
- "PropertyChanged", "sv",
+ "PropertyChanged",
.args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
},
- { NULL, NULL }
+ { }
};

static void path_unregister(void *data)
diff --git a/audio/device.c b/audio/device.c
index 1e5a5c1..1cbae24 100644
--- a/audio/device.c
+++ b/audio/device.c
@@ -619,22 +619,21 @@ static DBusMessage *dev_get_properties(DBusConnection *conn, DBusMessage *msg,
}

static const GDBusMethodTable dev_methods[] = {
- { "Connect", "", "", dev_connect,
- G_DBUS_METHOD_FLAG_ASYNC },
- { "Disconnect", "", "", dev_disconnect },
+ { "Connect", dev_connect, G_DBUS_METHOD_FLAG_ASYNC },
+ { "Disconnect", dev_disconnect },
{
- "GetProperties", "", "a{sv}", dev_get_properties,
+ "GetProperties", dev_get_properties,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
},
- { NULL, NULL, NULL, NULL }
+ { }
};

static const GDBusSignalTable dev_signals[] = {
{
- "PropertyChanged", "sv",
+ "PropertyChanged",
.args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
},
- { NULL, NULL }
+ { }
};

struct audio_device *audio_device_register(DBusConnection *conn,
diff --git a/audio/gateway.c b/audio/gateway.c
index fca13e9..6b4a73d 100644
--- a/audio/gateway.c
+++ b/audio/gateway.c
@@ -713,27 +713,27 @@ done:
}

static const GDBusMethodTable gateway_methods[] = {
- { "Connect", "", "", ag_connect, G_DBUS_METHOD_FLAG_ASYNC },
- { "Disconnect", "", "", ag_disconnect, G_DBUS_METHOD_FLAG_ASYNC },
+ { "Connect", ag_connect, G_DBUS_METHOD_FLAG_ASYNC },
+ { "Disconnect", ag_disconnect, G_DBUS_METHOD_FLAG_ASYNC },
{
- "GetProperties", "", "a{sv}", ag_get_properties,
+ "GetProperties", ag_get_properties,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
}, {
- "RegisterAgent", "o", "", register_agent,
+ "RegisterAgent", register_agent,
.in_args = GDBUS_ARGS_INFO({ "agent", "o" })
}, {
- "UnregisterAgent", "o", "", unregister_agent,
+ "UnregisterAgent", unregister_agent,
.in_args = GDBUS_ARGS_INFO({ "agent", "o" })
},
- { NULL, NULL, NULL, NULL }
+ { }
};

static const GDBusSignalTable gateway_signals[] = {
{
- "PropertyChanged", "sv",
+ "PropertyChanged",
.args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
},
- { NULL, NULL }
+ { }
};

static void path_unregister(void *data)
diff --git a/audio/headset.c b/audio/headset.c
index dd7f712..14a6866 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -2058,68 +2058,65 @@ static DBusMessage *hs_set_property(DBusConnection *conn,
}

static const GDBusMethodTable headset_methods[] = {
- { "Connect", "", "", hs_connect,
- G_DBUS_METHOD_FLAG_ASYNC },
- { "Disconnect", "", "", hs_disconnect },
+ { "Connect", hs_connect, G_DBUS_METHOD_FLAG_ASYNC },
+ { "Disconnect", hs_disconnect },
{
- "IsConnected", "", "b", hs_is_connected,
+ "IsConnected", hs_is_connected,
.out_args = GDBUS_ARGS_INFO({ "connected", "b" })
},
- { "IndicateCall", "", "", hs_ring },
- { "CancelCall", "", "", hs_cancel_call },
- { "Play", "", "", hs_play,
- G_DBUS_METHOD_FLAG_ASYNC |
- G_DBUS_METHOD_FLAG_DEPRECATED },
- { "Stop", "", "", hs_stop },
+ { "IndicateCall", hs_ring },
+ { "CancelCall", hs_cancel_call },
+ { "Play", hs_play,
+ G_DBUS_METHOD_FLAG_ASYNC | G_DBUS_METHOD_FLAG_DEPRECATED },
+ { "Stop", hs_stop },
{
- "IsPlaying", "", "b", hs_is_playing,
- G_DBUS_METHOD_FLAG_DEPRECATED,
+ "IsPlaying", hs_is_playing, G_DBUS_METHOD_FLAG_DEPRECATED,
.out_args = GDBUS_ARGS_INFO({ "playing", "b" })
}, {
- "GetSpeakerGain", "", "q", hs_get_speaker_gain,
+ "GetSpeakerGain", hs_get_speaker_gain,
G_DBUS_METHOD_FLAG_DEPRECATED,
.out_args = GDBUS_ARGS_INFO({ "gain", "q" })
}, {
- "GetMicrophoneGain", "", "q", hs_get_mic_gain,
+ "GetMicrophoneGain", hs_get_mic_gain,
G_DBUS_METHOD_FLAG_DEPRECATED,
.out_args = GDBUS_ARGS_INFO({ "gain", "q" })
}, {
- "SetSpeakerGain", "q", "", hs_set_speaker_gain,
+ "SetSpeakerGain", hs_set_speaker_gain,
G_DBUS_METHOD_FLAG_DEPRECATED,
.in_args = GDBUS_ARGS_INFO({ "gain", "q" })
}, {
- "SetMicrophoneGain", "q", "", hs_set_mic_gain,
+ "SetMicrophoneGain", hs_set_mic_gain,
G_DBUS_METHOD_FLAG_DEPRECATED,
.in_args = GDBUS_ARGS_INFO({ "gain", "q" })
}, {
- "GetProperties", "", "a{sv}", hs_get_properties,
+ "GetProperties", hs_get_properties,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
}, {
- "SetProperty", "sv", "", hs_set_property,
+ "SetProperty", hs_set_property,
.in_args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
},
- { NULL, NULL, NULL, NULL }
+ { }
};

static const GDBusSignalTable headset_signals[] = {
- { "Connected", "", G_DBUS_SIGNAL_FLAG_DEPRECATED },
- { "Disconnected", "", G_DBUS_SIGNAL_FLAG_DEPRECATED },
- { "AnswerRequested", "" },
- { "Stopped", "", G_DBUS_SIGNAL_FLAG_DEPRECATED },
- { "Playing", "", G_DBUS_SIGNAL_FLAG_DEPRECATED },
+ { "Connected", G_DBUS_SIGNAL_FLAG_DEPRECATED },
+ { "Disconnected", G_DBUS_SIGNAL_FLAG_DEPRECATED },
+ { "AnswerRequested" },
+ { "Stopped", G_DBUS_SIGNAL_FLAG_DEPRECATED },
+ { "Playing", G_DBUS_SIGNAL_FLAG_DEPRECATED },
{
- "SpeakerGainChanged", "q", G_DBUS_SIGNAL_FLAG_DEPRECATED,
+ "SpeakerGainChanged", G_DBUS_SIGNAL_FLAG_DEPRECATED,
.args = GDBUS_ARGS_INFO({ "gain", "q" })
},{
- "MicrophoneGainChanged", "q", G_DBUS_SIGNAL_FLAG_DEPRECATED,
+ "MicrophoneGainChanged", G_DBUS_SIGNAL_FLAG_DEPRECATED,
.args = GDBUS_ARGS_INFO({ "gain", "q" })
},
- { "CallTerminated", "" },
+ { "CallTerminated" },
{
- "PropertyChanged", "sv",
+ "PropertyChanged",
.args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
},
- { NULL, NULL }
+ { }
};

void headset_update(struct audio_device *dev, uint16_t svc,
diff --git a/audio/media.c b/audio/media.c
index b5d4967..f5abeb4 100644
--- a/audio/media.c
+++ b/audio/media.c
@@ -1792,20 +1792,20 @@ static DBusMessage *unregister_player(DBusConnection *conn, DBusMessage *msg,

static const GDBusMethodTable media_methods[] = {
{
- "RegisterEndpoint", "oa{sv}", "", register_endpoint,
+ "RegisterEndpoint", register_endpoint,
.in_args = GDBUS_ARGS_INFO(
{ "endpoint", "o" },
{ "properties", "a{sv}" })
}, {
- "UnregisterEndpoint", "o", "", unregister_endpoint,
+ "UnregisterEndpoint", unregister_endpoint,
.in_args = GDBUS_ARGS_INFO({ "endpoint", "o" })
}, {
- "RegisterPlayer", "oa{sv}a{sv}", "", register_player,
+ "RegisterPlayer", register_player,
.in_args = GDBUS_ARGS_INFO(
{ "player", "o" }, { "properties", "a{sv}" },
{ "metadata", "a{sv}" })
}, {
- "UnregisterPlayer", "o", "", unregister_player,
+ "UnregisterPlayer", unregister_player,
.in_args = GDBUS_ARGS_INFO({ "player", "o" })
},
{ },
diff --git a/audio/sink.c b/audio/sink.c
index d745f23..e2941d0 100644
--- a/audio/sink.c
+++ b/audio/sink.c
@@ -556,31 +556,28 @@ static DBusMessage *sink_get_properties(DBusConnection *conn,
}

static const GDBusMethodTable sink_methods[] = {
- { "Connect", "", "", sink_connect,
- G_DBUS_METHOD_FLAG_ASYNC },
- { "Disconnect", "", "", sink_disconnect,
- G_DBUS_METHOD_FLAG_ASYNC },
+ { "Connect", sink_connect, G_DBUS_METHOD_FLAG_ASYNC },
+ { "Disconnect", sink_disconnect, G_DBUS_METHOD_FLAG_ASYNC },
{
- "IsConnected", "", "b", sink_is_connected,
- G_DBUS_METHOD_FLAG_DEPRECATED,
+ "IsConnected", sink_is_connected, G_DBUS_METHOD_FLAG_DEPRECATED,
.out_args = GDBUS_ARGS_INFO({ "connected", "b" })
}, {
- "GetProperties", "", "a{sv}", sink_get_properties,
+ "GetProperties", sink_get_properties,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
},
- { NULL, NULL, NULL, NULL }
+ { }
};

static const GDBusSignalTable sink_signals[] = {
- { "Connected", "", G_DBUS_SIGNAL_FLAG_DEPRECATED },
- { "Disconnected", "", G_DBUS_SIGNAL_FLAG_DEPRECATED },
- { "Playing", "", G_DBUS_SIGNAL_FLAG_DEPRECATED },
- { "Stopped", "", G_DBUS_SIGNAL_FLAG_DEPRECATED },
+ { "Connected", G_DBUS_SIGNAL_FLAG_DEPRECATED },
+ { "Disconnected", G_DBUS_SIGNAL_FLAG_DEPRECATED },
+ { "Playing", G_DBUS_SIGNAL_FLAG_DEPRECATED },
+ { "Stopped", G_DBUS_SIGNAL_FLAG_DEPRECATED },
{
- "PropertyChanged", "sv",
+ "PropertyChanged",
.args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
},
- { NULL, NULL }
+ { }
};

static void sink_free(struct audio_device *dev)
diff --git a/audio/source.c b/audio/source.c
index e64bbd9..8dd831a 100644
--- a/audio/source.c
+++ b/audio/source.c
@@ -477,23 +477,21 @@ static DBusMessage *source_get_properties(DBusConnection *conn,
}

static const GDBusMethodTable source_methods[] = {
- { "Connect", "", "", source_connect,
- G_DBUS_METHOD_FLAG_ASYNC },
- { "Disconnect", "", "", source_disconnect,
- G_DBUS_METHOD_FLAG_ASYNC },
+ { "Connect", source_connect, G_DBUS_METHOD_FLAG_ASYNC },
+ { "Disconnect", source_disconnect, G_DBUS_METHOD_FLAG_ASYNC },
{
- "GetProperties", "", "a{sv}", source_get_properties,
+ "GetProperties", source_get_properties,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
},
- { NULL, NULL, NULL, NULL }
+ { }
};

static const GDBusSignalTable source_signals[] = {
{
- "PropertyChanged", "sv",
+ "PropertyChanged",
.args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
},
- { NULL, NULL }
+ { }
};

static void source_free(struct audio_device *dev)
diff --git a/audio/telephony-dummy.c b/audio/telephony-dummy.c
index 98bd546..5c699ab 100644
--- a/audio/telephony-dummy.c
+++ b/audio/telephony-dummy.c
@@ -380,34 +380,34 @@ static DBusMessage *set_subscriber_number(DBusConnection *conn,

static const GDBusMethodTable dummy_methods[] = {
{
- "OutgoingCall", "s", "", outgoing_call,
+ "OutgoingCall", outgoing_call,
.in_args = GDBUS_ARGS_INFO({ "number", "s" })
}, {
- "IncomingCall", "s", "", incoming_call,
+ "IncomingCall", incoming_call,
.in_args = GDBUS_ARGS_INFO({ "number", "s" })
}, {
- "CancelCall", "", "", cancel_call,
+ "CancelCall", cancel_call,
}, {
- "SignalStrength", "u", "", signal_strength,
+ "SignalStrength", signal_strength,
.in_args = GDBUS_ARGS_INFO({ "strength", "u" })
}, {
- "BatteryLevel", "u", "", battery_level,
+ "BatteryLevel", battery_level,
.in_args = GDBUS_ARGS_INFO({ "level", "u" })
}, {
- "RoamingStatus", "b", "", roaming_status,
+ "RoamingStatus", roaming_status,
.in_args = GDBUS_ARGS_INFO({ "roaming", "b" })
}, {
- "RegistrationStatus", "b", "", registration_status,
+ "RegistrationStatus", registration_status,
.in_args = GDBUS_ARGS_INFO({ "registration", "b" })
}, {
- "SetSubscriberNumber","s", "", set_subscriber_number,
+ "SetSubscriberNumber", set_subscriber_number,
.in_args = GDBUS_ARGS_INFO({ "number", "s" })
},
{ }
};

static const GDBusSignalTable dummy_signals[] = {
- { "VoiceDial", "" },
+ { "VoiceDial" },
{ }
};

diff --git a/audio/telephony-maemo5.c b/audio/telephony-maemo5.c
index 598ca36..1c35843 100644
--- a/audio/telephony-maemo5.c
+++ b/audio/telephony-maemo5.c
@@ -1953,7 +1953,7 @@ static DBusMessage *set_callerid(DBusConnection *conn, DBusMessage *msg,

static const GDBusMethodTable telephony_maemo_methods[] = {
{
- "SetCallerId", "s", "", set_callerid, G_DBUS_METHOD_FLAG_ASYNC,
+ "SetCallerId", set_callerid, G_DBUS_METHOD_FLAG_ASYNC,
.in_args = GDBUS_ARGS_INFO({ "id", "s" })
},
{ }
diff --git a/audio/transport.c b/audio/transport.c
index ffad342..753e275 100644
--- a/audio/transport.c
+++ b/audio/transport.c
@@ -916,18 +916,18 @@ static DBusMessage *get_properties(DBusConnection *conn, DBusMessage *msg,

static const GDBusMethodTable transport_methods[] = {
{
- "GetProperties", "", "a{sv}", get_properties,
+ "GetProperties", get_properties,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
}, {
- "Acquire", "s", "hqq", acquire, G_DBUS_METHOD_FLAG_ASYNC,
+ "Acquire", acquire, G_DBUS_METHOD_FLAG_ASYNC,
.in_args = GDBUS_ARGS_INFO({ "access_type", "s" }),
.out_args = GDBUS_ARGS_INFO({ "fd", "h" }, { "mtu_r", "q" },
{ "mtu_w", "q" } )
}, {
- "Release", "s", "", release, G_DBUS_METHOD_FLAG_ASYNC,
+ "Release", release, G_DBUS_METHOD_FLAG_ASYNC,
.in_args = GDBUS_ARGS_INFO({ "access_type", "s" }),
}, {
- "SetProperty", "sv", "", set_property,
+ "SetProperty", set_property,
.in_args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
},
{ },
@@ -935,7 +935,7 @@ static const GDBusMethodTable transport_methods[] = {

static const GDBusSignalTable transport_signals[] = {
{
- "PropertyChanged", "sv",
+ "PropertyChanged",
.args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
},
{ }
diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
index 610cb19..e9e8929 100644
--- a/gdbus/gdbus.h
+++ b/gdbus/gdbus.h
@@ -91,8 +91,6 @@ typedef struct {

typedef struct {
const char *name;
- const char *signature;
- const char *reply;
GDBusMethodFunction function;
GDBusMethodFlags flags;
unsigned int privilege;
@@ -102,7 +100,6 @@ typedef struct {

typedef struct {
const char *name;
- const char *signature;
GDBusSignalFlags flags;
const GDBusArgInfo *args;
} GDBusSignalTable;
diff --git a/gdbus/object.c b/gdbus/object.c
index db987dc..5712dcb 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -472,7 +472,7 @@ done:

static const GDBusMethodTable introspect_methods[] = {
{
- "Introspect", "", "s", introspect,
+ "Introspect", introspect,
.out_args = GDBUS_ARGS_INFO({ "xml", "s" })
},
{ }
diff --git a/health/hdp.c b/health/hdp.c
index 4284e86..9bedcb1 100644
--- a/health/hdp.c
+++ b/health/hdp.c
@@ -426,12 +426,12 @@ static void manager_path_unregister(gpointer data)

static const GDBusMethodTable health_manager_methods[] = {
{
- "CreateApplication", "a{sv}", "o", manager_create_application,
+ "CreateApplication", manager_create_application,
.in_args = GDBUS_ARGS_INFO({ "config", "a{sv}" }),
.out_args = GDBUS_ARGS_INFO({ "application", "o" })
},
{
- "DestroyApplication", "o", "", manager_destroy_application,
+ "DestroyApplication", manager_destroy_application,
.in_args = GDBUS_ARGS_INFO({ "application", "o" })
},
{ NULL }
@@ -740,13 +740,13 @@ end:

static const GDBusMethodTable health_channels_methods[] = {
{
- "GetProperties", "", "a{sv}", channel_get_properties,
+ "GetProperties", channel_get_properties,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
}, {
- "Acquire", "", "h", channel_acquire, G_DBUS_METHOD_FLAG_ASYNC,
+ "Acquire", channel_acquire, G_DBUS_METHOD_FLAG_ASYNC,
.out_args = GDBUS_ARGS_INFO({ "fd", "h" })
}, {
- "Release", "", "", channel_release
+ "Release", channel_release
},
{ NULL }
};
@@ -2107,20 +2107,20 @@ static void health_device_destroy(void *data)

static const GDBusMethodTable health_device_methods[] = {
{
- "Echo", "", "b", device_echo, G_DBUS_METHOD_FLAG_ASYNC,
+ "Echo", device_echo, G_DBUS_METHOD_FLAG_ASYNC,
.out_args = GDBUS_ARGS_INFO({ "value", "b" })
}, {
- "CreateChannel", "os", "o", device_create_channel,
+ "CreateChannel", device_create_channel,
G_DBUS_METHOD_FLAG_ASYNC,
.in_args = GDBUS_ARGS_INFO({ "application", "o" },
{ "configuration", "s" }),
.out_args = GDBUS_ARGS_INFO({ "channel", "o" })
}, {
- "DestroyChannel", "o", "", device_destroy_channel,
+ "DestroyChannel", device_destroy_channel,
G_DBUS_METHOD_FLAG_ASYNC,
.in_args = GDBUS_ARGS_INFO({ "channel", "o" })
}, {
- "GetProperties", "", "a{sv}", device_get_properties,
+ "GetProperties", device_get_properties,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
},
{ NULL }
@@ -2128,13 +2128,13 @@ static const GDBusMethodTable health_device_methods[] = {

static const GDBusSignalTable health_device_signals[] = {
{
- "ChannelConnected", "o",
+ "ChannelConnected",
.args = GDBUS_ARGS_INFO({ "channel", "o" })
}, {
- "ChannelDeleted", "o",
+ "ChannelDeleted",
.args = GDBUS_ARGS_INFO({ "channel", "o" })
}, {
- "PropertyChanged", "sv",
+ "PropertyChanged",
.args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
},
{ NULL }
diff --git a/input/device.c b/input/device.c
index ac18ced..1acd67a 100644
--- a/input/device.c
+++ b/input/device.c
@@ -1061,11 +1061,10 @@ static DBusMessage *input_device_get_properties(DBusConnection *conn,
}

static const GDBusMethodTable device_methods[] = {
- { "Connect", "", "", input_device_connect,
- G_DBUS_METHOD_FLAG_ASYNC },
- { "Disconnect", "", "", input_device_disconnect },
+ { "Connect", input_device_connect, G_DBUS_METHOD_FLAG_ASYNC },
+ { "Disconnect", input_device_disconnect },
{
- "GetProperties", "", "a{sv}", input_device_get_properties,
+ "GetProperties", input_device_get_properties,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
},
{ }
@@ -1073,7 +1072,7 @@ static const GDBusMethodTable device_methods[] = {

static const GDBusSignalTable device_signals[] = {
{
- "PropertyChanged", "sv",
+ "PropertyChanged",
.args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
},
{ }
diff --git a/network/connection.c b/network/connection.c
index d7ec420..e77d2a1 100644
--- a/network/connection.c
+++ b/network/connection.c
@@ -554,14 +554,13 @@ static void path_unregister(void *data)

static const GDBusMethodTable connection_methods[] = {
{
- "Connect", "s", "s", connection_connect,
- G_DBUS_METHOD_FLAG_ASYNC,
+ "Connect", connection_connect, G_DBUS_METHOD_FLAG_ASYNC,
.in_args = GDBUS_ARGS_INFO({ "uuid", "s" }),
.out_args = GDBUS_ARGS_INFO({ "interface_name", "" }),
}, {
- "Disconnect", "", "", connection_disconnect
+ "Disconnect", connection_disconnect
}, {
- "GetProperties", "", "a{sv}", connection_get_properties,
+ "GetProperties", connection_get_properties,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
},
{ }
@@ -569,7 +568,7 @@ static const GDBusMethodTable connection_methods[] = {

static const GDBusSignalTable connection_signals[] = {
{
- "PropertyChanged", "sv",
+ "PropertyChanged",
.args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
},
{ }
diff --git a/network/server.c b/network/server.c
index 1a6dbf0..a842d4a 100644
--- a/network/server.c
+++ b/network/server.c
@@ -687,10 +687,10 @@ static void path_unregister(void *data)

static const GDBusMethodTable server_methods[] = {
{
- "Register", "ss", "", register_server,
+ "Register", register_server,
.in_args = GDBUS_ARGS_INFO({ "uuid", "s" }, { "bridge", "s" })
}, {
- "Unregister", "s", "", unregister_server,
+ "Unregister", unregister_server,
.in_args = GDBUS_ARGS_INFO({ "uuid", "s" })
},
{ }
diff --git a/plugins/dbusoob.c b/plugins/dbusoob.c
index 9ff4a30..d19b4b8 100644
--- a/plugins/dbusoob.c
+++ b/plugins/dbusoob.c
@@ -177,15 +177,14 @@ static DBusMessage *remove_remote_data(DBusConnection *conn, DBusMessage *msg,

static const GDBusMethodTable oob_methods[] = {
{
- "AddRemoteData", "sayay", "", add_remote_data,
+ "AddRemoteData", add_remote_data,
.in_args = GDBUS_ARGS_INFO({ "address", "s" },
{ "hash", "ay" }, { "randomizer", "ay" })
}, {
- "RemoveRemoteData", "s", "", remove_remote_data,
+ "RemoveRemoteData", remove_remote_data,
.in_args = GDBUS_ARGS_INFO({ "address", "s" })
}, {
- "ReadLocalData", "", "ayay", read_local_data,
- G_DBUS_METHOD_FLAG_ASYNC,
+ "ReadLocalData", read_local_data, G_DBUS_METHOD_FLAG_ASYNC,
.out_args = GDBUS_ARGS_INFO({ "hash", "ay" },
{ "randomizer", "ay" })
},
diff --git a/plugins/service.c b/plugins/service.c
index b326564..78b45f3 100644
--- a/plugins/service.c
+++ b/plugins/service.c
@@ -698,21 +698,21 @@ done:

static const GDBusMethodTable service_methods[] = {
{
- "AddRecord", "s", "u", add_service_record,
+ "AddRecord", add_service_record,
.in_args = GDBUS_ARGS_INFO({ "record", "s" }),
.out_args = GDBUS_ARGS_INFO({ "handle", "u" })
}, {
- "UpdateRecord", "us", "", update_service_record,
+ "UpdateRecord", update_service_record,
.in_args = GDBUS_ARGS_INFO({ "handle", "u" }, { "record", "s" })
}, {
- "RemoveRecord", "u", "", remove_service_record,
+ "RemoveRecord", remove_service_record,
.in_args = GDBUS_ARGS_INFO({ "handle", "u" })
}, {
- "RequestAuthorization", "su", "", request_authorization,
+ "RequestAuthorization", request_authorization,
G_DBUS_METHOD_FLAG_ASYNC,
.in_args = GDBUS_ARGS_INFO({ "address", "s" }, { "handle", "u"})
},
- { "CancelAuthorization", "", "", cancel_authorization },
+ { "CancelAuthorization", cancel_authorization },
{ }
};

diff --git a/proximity/monitor.c b/proximity/monitor.c
index 1382ef8..6110202 100644
--- a/proximity/monitor.c
+++ b/proximity/monitor.c
@@ -548,10 +548,10 @@ static DBusMessage *set_property(DBusConnection *conn,

static const GDBusMethodTable monitor_methods[] = {
{
- "GetProperties", "", "a{sv}", get_properties,
+ "GetProperties", get_properties,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
}, {
- "SetProperty", "sv", "", set_property, G_DBUS_METHOD_FLAG_ASYNC,
+ "SetProperty", set_property, G_DBUS_METHOD_FLAG_ASYNC,
.in_args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
},
{ }
@@ -559,7 +559,7 @@ static const GDBusMethodTable monitor_methods[] = {

static const GDBusSignalTable monitor_signals[] = {
{
- "PropertyChanged", "sv",
+ "PropertyChanged",
.args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
},
{ }
diff --git a/proximity/reporter.c b/proximity/reporter.c
index 59595fc..ca11544 100644
--- a/proximity/reporter.c
+++ b/proximity/reporter.c
@@ -182,7 +182,7 @@ err:

static const GDBusMethodTable reporter_methods[] = {
{
- "GetProperties", "", "a{sv}", get_properties,
+ "GetProperties", get_properties,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
},
{ }
@@ -190,7 +190,7 @@ static const GDBusMethodTable reporter_methods[] = {

static const GDBusSignalTable reporter_signals[] = {
{
- "PropertyChanged", "sv",
+ "PropertyChanged",
.args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
},
{ }
diff --git a/sap/sap-dummy.c b/sap/sap-dummy.c
index ffa53d7..6ec7b3a 100644
--- a/sap/sap-dummy.c
+++ b/sap/sap-dummy.c
@@ -317,15 +317,15 @@ static DBusMessage *card_status(DBusConnection *conn, DBusMessage *msg,

static const GDBusMethodTable dummy_methods[] = {
{
- "OngoingCall", "b", "", ongoing_call,
+ "OngoingCall", ongoing_call,
.in_args = GDBUS_ARGS_INFO({ "ongoing", "b" })
}, {
- "MaxMessageSize", "u", "", max_msg_size,
+ "MaxMessageSize", max_msg_size,
.in_args = GDBUS_ARGS_INFO({ "size", "u" })
}, {
- "DisconnectImmediate", "", "", disconnect_immediate,
+ "DisconnectImmediate", disconnect_immediate,
}, {
- "CardStatus", "u", "", card_status,
+ "CardStatus", card_status,
.in_args = GDBUS_ARGS_INFO({ "status", "" })
},
{ }
diff --git a/sap/server.c b/sap/server.c
index bae6478..334b5d0 100644
--- a/sap/server.c
+++ b/sap/server.c
@@ -1305,16 +1305,16 @@ static DBusMessage *get_properties(DBusConnection *c,

static const GDBusMethodTable server_methods[] = {
{
- "GetProperties", "", "a{sv}", get_properties,
+ "GetProperties", get_properties,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
},
- {"Disconnect", "", "", disconnect},
+ {"Disconnect", disconnect},
{ }
};

static const GDBusSignalTable server_signals[] = {
{
- "PropertyChanged", "sv",
+ "PropertyChanged",
.args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
},
{ }
diff --git a/serial/port.c b/serial/port.c
index 2be1951..afc54b6 100644
--- a/serial/port.c
+++ b/serial/port.c
@@ -569,15 +569,15 @@ static DBusMessage *port_disconnect(DBusConnection *conn,

static const GDBusMethodTable port_methods[] = {
{
- "Connect", "s", "s", port_connect, G_DBUS_METHOD_FLAG_ASYNC,
+ "Connect", port_connect, G_DBUS_METHOD_FLAG_ASYNC,
.in_args = GDBUS_ARGS_INFO({ "pattern", "s" }),
.out_args = GDBUS_ARGS_INFO({ "tty", "s" })
}, {
- "ConnectFD", "s", "h", port_connect, G_DBUS_METHOD_FLAG_ASYNC,
+ "ConnectFD", port_connect, G_DBUS_METHOD_FLAG_ASYNC,
.in_args = GDBUS_ARGS_INFO({ "pattern", "s" }),
.out_args = GDBUS_ARGS_INFO({ "fd", "s" })
}, {
- "Disconnect", "s", "", port_disconnect,
+ "Disconnect", port_disconnect,
.in_args = GDBUS_ARGS_INFO({ "device", "s" }),
},
{ }
diff --git a/serial/proxy.c b/serial/proxy.c
index aa9ba62..5f88075 100644
--- a/serial/proxy.c
+++ b/serial/proxy.c
@@ -729,13 +729,13 @@ static DBusMessage *proxy_set_serial_params(DBusConnection *conn,
}

static const GDBusMethodTable proxy_methods[] = {
- { "Enable", "", "", proxy_enable },
- { "Disable", "", "", proxy_disable },
+ { "Enable", proxy_enable },
+ { "Disable", proxy_disable },
{
- "GetInfo", "", "a{sv}", proxy_get_info,
+ "GetInfo", proxy_get_info,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
}, {
- "SetSerialParameters", "syys", "", proxy_set_serial_params,
+ "SetSerialParameters", proxy_set_serial_params,
.in_args = GDBUS_ARGS_INFO({ "rate", "s" }, { "data", "y" },
{ "stop", "y" }, { "parity", "s" })
},
@@ -1119,22 +1119,22 @@ static void manager_path_unregister(void *data)

static const GDBusMethodTable manager_methods[] = {
{
- "CreateProxy", "ss", "s", create_proxy,
+ "CreateProxy", create_proxy,
.in_args = GDBUS_ARGS_INFO({ "pattern", "s" },
{ "address", "s" })
}, {
- "ListProxies", "", "as", list_proxies,
+ "ListProxies", list_proxies,
.out_args = GDBUS_ARGS_INFO({ "paths", "as" })
}, {
- "RemoveProxy", "s", "", remove_proxy,
+ "RemoveProxy", remove_proxy,
.in_args = GDBUS_ARGS_INFO({ "path", "s" })
},
{ },
};

static const GDBusSignalTable manager_signals[] = {
- { "ProxyCreated", "s", .args = GDBUS_ARGS_INFO({ "path", "s" }) },
- { "ProxyRemoved", "s", .args = GDBUS_ARGS_INFO({ "path", "s" }) },
+ { "ProxyCreated", .args = GDBUS_ARGS_INFO({ "path", "s" }) },
+ { "ProxyRemoved", .args = GDBUS_ARGS_INFO({ "path", "s" }) },
{ }
};

diff --git a/src/adapter.c b/src/adapter.c
index 2fce399..071fac9 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1657,51 +1657,46 @@ static DBusMessage *unregister_agent(DBusConnection *conn, DBusMessage *msg,

static const GDBusMethodTable adapter_methods[] = {
{
- "GetProperties", "", "a{sv}", get_properties,
+ "GetProperties", get_properties,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
}, {
- "SetProperty", "sv", "", set_property, G_DBUS_METHOD_FLAG_ASYNC,
+ "SetProperty", set_property, G_DBUS_METHOD_FLAG_ASYNC,
.in_args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
},
- { "RequestSession", "", "", request_session,
- G_DBUS_METHOD_FLAG_ASYNC},
- { "ReleaseSession", "", "", release_session },
- { "StartDiscovery", "", "", adapter_start_discovery },
- { "StopDiscovery", "", "", adapter_stop_discovery,
- G_DBUS_METHOD_FLAG_ASYNC},
+ { "RequestSession", request_session, G_DBUS_METHOD_FLAG_ASYNC},
+ { "ReleaseSession", release_session },
+ { "StartDiscovery", adapter_start_discovery },
+ { "StopDiscovery", adapter_stop_discovery, G_DBUS_METHOD_FLAG_ASYNC},
{
- "ListDevices", "", "ao", list_devices,
- G_DBUS_METHOD_FLAG_DEPRECATED,
+ "ListDevices", list_devices, G_DBUS_METHOD_FLAG_DEPRECATED,
.out_args = GDBUS_ARGS_INFO({ "devices", "ao" })
}, {
- "CreateDevice", "s", "o", create_device,
- G_DBUS_METHOD_FLAG_ASYNC,
+ "CreateDevice", create_device, G_DBUS_METHOD_FLAG_ASYNC,
.in_args = GDBUS_ARGS_INFO({ "address", "s" }),
.out_args = GDBUS_ARGS_INFO({ "device", "o" }),
}, {
- "CreatePairedDevice", "sos", "o", create_paired_device,
+ "CreatePairedDevice", create_paired_device,
G_DBUS_METHOD_FLAG_ASYNC,
.in_args = GDBUS_ARGS_INFO({ "address", "s" },
{ "agent", "o" }, { "capability", "s" }),
.out_args = GDBUS_ARGS_INFO({ "device", "o" })
}, {
- "CancelDeviceCreation", "s", "", cancel_device_creation,
+ "CancelDeviceCreation", cancel_device_creation,
G_DBUS_METHOD_FLAG_ASYNC,
.in_args = GDBUS_ARGS_INFO({ "address", "s" })
}, {
- "RemoveDevice", "o", "", remove_device,
- G_DBUS_METHOD_FLAG_ASYNC,
+ "RemoveDevice", remove_device, G_DBUS_METHOD_FLAG_ASYNC,
.in_args = GDBUS_ARGS_INFO({ "device", "o" })
}, {
- "FindDevice", "s", "o", find_device,
+ "FindDevice", find_device,
.in_args = GDBUS_ARGS_INFO({ "address", "s" }),
.out_args = GDBUS_ARGS_INFO({ "device", "o" })
}, {
- "RegisterAgent", "os", "", register_agent,
+ "RegisterAgent", register_agent,
.in_args = GDBUS_ARGS_INFO({ "agent", "o" },
{ "capability", "s" }),
}, {
- "UnregisterAgent", "o", "", unregister_agent,
+ "UnregisterAgent", unregister_agent,
.in_args = GDBUS_ARGS_INFO({ "agent", "o" })
},
{ }
@@ -1709,20 +1704,20 @@ static const GDBusMethodTable adapter_methods[] = {

static const GDBusSignalTable adapter_signals[] = {
{
- "PropertyChanged", "sv",
+ "PropertyChanged",
.args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
}, {
- "DeviceCreated", "o",
+ "DeviceCreated",
.args = GDBUS_ARGS_INFO({ "device", "o" })
}, {
- "DeviceRemoved", "o",
+ "DeviceRemoved",
.args = GDBUS_ARGS_INFO({ "device", "o" })
}, {
- "DeviceFound", "sa{sv}",
+ "DeviceFound",
.args = GDBUS_ARGS_INFO({ "address", "s" },
{ "values", "a{sv}" })
}, {
- "DeviceDisappeared", "s",
+ "DeviceDisappeared",
.args = GDBUS_ARGS_INFO({ "address", "s" })
},
{ }
diff --git a/src/device.c b/src/device.c
index 66672d4..6fb32f8 100644
--- a/src/device.c
+++ b/src/device.c
@@ -879,28 +879,28 @@ static DBusMessage *disconnect(DBusConnection *conn, DBusMessage *msg,

static const GDBusMethodTable device_methods[] = {
{
- "GetProperties", "", "a{sv}", get_properties,
+ "GetProperties", get_properties,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
}, {
- "SetProperty", "sv", "", set_property,
+ "SetProperty", set_property,
.in_args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
}, {
- "DiscoverServices", "s", "a{us}", discover_services,
+ "DiscoverServices", discover_services,
G_DBUS_METHOD_FLAG_ASYNC,
.in_args = GDBUS_ARGS_INFO({ "pattern", "s" }),
.out_args = GDBUS_ARGS_INFO({ "services", "a{us}" })
},
- { "CancelDiscovery", "", "", cancel_discover },
- { "Disconnect", "", "", disconnect, G_DBUS_METHOD_FLAG_ASYNC},
+ { "CancelDiscovery", cancel_discover },
+ { "Disconnect", disconnect, G_DBUS_METHOD_FLAG_ASYNC},
{ }
};

static const GDBusSignalTable device_signals[] = {
{
- "PropertyChanged", "sv",
+ "PropertyChanged",
.args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
},
- { "DisconnectRequested", "" },
+ { "DisconnectRequested" },
{ }
};

diff --git a/src/manager.c b/src/manager.c
index 002118b..1419233 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -198,18 +198,17 @@ static DBusMessage *get_properties(DBusConnection *conn,

static const GDBusMethodTable manager_methods[] = {
{
- "GetProperties", "", "a{sv}", get_properties,
+ "GetProperties", get_properties,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
}, {
- "DefaultAdapter", "", "o", default_adapter,
+ "DefaultAdapter", default_adapter,
.out_args = GDBUS_ARGS_INFO({ "adapter", "o" })
}, {
- "FindAdapter", "s", "o", find_adapter,
+ "FindAdapter", find_adapter,
.in_args = GDBUS_ARGS_INFO({ "pattern", "s" }),
.out_args = GDBUS_ARGS_INFO({ "adapter", "o" })
}, {
- "ListAdapters", "", "ao", list_adapters,
- G_DBUS_METHOD_FLAG_DEPRECATED,
+ "ListAdapters", list_adapters, G_DBUS_METHOD_FLAG_DEPRECATED,
.out_args = GDBUS_ARGS_INFO({ "adapters", "ao" })
},
{ }
@@ -217,16 +216,16 @@ static const GDBusMethodTable manager_methods[] = {

static const GDBusSignalTable manager_signals[] = {
{
- "PropertyChanged", "sv",
+ "PropertyChanged",
.args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
}, {
- "AdapterAdded", "o",
+ "AdapterAdded",
.args = GDBUS_ARGS_INFO({ "adapter", "s" })
}, {
- "AdapterRemoved", "o",
+ "AdapterRemoved",
.args = GDBUS_ARGS_INFO({ "adapter", "s" })
}, {
- "DefaultAdapterChanged", "o",
+ "DefaultAdapterChanged",
.args = GDBUS_ARGS_INFO({ "adapter", "s" })
},
{ }
diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
index 137b712..e975101 100644
--- a/thermometer/thermometer.c
+++ b/thermometer/thermometer.c
@@ -961,22 +961,22 @@ static DBusMessage *disable_intermediate(DBusConnection *conn, DBusMessage *msg,

static const GDBusMethodTable thermometer_methods[] = {
{
- "GetProperties", "", "a{sv}", get_properties,
+ "GetProperties", get_properties,
.out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
}, {
- "SetProperty", "sv", "", set_property, G_DBUS_METHOD_FLAG_ASYNC,
+ "SetProperty", set_property, G_DBUS_METHOD_FLAG_ASYNC,
.in_args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
}, {
- "RegisterWatcher", "o", "", register_watcher,
+ "RegisterWatcher", register_watcher,
.in_args = GDBUS_ARGS_INFO({ "agent", "o" })
}, {
- "UnregisterWatcher", "o", "", unregister_watcher,
+ "UnregisterWatcher", unregister_watcher,
.in_args = GDBUS_ARGS_INFO({ "agent", "o" })
}, {
- "EnableIntermediateMeasurement", "o", "", enable_intermediate,
+ "EnableIntermediateMeasurement", enable_intermediate,
.in_args = GDBUS_ARGS_INFO({ "agent", "o" })
}, {
- "DisableIntermediateMeasurement","o", "", disable_intermediate,
+ "DisableIntermediateMeasurement", disable_intermediate,
.in_args = GDBUS_ARGS_INFO({ "agent", "o" })
},
{ }
@@ -984,7 +984,7 @@ static const GDBusMethodTable thermometer_methods[] = {

static const GDBusSignalTable thermometer_signals[] = {
{
- "PropertyChanged", "sv",
+ "PropertyChanged",
.args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
},
{ }
--
1.7.10.2


2012-05-16 23:33:10

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ v5 10/13] gdbus: add Deprecated annotation in introspection

---
gdbus/object.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/gdbus/object.c b/gdbus/object.c
index 5712dcb..1511e88 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -82,7 +82,11 @@ static void generate_interface_xml(GString *gstr, struct interface_data *iface)
const GDBusSignalTable *signal;

for (method = iface->methods; method && method->name; method++) {
- if (!(method->in_args && method->in_args->name) &&
+ gboolean deprecated = method->flags &
+ G_DBUS_METHOD_FLAG_DEPRECATED;
+
+ if (!deprecated &&
+ !(method->in_args && method->in_args->name) &&
!(method->out_args && method->out_args->name))
g_string_append_printf(gstr, "\t\t<method name=\"%s\"/>\n",
method->name);
@@ -91,18 +95,29 @@ static void generate_interface_xml(GString *gstr, struct interface_data *iface)
method->name);
print_arguments(gstr, method->in_args, "in");
print_arguments(gstr, method->out_args, "out");
+
+ if (deprecated)
+ g_string_append_printf(gstr, "\t\t\t<annotation name=\"org.freedesktop.DBus.Deprecated\" value=\"true\"/>\n");
+
g_string_append_printf(gstr, "\t\t</method>\n");
}
}

for (signal = iface->signals; signal && signal->name; signal++) {
- if (!(signal->args && signal->args->name))
+ gboolean deprecated = signal->flags &
+ G_DBUS_SIGNAL_FLAG_DEPRECATED;
+
+ if (!deprecated && !(signal->args && signal->args->name))
g_string_append_printf(gstr, "\t\t<signal name=\"%s\"/>\n",
signal->name);
else {
g_string_append_printf(gstr, "\t\t<signal name=\"%s\">\n",
signal->name);
print_arguments(gstr, signal->args, NULL);
+
+ if (deprecated)
+ g_string_append_printf(gstr, "\t\t\t<annotation name=\"org.freedesktop.DBus.Deprecated\" value=\"true\"/>\n");
+
g_string_append_printf(gstr, "\t\t</signal>\n");
}
}
--
1.7.10.2


2012-05-16 23:33:06

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ v5 06/13] Convert GDBus methods and signals to use GDBusArgInfo

---
attrib/client.c | 31 ++++++++++------
audio/control.c | 17 ++++++---
audio/device.c | 10 ++++--
audio/gateway.c | 18 +++++++---
audio/headset.c | 58 +++++++++++++++++++++---------
audio/media.c | 21 ++++++++---
audio/sink.c | 16 ++++++---
audio/source.c | 10 ++++--
audio/telephony-dummy.c | 32 ++++++++++++-----
audio/telephony-maemo5.c | 6 ++--
audio/transport.c | 26 ++++++++++----
gdbus/object.c | 5 ++-
health/hdp.c | 61 ++++++++++++++++++++++---------
input/device.c | 10 ++++--
network/connection.c | 20 ++++++++---
network/server.c | 9 +++--
plugins/dbusoob.c | 17 ++++++---
plugins/service.c | 22 ++++++++----
proximity/monitor.c | 15 +++++---
proximity/reporter.c | 10 ++++--
sap/sap-dummy.c | 16 ++++++---
sap/server.c | 10 ++++--
serial/port.c | 15 ++++++--
serial/proxy.c | 32 ++++++++++++-----
src/adapter.c | 88 ++++++++++++++++++++++++++++++++-------------
src/device.c | 28 ++++++++++-----
src/manager.c | 37 ++++++++++++++-----
thermometer/thermometer.c | 31 +++++++++++-----
28 files changed, 497 insertions(+), 174 deletions(-)

diff --git a/attrib/client.c b/attrib/client.c
index 2179f63..cd948c1 100644
--- a/attrib/client.c
+++ b/attrib/client.c
@@ -516,9 +516,13 @@ static DBusMessage *set_property(DBusConnection *conn,
}

static const GDBusMethodTable char_methods[] = {
- { "GetProperties", "", "a{sv}", get_properties },
- { "SetProperty", "sv", "", set_property,
- G_DBUS_METHOD_FLAG_ASYNC},
+ {
+ "GetProperties", "", "a{sv}", get_properties,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ }, {
+ "SetProperty", "sv", "", set_property, G_DBUS_METHOD_FLAG_ASYNC,
+ .in_args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ },
{ }
};

@@ -1016,13 +1020,20 @@ static DBusMessage *prim_get_properties(DBusConnection *conn, DBusMessage *msg,
}

static const GDBusMethodTable prim_methods[] = {
- { "DiscoverCharacteristics", "", "ao", discover_char,
- G_DBUS_METHOD_FLAG_ASYNC },
- { "RegisterCharacteristicsWatcher", "o", "",
- register_watcher },
- { "UnregisterCharacteristicsWatcher", "o", "",
- unregister_watcher },
- { "GetProperties", "", "a{sv}",prim_get_properties },
+ {
+ "DiscoverCharacteristics", "", "ao", discover_char,
+ G_DBUS_METHOD_FLAG_ASYNC,
+ .out_args = GDBUS_ARGS_INFO({ "characteristics", "ao" })
+ }, {
+ "RegisterCharacteristicsWatcher", "o", "", register_watcher,
+ .in_args = GDBUS_ARGS_INFO({ "agent", "o" })
+ }, {
+ "UnregisterCharacteristicsWatcher", "o", "", unregister_watcher,
+ .in_args = GDBUS_ARGS_INFO({ "agent", "o" })
+ }, {
+ "GetProperties", "", "a{sv}", prim_get_properties,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ },
{ }
};

diff --git a/audio/control.c b/audio/control.c
index da23535..9a1e3c8 100644
--- a/audio/control.c
+++ b/audio/control.c
@@ -198,9 +198,15 @@ static DBusMessage *control_get_properties(DBusConnection *conn,
}

static const GDBusMethodTable control_methods[] = {
- { "IsConnected", "", "b", control_is_connected,
- G_DBUS_METHOD_FLAG_DEPRECATED },
- { "GetProperties", "", "a{sv}",control_get_properties },
+ {
+ "IsConnected", "", "b", control_is_connected,
+ G_DBUS_METHOD_FLAG_DEPRECATED,
+ .out_args = GDBUS_ARGS_INFO({ "connected", "b" })
+ },
+ {
+ "GetProperties", "", "a{sv}", control_get_properties,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ },
{ "VolumeUp", "", "", volume_up },
{ "VolumeDown", "", "", volume_down },
{ NULL, NULL, NULL, NULL }
@@ -209,7 +215,10 @@ static const GDBusMethodTable control_methods[] = {
static const GDBusSignalTable control_signals[] = {
{ "Connected", "", G_DBUS_SIGNAL_FLAG_DEPRECATED},
{ "Disconnected", "", G_DBUS_SIGNAL_FLAG_DEPRECATED},
- { "PropertyChanged", "sv" },
+ {
+ "PropertyChanged", "sv",
+ .args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ },
{ NULL, NULL }
};

diff --git a/audio/device.c b/audio/device.c
index ac00f1d..1e5a5c1 100644
--- a/audio/device.c
+++ b/audio/device.c
@@ -622,12 +622,18 @@ static const GDBusMethodTable dev_methods[] = {
{ "Connect", "", "", dev_connect,
G_DBUS_METHOD_FLAG_ASYNC },
{ "Disconnect", "", "", dev_disconnect },
- { "GetProperties", "", "a{sv}",dev_get_properties },
+ {
+ "GetProperties", "", "a{sv}", dev_get_properties,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ },
{ NULL, NULL, NULL, NULL }
};

static const GDBusSignalTable dev_signals[] = {
- { "PropertyChanged", "sv" },
+ {
+ "PropertyChanged", "sv",
+ .args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ },
{ NULL, NULL }
};

diff --git a/audio/gateway.c b/audio/gateway.c
index 9194a7c..fca13e9 100644
--- a/audio/gateway.c
+++ b/audio/gateway.c
@@ -715,14 +715,24 @@ done:
static const GDBusMethodTable gateway_methods[] = {
{ "Connect", "", "", ag_connect, G_DBUS_METHOD_FLAG_ASYNC },
{ "Disconnect", "", "", ag_disconnect, G_DBUS_METHOD_FLAG_ASYNC },
- { "GetProperties", "", "a{sv}", ag_get_properties },
- { "RegisterAgent", "o", "", register_agent },
- { "UnregisterAgent", "o", "", unregister_agent },
+ {
+ "GetProperties", "", "a{sv}", ag_get_properties,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ }, {
+ "RegisterAgent", "o", "", register_agent,
+ .in_args = GDBUS_ARGS_INFO({ "agent", "o" })
+ }, {
+ "UnregisterAgent", "o", "", unregister_agent,
+ .in_args = GDBUS_ARGS_INFO({ "agent", "o" })
+ },
{ NULL, NULL, NULL, NULL }
};

static const GDBusSignalTable gateway_signals[] = {
- { "PropertyChanged", "sv" },
+ {
+ "PropertyChanged", "sv",
+ .args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ },
{ NULL, NULL }
};

diff --git a/audio/headset.c b/audio/headset.c
index ebe9a7c..dd7f712 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -2061,25 +2061,43 @@ static const GDBusMethodTable headset_methods[] = {
{ "Connect", "", "", hs_connect,
G_DBUS_METHOD_FLAG_ASYNC },
{ "Disconnect", "", "", hs_disconnect },
- { "IsConnected", "", "b", hs_is_connected },
+ {
+ "IsConnected", "", "b", hs_is_connected,
+ .out_args = GDBUS_ARGS_INFO({ "connected", "b" })
+ },
{ "IndicateCall", "", "", hs_ring },
{ "CancelCall", "", "", hs_cancel_call },
{ "Play", "", "", hs_play,
G_DBUS_METHOD_FLAG_ASYNC |
G_DBUS_METHOD_FLAG_DEPRECATED },
{ "Stop", "", "", hs_stop },
- { "IsPlaying", "", "b", hs_is_playing,
- G_DBUS_METHOD_FLAG_DEPRECATED },
- { "GetSpeakerGain", "", "q", hs_get_speaker_gain,
- G_DBUS_METHOD_FLAG_DEPRECATED },
- { "GetMicrophoneGain", "", "q", hs_get_mic_gain,
- G_DBUS_METHOD_FLAG_DEPRECATED },
- { "SetSpeakerGain", "q", "", hs_set_speaker_gain,
- G_DBUS_METHOD_FLAG_DEPRECATED },
- { "SetMicrophoneGain", "q", "", hs_set_mic_gain,
- G_DBUS_METHOD_FLAG_DEPRECATED },
- { "GetProperties", "", "a{sv}",hs_get_properties },
- { "SetProperty", "sv", "", hs_set_property },
+ {
+ "IsPlaying", "", "b", hs_is_playing,
+ G_DBUS_METHOD_FLAG_DEPRECATED,
+ .out_args = GDBUS_ARGS_INFO({ "playing", "b" })
+ }, {
+ "GetSpeakerGain", "", "q", hs_get_speaker_gain,
+ G_DBUS_METHOD_FLAG_DEPRECATED,
+ .out_args = GDBUS_ARGS_INFO({ "gain", "q" })
+ }, {
+ "GetMicrophoneGain", "", "q", hs_get_mic_gain,
+ G_DBUS_METHOD_FLAG_DEPRECATED,
+ .out_args = GDBUS_ARGS_INFO({ "gain", "q" })
+ }, {
+ "SetSpeakerGain", "q", "", hs_set_speaker_gain,
+ G_DBUS_METHOD_FLAG_DEPRECATED,
+ .in_args = GDBUS_ARGS_INFO({ "gain", "q" })
+ }, {
+ "SetMicrophoneGain", "q", "", hs_set_mic_gain,
+ G_DBUS_METHOD_FLAG_DEPRECATED,
+ .in_args = GDBUS_ARGS_INFO({ "gain", "q" })
+ }, {
+ "GetProperties", "", "a{sv}", hs_get_properties,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ }, {
+ "SetProperty", "sv", "", hs_set_property,
+ .in_args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ },
{ NULL, NULL, NULL, NULL }
};

@@ -2089,10 +2107,18 @@ static const GDBusSignalTable headset_signals[] = {
{ "AnswerRequested", "" },
{ "Stopped", "", G_DBUS_SIGNAL_FLAG_DEPRECATED },
{ "Playing", "", G_DBUS_SIGNAL_FLAG_DEPRECATED },
- { "SpeakerGainChanged", "q", G_DBUS_SIGNAL_FLAG_DEPRECATED },
- { "MicrophoneGainChanged", "q", G_DBUS_SIGNAL_FLAG_DEPRECATED },
+ {
+ "SpeakerGainChanged", "q", G_DBUS_SIGNAL_FLAG_DEPRECATED,
+ .args = GDBUS_ARGS_INFO({ "gain", "q" })
+ },{
+ "MicrophoneGainChanged", "q", G_DBUS_SIGNAL_FLAG_DEPRECATED,
+ .args = GDBUS_ARGS_INFO({ "gain", "q" })
+ },
{ "CallTerminated", "" },
- { "PropertyChanged", "sv" },
+ {
+ "PropertyChanged", "sv",
+ .args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ },
{ NULL, NULL }
};

diff --git a/audio/media.c b/audio/media.c
index 7a83fbd..b5d4967 100644
--- a/audio/media.c
+++ b/audio/media.c
@@ -1791,10 +1791,23 @@ static DBusMessage *unregister_player(DBusConnection *conn, DBusMessage *msg,
}

static const GDBusMethodTable media_methods[] = {
- { "RegisterEndpoint", "oa{sv}", "", register_endpoint },
- { "UnregisterEndpoint", "o", "", unregister_endpoint },
- { "RegisterPlayer", "oa{sv}a{sv}","", register_player },
- { "UnregisterPlayer", "o", "", unregister_player },
+ {
+ "RegisterEndpoint", "oa{sv}", "", register_endpoint,
+ .in_args = GDBUS_ARGS_INFO(
+ { "endpoint", "o" },
+ { "properties", "a{sv}" })
+ }, {
+ "UnregisterEndpoint", "o", "", unregister_endpoint,
+ .in_args = GDBUS_ARGS_INFO({ "endpoint", "o" })
+ }, {
+ "RegisterPlayer", "oa{sv}a{sv}", "", register_player,
+ .in_args = GDBUS_ARGS_INFO(
+ { "player", "o" }, { "properties", "a{sv}" },
+ { "metadata", "a{sv}" })
+ }, {
+ "UnregisterPlayer", "o", "", unregister_player,
+ .in_args = GDBUS_ARGS_INFO({ "player", "o" })
+ },
{ },
};

diff --git a/audio/sink.c b/audio/sink.c
index fe4dd4b..d745f23 100644
--- a/audio/sink.c
+++ b/audio/sink.c
@@ -560,9 +560,14 @@ static const GDBusMethodTable sink_methods[] = {
G_DBUS_METHOD_FLAG_ASYNC },
{ "Disconnect", "", "", sink_disconnect,
G_DBUS_METHOD_FLAG_ASYNC },
- { "IsConnected", "", "b", sink_is_connected,
- G_DBUS_METHOD_FLAG_DEPRECATED },
- { "GetProperties", "", "a{sv}",sink_get_properties },
+ {
+ "IsConnected", "", "b", sink_is_connected,
+ G_DBUS_METHOD_FLAG_DEPRECATED,
+ .out_args = GDBUS_ARGS_INFO({ "connected", "b" })
+ }, {
+ "GetProperties", "", "a{sv}", sink_get_properties,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ },
{ NULL, NULL, NULL, NULL }
};

@@ -571,7 +576,10 @@ static const GDBusSignalTable sink_signals[] = {
{ "Disconnected", "", G_DBUS_SIGNAL_FLAG_DEPRECATED },
{ "Playing", "", G_DBUS_SIGNAL_FLAG_DEPRECATED },
{ "Stopped", "", G_DBUS_SIGNAL_FLAG_DEPRECATED },
- { "PropertyChanged", "sv" },
+ {
+ "PropertyChanged", "sv",
+ .args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ },
{ NULL, NULL }
};

diff --git a/audio/source.c b/audio/source.c
index 04bf131..e64bbd9 100644
--- a/audio/source.c
+++ b/audio/source.c
@@ -481,12 +481,18 @@ static const GDBusMethodTable source_methods[] = {
G_DBUS_METHOD_FLAG_ASYNC },
{ "Disconnect", "", "", source_disconnect,
G_DBUS_METHOD_FLAG_ASYNC },
- { "GetProperties", "", "a{sv}",source_get_properties },
+ {
+ "GetProperties", "", "a{sv}", source_get_properties,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ },
{ NULL, NULL, NULL, NULL }
};

static const GDBusSignalTable source_signals[] = {
- { "PropertyChanged", "sv" },
+ {
+ "PropertyChanged", "sv",
+ .args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ },
{ NULL, NULL }
};

diff --git a/audio/telephony-dummy.c b/audio/telephony-dummy.c
index 1885b4a..98bd546 100644
--- a/audio/telephony-dummy.c
+++ b/audio/telephony-dummy.c
@@ -379,14 +379,30 @@ static DBusMessage *set_subscriber_number(DBusConnection *conn,
}

static const GDBusMethodTable dummy_methods[] = {
- { "OutgoingCall", "s", "", outgoing_call },
- { "IncomingCall", "s", "", incoming_call },
- { "CancelCall", "", "", cancel_call },
- { "SignalStrength", "u", "", signal_strength },
- { "BatteryLevel", "u", "", battery_level },
- { "RoamingStatus", "b", "", roaming_status },
- { "RegistrationStatus", "b", "", registration_status },
- { "SetSubscriberNumber","s", "", set_subscriber_number },
+ {
+ "OutgoingCall", "s", "", outgoing_call,
+ .in_args = GDBUS_ARGS_INFO({ "number", "s" })
+ }, {
+ "IncomingCall", "s", "", incoming_call,
+ .in_args = GDBUS_ARGS_INFO({ "number", "s" })
+ }, {
+ "CancelCall", "", "", cancel_call,
+ }, {
+ "SignalStrength", "u", "", signal_strength,
+ .in_args = GDBUS_ARGS_INFO({ "strength", "u" })
+ }, {
+ "BatteryLevel", "u", "", battery_level,
+ .in_args = GDBUS_ARGS_INFO({ "level", "u" })
+ }, {
+ "RoamingStatus", "b", "", roaming_status,
+ .in_args = GDBUS_ARGS_INFO({ "roaming", "b" })
+ }, {
+ "RegistrationStatus", "b", "", registration_status,
+ .in_args = GDBUS_ARGS_INFO({ "registration", "b" })
+ }, {
+ "SetSubscriberNumber","s", "", set_subscriber_number,
+ .in_args = GDBUS_ARGS_INFO({ "number", "s" })
+ },
{ }
};

diff --git a/audio/telephony-maemo5.c b/audio/telephony-maemo5.c
index 6ab43b4..598ca36 100644
--- a/audio/telephony-maemo5.c
+++ b/audio/telephony-maemo5.c
@@ -1952,8 +1952,10 @@ static DBusMessage *set_callerid(DBusConnection *conn, DBusMessage *msg,
}

static const GDBusMethodTable telephony_maemo_methods[] = {
- {"SetCallerId", "s", "", set_callerid,
- G_DBUS_METHOD_FLAG_ASYNC},
+ {
+ "SetCallerId", "s", "", set_callerid, G_DBUS_METHOD_FLAG_ASYNC,
+ .in_args = GDBUS_ARGS_INFO({ "id", "s" })
+ },
{ }
};

diff --git a/audio/transport.c b/audio/transport.c
index 7223f38..ffad342 100644
--- a/audio/transport.c
+++ b/audio/transport.c
@@ -915,17 +915,29 @@ static DBusMessage *get_properties(DBusConnection *conn, DBusMessage *msg,
}

static const GDBusMethodTable transport_methods[] = {
- { "GetProperties", "", "a{sv}", get_properties },
- { "Acquire", "s", "hqq", acquire,
- G_DBUS_METHOD_FLAG_ASYNC},
- { "Release", "s", "", release,
- G_DBUS_METHOD_FLAG_ASYNC},
- { "SetProperty", "sv", "", set_property },
+ {
+ "GetProperties", "", "a{sv}", get_properties,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ }, {
+ "Acquire", "s", "hqq", acquire, G_DBUS_METHOD_FLAG_ASYNC,
+ .in_args = GDBUS_ARGS_INFO({ "access_type", "s" }),
+ .out_args = GDBUS_ARGS_INFO({ "fd", "h" }, { "mtu_r", "q" },
+ { "mtu_w", "q" } )
+ }, {
+ "Release", "s", "", release, G_DBUS_METHOD_FLAG_ASYNC,
+ .in_args = GDBUS_ARGS_INFO({ "access_type", "s" }),
+ }, {
+ "SetProperty", "sv", "", set_property,
+ .in_args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ },
{ },
};

static const GDBusSignalTable transport_signals[] = {
- { "PropertyChanged", "sv" },
+ {
+ "PropertyChanged", "sv",
+ .args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ },
{ }
};

diff --git a/gdbus/object.c b/gdbus/object.c
index 0ef6c80..e99757f 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -497,7 +497,10 @@ done:
}

static const GDBusMethodTable introspect_methods[] = {
- { "Introspect", "", "s", introspect },
+ {
+ "Introspect", "", "s", introspect,
+ .out_args = GDBUS_ARGS_INFO({ "xml", "s" })
+ },
{ }
};

diff --git a/health/hdp.c b/health/hdp.c
index 3b1ea49..4284e86 100644
--- a/health/hdp.c
+++ b/health/hdp.c
@@ -425,8 +425,15 @@ static void manager_path_unregister(gpointer data)
}

static const GDBusMethodTable health_manager_methods[] = {
- {"CreateApplication", "a{sv}", "o", manager_create_application},
- {"DestroyApplication", "o", "", manager_destroy_application},
+ {
+ "CreateApplication", "a{sv}", "o", manager_create_application,
+ .in_args = GDBUS_ARGS_INFO({ "config", "a{sv}" }),
+ .out_args = GDBUS_ARGS_INFO({ "application", "o" })
+ },
+ {
+ "DestroyApplication", "o", "", manager_destroy_application,
+ .in_args = GDBUS_ARGS_INFO({ "application", "o" })
+ },
{ NULL }
};

@@ -732,10 +739,15 @@ end:
}

static const GDBusMethodTable health_channels_methods[] = {
- {"GetProperties","", "a{sv}", channel_get_properties },
- {"Acquire", "", "h", channel_acquire,
- G_DBUS_METHOD_FLAG_ASYNC },
- {"Release", "", "", channel_release },
+ {
+ "GetProperties", "", "a{sv}", channel_get_properties,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ }, {
+ "Acquire", "", "h", channel_acquire, G_DBUS_METHOD_FLAG_ASYNC,
+ .out_args = GDBUS_ARGS_INFO({ "fd", "h" })
+ }, {
+ "Release", "", "", channel_release
+ },
{ NULL }
};

@@ -2094,20 +2106,37 @@ static void health_device_destroy(void *data)
}

static const GDBusMethodTable health_device_methods[] = {
- {"Echo", "", "b", device_echo,
- G_DBUS_METHOD_FLAG_ASYNC },
- {"CreateChannel", "os", "o", device_create_channel,
- G_DBUS_METHOD_FLAG_ASYNC },
- {"DestroyChannel", "o", "", device_destroy_channel,
- G_DBUS_METHOD_FLAG_ASYNC },
- {"GetProperties", "", "a{sv}", device_get_properties},
+ {
+ "Echo", "", "b", device_echo, G_DBUS_METHOD_FLAG_ASYNC,
+ .out_args = GDBUS_ARGS_INFO({ "value", "b" })
+ }, {
+ "CreateChannel", "os", "o", device_create_channel,
+ G_DBUS_METHOD_FLAG_ASYNC,
+ .in_args = GDBUS_ARGS_INFO({ "application", "o" },
+ { "configuration", "s" }),
+ .out_args = GDBUS_ARGS_INFO({ "channel", "o" })
+ }, {
+ "DestroyChannel", "o", "", device_destroy_channel,
+ G_DBUS_METHOD_FLAG_ASYNC,
+ .in_args = GDBUS_ARGS_INFO({ "channel", "o" })
+ }, {
+ "GetProperties", "", "a{sv}", device_get_properties,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ },
{ NULL }
};

static const GDBusSignalTable health_device_signals[] = {
- {"ChannelConnected", "o" },
- {"ChannelDeleted", "o" },
- {"PropertyChanged", "sv" },
+ {
+ "ChannelConnected", "o",
+ .args = GDBUS_ARGS_INFO({ "channel", "o" })
+ }, {
+ "ChannelDeleted", "o",
+ .args = GDBUS_ARGS_INFO({ "channel", "o" })
+ }, {
+ "PropertyChanged", "sv",
+ .args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ },
{ NULL }
};

diff --git a/input/device.c b/input/device.c
index af90e6d..ac18ced 100644
--- a/input/device.c
+++ b/input/device.c
@@ -1064,12 +1064,18 @@ static const GDBusMethodTable device_methods[] = {
{ "Connect", "", "", input_device_connect,
G_DBUS_METHOD_FLAG_ASYNC },
{ "Disconnect", "", "", input_device_disconnect },
- { "GetProperties", "", "a{sv}",input_device_get_properties },
+ {
+ "GetProperties", "", "a{sv}", input_device_get_properties,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ },
{ }
};

static const GDBusSignalTable device_signals[] = {
- { "PropertyChanged", "sv" },
+ {
+ "PropertyChanged", "sv",
+ .args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ },
{ }
};

diff --git a/network/connection.c b/network/connection.c
index 77d91d6..d7ec420 100644
--- a/network/connection.c
+++ b/network/connection.c
@@ -553,15 +553,25 @@ static void path_unregister(void *data)
}

static const GDBusMethodTable connection_methods[] = {
- { "Connect", "s", "s", connection_connect,
- G_DBUS_METHOD_FLAG_ASYNC },
- { "Disconnect", "", "", connection_disconnect },
- { "GetProperties", "", "a{sv}",connection_get_properties },
+ {
+ "Connect", "s", "s", connection_connect,
+ G_DBUS_METHOD_FLAG_ASYNC,
+ .in_args = GDBUS_ARGS_INFO({ "uuid", "s" }),
+ .out_args = GDBUS_ARGS_INFO({ "interface_name", "" }),
+ }, {
+ "Disconnect", "", "", connection_disconnect
+ }, {
+ "GetProperties", "", "a{sv}", connection_get_properties,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ },
{ }
};

static const GDBusSignalTable connection_signals[] = {
- { "PropertyChanged", "sv" },
+ {
+ "PropertyChanged", "sv",
+ .args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ },
{ }
};

diff --git a/network/server.c b/network/server.c
index 688ec7d..1a6dbf0 100644
--- a/network/server.c
+++ b/network/server.c
@@ -686,8 +686,13 @@ static void path_unregister(void *data)
}

static const GDBusMethodTable server_methods[] = {
- { "Register", "ss", "", register_server },
- { "Unregister", "s", "", unregister_server },
+ {
+ "Register", "ss", "", register_server,
+ .in_args = GDBUS_ARGS_INFO({ "uuid", "s" }, { "bridge", "s" })
+ }, {
+ "Unregister", "s", "", unregister_server,
+ .in_args = GDBUS_ARGS_INFO({ "uuid", "s" })
+ },
{ }
};

diff --git a/plugins/dbusoob.c b/plugins/dbusoob.c
index bcd0556..9ff4a30 100644
--- a/plugins/dbusoob.c
+++ b/plugins/dbusoob.c
@@ -176,10 +176,19 @@ static DBusMessage *remove_remote_data(DBusConnection *conn, DBusMessage *msg,
}

static const GDBusMethodTable oob_methods[] = {
- {"AddRemoteData", "sayay", "", add_remote_data},
- {"RemoveRemoteData", "s", "", remove_remote_data},
- {"ReadLocalData", "", "ayay", read_local_data,
- G_DBUS_METHOD_FLAG_ASYNC},
+ {
+ "AddRemoteData", "sayay", "", add_remote_data,
+ .in_args = GDBUS_ARGS_INFO({ "address", "s" },
+ { "hash", "ay" }, { "randomizer", "ay" })
+ }, {
+ "RemoveRemoteData", "s", "", remove_remote_data,
+ .in_args = GDBUS_ARGS_INFO({ "address", "s" })
+ }, {
+ "ReadLocalData", "", "ayay", read_local_data,
+ G_DBUS_METHOD_FLAG_ASYNC,
+ .out_args = GDBUS_ARGS_INFO({ "hash", "ay" },
+ { "randomizer", "ay" })
+ },
{}
};

diff --git a/plugins/service.c b/plugins/service.c
index 978e371..b326564 100644
--- a/plugins/service.c
+++ b/plugins/service.c
@@ -697,12 +697,22 @@ done:
}

static const GDBusMethodTable service_methods[] = {
- { "AddRecord", "s", "u", add_service_record },
- { "UpdateRecord", "us", "", update_service_record },
- { "RemoveRecord", "u", "", remove_service_record },
- { "RequestAuthorization","su", "", request_authorization,
- G_DBUS_METHOD_FLAG_ASYNC},
- { "CancelAuthorization", "", "", cancel_authorization },
+ {
+ "AddRecord", "s", "u", add_service_record,
+ .in_args = GDBUS_ARGS_INFO({ "record", "s" }),
+ .out_args = GDBUS_ARGS_INFO({ "handle", "u" })
+ }, {
+ "UpdateRecord", "us", "", update_service_record,
+ .in_args = GDBUS_ARGS_INFO({ "handle", "u" }, { "record", "s" })
+ }, {
+ "RemoveRecord", "u", "", remove_service_record,
+ .in_args = GDBUS_ARGS_INFO({ "handle", "u" })
+ }, {
+ "RequestAuthorization", "su", "", request_authorization,
+ G_DBUS_METHOD_FLAG_ASYNC,
+ .in_args = GDBUS_ARGS_INFO({ "address", "s" }, { "handle", "u"})
+ },
+ { "CancelAuthorization", "", "", cancel_authorization },
{ }
};

diff --git a/proximity/monitor.c b/proximity/monitor.c
index b4a52d2..1382ef8 100644
--- a/proximity/monitor.c
+++ b/proximity/monitor.c
@@ -547,14 +547,21 @@ static DBusMessage *set_property(DBusConnection *conn,
}

static const GDBusMethodTable monitor_methods[] = {
- { "GetProperties", "", "a{sv}", get_properties },
- { "SetProperty", "sv", "", set_property,
- G_DBUS_METHOD_FLAG_ASYNC},
+ {
+ "GetProperties", "", "a{sv}", get_properties,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ }, {
+ "SetProperty", "sv", "", set_property, G_DBUS_METHOD_FLAG_ASYNC,
+ .in_args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ },
{ }
};

static const GDBusSignalTable monitor_signals[] = {
- { "PropertyChanged", "sv" },
+ {
+ "PropertyChanged", "sv",
+ .args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ },
{ }
};

diff --git a/proximity/reporter.c b/proximity/reporter.c
index 0a89537..59595fc 100644
--- a/proximity/reporter.c
+++ b/proximity/reporter.c
@@ -181,12 +181,18 @@ err:
}

static const GDBusMethodTable reporter_methods[] = {
- { "GetProperties", "", "a{sv}", get_properties },
+ {
+ "GetProperties", "", "a{sv}", get_properties,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ },
{ }
};

static const GDBusSignalTable reporter_signals[] = {
- { "PropertyChanged", "sv" },
+ {
+ "PropertyChanged", "sv",
+ .args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ },
{ }
};

diff --git a/sap/sap-dummy.c b/sap/sap-dummy.c
index a2f2968..ffa53d7 100644
--- a/sap/sap-dummy.c
+++ b/sap/sap-dummy.c
@@ -316,10 +316,18 @@ static DBusMessage *card_status(DBusConnection *conn, DBusMessage *msg,
}

static const GDBusMethodTable dummy_methods[] = {
- { "OngoingCall", "b", "", ongoing_call},
- { "MaxMessageSize", "u", "", max_msg_size},
- { "DisconnectImmediate", "", "", disconnect_immediate},
- { "CardStatus", "u", "", card_status},
+ {
+ "OngoingCall", "b", "", ongoing_call,
+ .in_args = GDBUS_ARGS_INFO({ "ongoing", "b" })
+ }, {
+ "MaxMessageSize", "u", "", max_msg_size,
+ .in_args = GDBUS_ARGS_INFO({ "size", "u" })
+ }, {
+ "DisconnectImmediate", "", "", disconnect_immediate,
+ }, {
+ "CardStatus", "u", "", card_status,
+ .in_args = GDBUS_ARGS_INFO({ "status", "" })
+ },
{ }
};

diff --git a/sap/server.c b/sap/server.c
index b212ea0..bae6478 100644
--- a/sap/server.c
+++ b/sap/server.c
@@ -1304,13 +1304,19 @@ static DBusMessage *get_properties(DBusConnection *c,
}

static const GDBusMethodTable server_methods[] = {
- {"GetProperties", "", "a{sv}", get_properties},
+ {
+ "GetProperties", "", "a{sv}", get_properties,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ },
{"Disconnect", "", "", disconnect},
{ }
};

static const GDBusSignalTable server_signals[] = {
- { "PropertyChanged", "sv"},
+ {
+ "PropertyChanged", "sv",
+ .args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ },
{ }
};

diff --git a/serial/port.c b/serial/port.c
index 1c48bf7..2be1951 100644
--- a/serial/port.c
+++ b/serial/port.c
@@ -568,9 +568,18 @@ static DBusMessage *port_disconnect(DBusConnection *conn,
}

static const GDBusMethodTable port_methods[] = {
- { "Connect", "s", "s", port_connect, G_DBUS_METHOD_FLAG_ASYNC },
- { "ConnectFD", "s", "h", port_connect, G_DBUS_METHOD_FLAG_ASYNC },
- { "Disconnect", "s", "", port_disconnect },
+ {
+ "Connect", "s", "s", port_connect, G_DBUS_METHOD_FLAG_ASYNC,
+ .in_args = GDBUS_ARGS_INFO({ "pattern", "s" }),
+ .out_args = GDBUS_ARGS_INFO({ "tty", "s" })
+ }, {
+ "ConnectFD", "s", "h", port_connect, G_DBUS_METHOD_FLAG_ASYNC,
+ .in_args = GDBUS_ARGS_INFO({ "pattern", "s" }),
+ .out_args = GDBUS_ARGS_INFO({ "fd", "s" })
+ }, {
+ "Disconnect", "s", "", port_disconnect,
+ .in_args = GDBUS_ARGS_INFO({ "device", "s" }),
+ },
{ }
};

diff --git a/serial/proxy.c b/serial/proxy.c
index 5a91186..aa9ba62 100644
--- a/serial/proxy.c
+++ b/serial/proxy.c
@@ -729,10 +729,16 @@ static DBusMessage *proxy_set_serial_params(DBusConnection *conn,
}

static const GDBusMethodTable proxy_methods[] = {
- { "Enable", "", "", proxy_enable },
- { "Disable", "", "", proxy_disable },
- { "GetInfo", "", "a{sv}",proxy_get_info },
- { "SetSerialParameters", "syys", "", proxy_set_serial_params },
+ { "Enable", "", "", proxy_enable },
+ { "Disable", "", "", proxy_disable },
+ {
+ "GetInfo", "", "a{sv}", proxy_get_info,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ }, {
+ "SetSerialParameters", "syys", "", proxy_set_serial_params,
+ .in_args = GDBUS_ARGS_INFO({ "rate", "s" }, { "data", "y" },
+ { "stop", "y" }, { "parity", "s" })
+ },
{ },
};

@@ -1112,15 +1118,23 @@ static void manager_path_unregister(void *data)
}

static const GDBusMethodTable manager_methods[] = {
- { "CreateProxy", "ss", "s", create_proxy },
- { "ListProxies", "", "as", list_proxies },
- { "RemoveProxy", "s", "", remove_proxy },
+ {
+ "CreateProxy", "ss", "s", create_proxy,
+ .in_args = GDBUS_ARGS_INFO({ "pattern", "s" },
+ { "address", "s" })
+ }, {
+ "ListProxies", "", "as", list_proxies,
+ .out_args = GDBUS_ARGS_INFO({ "paths", "as" })
+ }, {
+ "RemoveProxy", "s", "", remove_proxy,
+ .in_args = GDBUS_ARGS_INFO({ "path", "s" })
+ },
{ },
};

static const GDBusSignalTable manager_signals[] = {
- { "ProxyCreated", "s" },
- { "ProxyRemoved", "s" },
+ { "ProxyCreated", "s", .args = GDBUS_ARGS_INFO({ "path", "s" }) },
+ { "ProxyRemoved", "s", .args = GDBUS_ARGS_INFO({ "path", "s" }) },
{ }
};

diff --git a/src/adapter.c b/src/adapter.c
index 9dfed54..2fce399 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1656,37 +1656,75 @@ static DBusMessage *unregister_agent(DBusConnection *conn, DBusMessage *msg,
}

static const GDBusMethodTable adapter_methods[] = {
- { "GetProperties", "", "a{sv}",get_properties },
- { "SetProperty", "sv", "", set_property,
+ {
+ "GetProperties", "", "a{sv}", get_properties,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ }, {
+ "SetProperty", "sv", "", set_property, G_DBUS_METHOD_FLAG_ASYNC,
+ .in_args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ },
+ { "RequestSession", "", "", request_session,
G_DBUS_METHOD_FLAG_ASYNC},
- { "RequestSession", "", "", request_session,
+ { "ReleaseSession", "", "", release_session },
+ { "StartDiscovery", "", "", adapter_start_discovery },
+ { "StopDiscovery", "", "", adapter_stop_discovery,
G_DBUS_METHOD_FLAG_ASYNC},
- { "ReleaseSession", "", "", release_session },
- { "StartDiscovery", "", "", adapter_start_discovery },
- { "StopDiscovery", "", "", adapter_stop_discovery,
- G_DBUS_METHOD_FLAG_ASYNC},
- { "ListDevices", "", "ao", list_devices,
- G_DBUS_METHOD_FLAG_DEPRECATED},
- { "CreateDevice", "s", "o", create_device,
- G_DBUS_METHOD_FLAG_ASYNC},
- { "CreatePairedDevice", "sos", "o", create_paired_device,
- G_DBUS_METHOD_FLAG_ASYNC},
- { "CancelDeviceCreation","s", "", cancel_device_creation,
- G_DBUS_METHOD_FLAG_ASYNC},
- { "RemoveDevice", "o", "", remove_device,
- G_DBUS_METHOD_FLAG_ASYNC},
- { "FindDevice", "s", "o", find_device },
- { "RegisterAgent", "os", "", register_agent },
- { "UnregisterAgent", "o", "", unregister_agent },
+ {
+ "ListDevices", "", "ao", list_devices,
+ G_DBUS_METHOD_FLAG_DEPRECATED,
+ .out_args = GDBUS_ARGS_INFO({ "devices", "ao" })
+ }, {
+ "CreateDevice", "s", "o", create_device,
+ G_DBUS_METHOD_FLAG_ASYNC,
+ .in_args = GDBUS_ARGS_INFO({ "address", "s" }),
+ .out_args = GDBUS_ARGS_INFO({ "device", "o" }),
+ }, {
+ "CreatePairedDevice", "sos", "o", create_paired_device,
+ G_DBUS_METHOD_FLAG_ASYNC,
+ .in_args = GDBUS_ARGS_INFO({ "address", "s" },
+ { "agent", "o" }, { "capability", "s" }),
+ .out_args = GDBUS_ARGS_INFO({ "device", "o" })
+ }, {
+ "CancelDeviceCreation", "s", "", cancel_device_creation,
+ G_DBUS_METHOD_FLAG_ASYNC,
+ .in_args = GDBUS_ARGS_INFO({ "address", "s" })
+ }, {
+ "RemoveDevice", "o", "", remove_device,
+ G_DBUS_METHOD_FLAG_ASYNC,
+ .in_args = GDBUS_ARGS_INFO({ "device", "o" })
+ }, {
+ "FindDevice", "s", "o", find_device,
+ .in_args = GDBUS_ARGS_INFO({ "address", "s" }),
+ .out_args = GDBUS_ARGS_INFO({ "device", "o" })
+ }, {
+ "RegisterAgent", "os", "", register_agent,
+ .in_args = GDBUS_ARGS_INFO({ "agent", "o" },
+ { "capability", "s" }),
+ }, {
+ "UnregisterAgent", "o", "", unregister_agent,
+ .in_args = GDBUS_ARGS_INFO({ "agent", "o" })
+ },
{ }
};

static const GDBusSignalTable adapter_signals[] = {
- { "PropertyChanged", "sv" },
- { "DeviceCreated", "o" },
- { "DeviceRemoved", "o" },
- { "DeviceFound", "sa{sv}" },
- { "DeviceDisappeared", "s" },
+ {
+ "PropertyChanged", "sv",
+ .args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ }, {
+ "DeviceCreated", "o",
+ .args = GDBUS_ARGS_INFO({ "device", "o" })
+ }, {
+ "DeviceRemoved", "o",
+ .args = GDBUS_ARGS_INFO({ "device", "o" })
+ }, {
+ "DeviceFound", "sa{sv}",
+ .args = GDBUS_ARGS_INFO({ "address", "s" },
+ { "values", "a{sv}" })
+ }, {
+ "DeviceDisappeared", "s",
+ .args = GDBUS_ARGS_INFO({ "address", "s" })
+ },
{ }
};

diff --git a/src/device.c b/src/device.c
index 16f9d7a..66672d4 100644
--- a/src/device.c
+++ b/src/device.c
@@ -878,19 +878,29 @@ static DBusMessage *disconnect(DBusConnection *conn, DBusMessage *msg,
}

static const GDBusMethodTable device_methods[] = {
- { "GetProperties", "", "a{sv}", get_properties },
- { "SetProperty", "sv", "", set_property },
- { "DiscoverServices", "s", "a{us}", discover_services,
- G_DBUS_METHOD_FLAG_ASYNC},
- { "CancelDiscovery", "", "", cancel_discover },
- { "Disconnect", "", "", disconnect,
- G_DBUS_METHOD_FLAG_ASYNC},
+ {
+ "GetProperties", "", "a{sv}", get_properties,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ }, {
+ "SetProperty", "sv", "", set_property,
+ .in_args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ }, {
+ "DiscoverServices", "s", "a{us}", discover_services,
+ G_DBUS_METHOD_FLAG_ASYNC,
+ .in_args = GDBUS_ARGS_INFO({ "pattern", "s" }),
+ .out_args = GDBUS_ARGS_INFO({ "services", "a{us}" })
+ },
+ { "CancelDiscovery", "", "", cancel_discover },
+ { "Disconnect", "", "", disconnect, G_DBUS_METHOD_FLAG_ASYNC},
{ }
};

static const GDBusSignalTable device_signals[] = {
- { "PropertyChanged", "sv" },
- { "DisconnectRequested", "" },
+ {
+ "PropertyChanged", "sv",
+ .args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ },
+ { "DisconnectRequested", "" },
{ }
};

diff --git a/src/manager.c b/src/manager.c
index e6c1675..002118b 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -197,19 +197,38 @@ static DBusMessage *get_properties(DBusConnection *conn,
}

static const GDBusMethodTable manager_methods[] = {
- { "GetProperties", "", "a{sv}",get_properties },
- { "DefaultAdapter", "", "o", default_adapter },
- { "FindAdapter", "s", "o", find_adapter },
- { "ListAdapters", "", "ao", list_adapters,
- G_DBUS_METHOD_FLAG_DEPRECATED},
+ {
+ "GetProperties", "", "a{sv}", get_properties,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ }, {
+ "DefaultAdapter", "", "o", default_adapter,
+ .out_args = GDBUS_ARGS_INFO({ "adapter", "o" })
+ }, {
+ "FindAdapter", "s", "o", find_adapter,
+ .in_args = GDBUS_ARGS_INFO({ "pattern", "s" }),
+ .out_args = GDBUS_ARGS_INFO({ "adapter", "o" })
+ }, {
+ "ListAdapters", "", "ao", list_adapters,
+ G_DBUS_METHOD_FLAG_DEPRECATED,
+ .out_args = GDBUS_ARGS_INFO({ "adapters", "ao" })
+ },
{ }
};

static const GDBusSignalTable manager_signals[] = {
- { "PropertyChanged", "sv" },
- { "AdapterAdded", "o" },
- { "AdapterRemoved", "o" },
- { "DefaultAdapterChanged", "o" },
+ {
+ "PropertyChanged", "sv",
+ .args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ }, {
+ "AdapterAdded", "o",
+ .args = GDBUS_ARGS_INFO({ "adapter", "s" })
+ }, {
+ "AdapterRemoved", "o",
+ .args = GDBUS_ARGS_INFO({ "adapter", "s" })
+ }, {
+ "DefaultAdapterChanged", "o",
+ .args = GDBUS_ARGS_INFO({ "adapter", "s" })
+ },
{ }
};

diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
index 1f7b6a6..137b712 100644
--- a/thermometer/thermometer.c
+++ b/thermometer/thermometer.c
@@ -960,18 +960,33 @@ static DBusMessage *disable_intermediate(DBusConnection *conn, DBusMessage *msg,
}

static const GDBusMethodTable thermometer_methods[] = {
- { "GetProperties", "", "a{sv}", get_properties },
- { "SetProperty", "sv", "", set_property,
- G_DBUS_METHOD_FLAG_ASYNC },
- { "RegisterWatcher", "o", "", register_watcher },
- { "UnregisterWatcher", "o", "", unregister_watcher },
- { "EnableIntermediateMeasurement", "o", "", enable_intermediate },
- { "DisableIntermediateMeasurement","o", "", disable_intermediate },
+ {
+ "GetProperties", "", "a{sv}", get_properties,
+ .out_args = GDBUS_ARGS_INFO({ "properties", "a{sv}" })
+ }, {
+ "SetProperty", "sv", "", set_property, G_DBUS_METHOD_FLAG_ASYNC,
+ .in_args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ }, {
+ "RegisterWatcher", "o", "", register_watcher,
+ .in_args = GDBUS_ARGS_INFO({ "agent", "o" })
+ }, {
+ "UnregisterWatcher", "o", "", unregister_watcher,
+ .in_args = GDBUS_ARGS_INFO({ "agent", "o" })
+ }, {
+ "EnableIntermediateMeasurement", "o", "", enable_intermediate,
+ .in_args = GDBUS_ARGS_INFO({ "agent", "o" })
+ }, {
+ "DisableIntermediateMeasurement","o", "", disable_intermediate,
+ .in_args = GDBUS_ARGS_INFO({ "agent", "o" })
+ },
{ }
};

static const GDBusSignalTable thermometer_signals[] = {
- { "PropertyChanged", "sv" },
+ {
+ "PropertyChanged", "sv",
+ .args = GDBUS_ARGS_INFO({ "name", "s" }, { "value", "v" })
+ },
{ }
};

--
1.7.10.2


2012-05-16 23:33:08

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ v5 08/13] gdbus: loop over args to check message signature

---
gdbus/object.c | 34 +++++++++++++++++++++++++++-------
1 file changed, 27 insertions(+), 7 deletions(-)

diff --git a/gdbus/object.c b/gdbus/object.c
index b999323..db987dc 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -374,6 +374,27 @@ static struct interface_data *find_interface(GSList *interfaces,
return NULL;
}

+static gboolean g_dbus_args_have_signature(const GDBusArgInfo *args,
+ DBusMessage *message)
+{
+ const char *sig = dbus_message_get_signature(message);
+ const char *p = NULL;
+
+ for (; args && args->signature && *sig; args++) {
+ p = args->signature;
+
+ for (; *sig && *p; sig++, p++) {
+ if (*p != *sig)
+ return FALSE;
+ }
+ }
+
+ if (*sig || (p && *p) || (args && args->signature))
+ return FALSE;
+
+ return TRUE;
+}
+
static DBusHandlerResult generic_message(DBusConnection *connection,
DBusMessage *message, void *user_data)
{
@@ -394,8 +415,8 @@ static DBusHandlerResult generic_message(DBusConnection *connection,
method->name) == FALSE)
continue;

- if (dbus_message_has_signature(message,
- method->signature) == FALSE)
+ if (g_dbus_args_have_signature(method->in_args,
+ message) == FALSE)
continue;

if (check_privilege(connection, message, method,
@@ -554,7 +575,7 @@ static void object_path_unref(DBusConnection *connection, const char *path)

static gboolean check_signal(DBusConnection *conn, const char *path,
const char *interface, const char *name,
- const char **args)
+ const GDBusArgInfo **args)
{
struct generic_data *data = NULL;
struct interface_data *iface;
@@ -577,7 +598,7 @@ static gboolean check_signal(DBusConnection *conn, const char *path,

for (signal = iface->signals; signal && signal->name; signal++) {
if (!strcmp(signal->name, name)) {
- *args = signal->signature;
+ *args = signal->args;
break;
}
}
@@ -599,7 +620,7 @@ static dbus_bool_t emit_signal_valist(DBusConnection *conn,
{
DBusMessage *signal;
dbus_bool_t ret;
- const char *signature, *args;
+ const GDBusArgInfo *args;

if (!check_signal(conn, path, interface, name, &args))
return FALSE;
@@ -614,8 +635,7 @@ static dbus_bool_t emit_signal_valist(DBusConnection *conn,
if (!ret)
goto fail;

- signature = dbus_message_get_signature(signal);
- if (strcmp(args, signature) != 0) {
+ if (g_dbus_args_have_signature(args, signal) == FALSE) {
error("%s.%s: expected signature'%s' but got '%s'",
interface, name, args, signature);
ret = FALSE;
--
1.7.10.2


2012-05-16 23:33:07

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ v5 07/13] gdbus: use GDBusArgInfo to generate introspection

By using GDBusArgInfo in methods and signals, the introspection
generation is much simpler and we can add each argument name.
---
gdbus/object.c | 75 +++++++++++---------------------------------------------
1 file changed, 14 insertions(+), 61 deletions(-)

diff --git a/gdbus/object.c b/gdbus/object.c
index e99757f..b999323 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -59,68 +59,20 @@ struct security_data {
void *iface_user_data;
};

-static void print_arguments(GString *gstr, const char *sig,
+static void print_arguments(GString *gstr, const GDBusArgInfo *args,
const char *direction)
{
- int i;
-
- for (i = 0; sig[i]; i++) {
- char type[32];
- int struct_level, dict_level;
- unsigned int len;
- gboolean complete;
-
- complete = FALSE;
- struct_level = dict_level = 0;
-
- /* Gather enough data to have a single complete type */
- for (len = 0; len < (sizeof(type) - 1) && sig[i]; len++, i++) {
- switch (sig[i]) {
- case '(':
- struct_level++;
- break;
- case ')':
- struct_level--;
- if (struct_level <= 0 && dict_level <= 0)
- complete = TRUE;
- break;
- case '{':
- dict_level++;
- break;
- case '}':
- dict_level--;
- if (struct_level <= 0 && dict_level <= 0)
- complete = TRUE;
- break;
- case 'a':
- break;
- default:
- if (struct_level <= 0 && dict_level <= 0)
- complete = TRUE;
- break;
- }
-
- type[len] = sig[i];
-
- if (complete)
- break;
- }
-
- type[len + 1] = '\0';
-
- if (!complete) {
- error("Unexpected signature: %s", sig);
- return;
- }
+ for (; args && args->name; args++) {
+ g_string_append_printf(gstr,
+ "\t\t\t<arg name=\"%s\" type=\"%s\"",
+ args->name, args->signature);

if (direction)
g_string_append_printf(gstr,
- "\t\t\t<arg type=\"%s\" direction=\"%s\"/>\n",
- type, direction);
+ " direction=\"%s\"/>\n", direction);
else
- g_string_append_printf(gstr,
- "\t\t\t<arg type=\"%s\"/>\n",
- type);
+ g_string_append_printf(gstr, "/>\n");
+
}
}

@@ -130,26 +82,27 @@ static void generate_interface_xml(GString *gstr, struct interface_data *iface)
const GDBusSignalTable *signal;

for (method = iface->methods; method && method->name; method++) {
- if (!strlen(method->signature) && !strlen(method->reply))
+ if (!(method->in_args && method->in_args->name) &&
+ !(method->out_args && method->out_args->name))
g_string_append_printf(gstr, "\t\t<method name=\"%s\"/>\n",
method->name);
else {
g_string_append_printf(gstr, "\t\t<method name=\"%s\">\n",
method->name);
- print_arguments(gstr, method->signature, "in");
- print_arguments(gstr, method->reply, "out");
+ print_arguments(gstr, method->in_args, "in");
+ print_arguments(gstr, method->out_args, "out");
g_string_append_printf(gstr, "\t\t</method>\n");
}
}

for (signal = iface->signals; signal && signal->name; signal++) {
- if (!strlen(signal->signature))
+ if (!(signal->args && signal->args->name))
g_string_append_printf(gstr, "\t\t<signal name=\"%s\"/>\n",
signal->name);
else {
g_string_append_printf(gstr, "\t\t<signal name=\"%s\">\n",
signal->name);
- print_arguments(gstr, signal->signature, NULL);
+ print_arguments(gstr, signal->args, NULL);
g_string_append_printf(gstr, "\t\t</signal>\n");
}
}
--
1.7.10.2


2012-05-16 23:33:05

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ v5 05/13] gdbus: add argument info to methods and signals

---
gdbus/gdbus.h | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/gdbus/gdbus.h b/gdbus/gdbus.h
index a0583e6..610cb19 100644
--- a/gdbus/gdbus.h
+++ b/gdbus/gdbus.h
@@ -85,16 +85,26 @@ typedef enum {
typedef struct {
const char *name;
const char *signature;
+} GDBusArgInfo;
+
+#define GDBUS_ARGS_INFO(args...) (const GDBusArgInfo[]) { args, { } }
+
+typedef struct {
+ const char *name;
+ const char *signature;
const char *reply;
GDBusMethodFunction function;
GDBusMethodFlags flags;
unsigned int privilege;
+ const GDBusArgInfo *in_args;
+ const GDBusArgInfo *out_args;
} GDBusMethodTable;

typedef struct {
const char *name;
const char *signature;
GDBusSignalFlags flags;
+ const GDBusArgInfo *args;
} GDBusSignalTable;

typedef struct {
--
1.7.10.2


2012-05-16 23:33:04

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ v5 04/13] Constify GDBus signal tables

Constify signal tables with the following command:

find . -name '*.[ch]' -exec \
sed -i 's/\(GDBusSignalTable .* =\)/const \1/g' {} \;
---
audio/control.c | 2 +-
audio/device.c | 2 +-
audio/gateway.c | 2 +-
audio/headset.c | 2 +-
audio/sink.c | 2 +-
audio/source.c | 2 +-
audio/telephony-dummy.c | 2 +-
audio/transport.c | 2 +-
health/hdp.c | 2 +-
input/device.c | 2 +-
network/connection.c | 2 +-
proximity/monitor.c | 2 +-
proximity/reporter.c | 2 +-
sap/server.c | 2 +-
serial/proxy.c | 2 +-
src/adapter.c | 2 +-
src/device.c | 2 +-
src/manager.c | 2 +-
thermometer/thermometer.c | 2 +-
19 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/audio/control.c b/audio/control.c
index 14820c8..da23535 100644
--- a/audio/control.c
+++ b/audio/control.c
@@ -206,7 +206,7 @@ static const GDBusMethodTable control_methods[] = {
{ NULL, NULL, NULL, NULL }
};

-static GDBusSignalTable control_signals[] = {
+static const GDBusSignalTable control_signals[] = {
{ "Connected", "", G_DBUS_SIGNAL_FLAG_DEPRECATED},
{ "Disconnected", "", G_DBUS_SIGNAL_FLAG_DEPRECATED},
{ "PropertyChanged", "sv" },
diff --git a/audio/device.c b/audio/device.c
index 7f454bb..ac00f1d 100644
--- a/audio/device.c
+++ b/audio/device.c
@@ -626,7 +626,7 @@ static const GDBusMethodTable dev_methods[] = {
{ NULL, NULL, NULL, NULL }
};

-static GDBusSignalTable dev_signals[] = {
+static const GDBusSignalTable dev_signals[] = {
{ "PropertyChanged", "sv" },
{ NULL, NULL }
};
diff --git a/audio/gateway.c b/audio/gateway.c
index 5eee163..9194a7c 100644
--- a/audio/gateway.c
+++ b/audio/gateway.c
@@ -721,7 +721,7 @@ static const GDBusMethodTable gateway_methods[] = {
{ NULL, NULL, NULL, NULL }
};

-static GDBusSignalTable gateway_signals[] = {
+static const GDBusSignalTable gateway_signals[] = {
{ "PropertyChanged", "sv" },
{ NULL, NULL }
};
diff --git a/audio/headset.c b/audio/headset.c
index ca8f711..ebe9a7c 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -2083,7 +2083,7 @@ static const GDBusMethodTable headset_methods[] = {
{ NULL, NULL, NULL, NULL }
};

-static GDBusSignalTable headset_signals[] = {
+static const GDBusSignalTable headset_signals[] = {
{ "Connected", "", G_DBUS_SIGNAL_FLAG_DEPRECATED },
{ "Disconnected", "", G_DBUS_SIGNAL_FLAG_DEPRECATED },
{ "AnswerRequested", "" },
diff --git a/audio/sink.c b/audio/sink.c
index ea7f26e..fe4dd4b 100644
--- a/audio/sink.c
+++ b/audio/sink.c
@@ -566,7 +566,7 @@ static const GDBusMethodTable sink_methods[] = {
{ NULL, NULL, NULL, NULL }
};

-static GDBusSignalTable sink_signals[] = {
+static const GDBusSignalTable sink_signals[] = {
{ "Connected", "", G_DBUS_SIGNAL_FLAG_DEPRECATED },
{ "Disconnected", "", G_DBUS_SIGNAL_FLAG_DEPRECATED },
{ "Playing", "", G_DBUS_SIGNAL_FLAG_DEPRECATED },
diff --git a/audio/source.c b/audio/source.c
index 98f3e3f..04bf131 100644
--- a/audio/source.c
+++ b/audio/source.c
@@ -485,7 +485,7 @@ static const GDBusMethodTable source_methods[] = {
{ NULL, NULL, NULL, NULL }
};

-static GDBusSignalTable source_signals[] = {
+static const GDBusSignalTable source_signals[] = {
{ "PropertyChanged", "sv" },
{ NULL, NULL }
};
diff --git a/audio/telephony-dummy.c b/audio/telephony-dummy.c
index 83c5a13..1885b4a 100644
--- a/audio/telephony-dummy.c
+++ b/audio/telephony-dummy.c
@@ -390,7 +390,7 @@ static const GDBusMethodTable dummy_methods[] = {
{ }
};

-static GDBusSignalTable dummy_signals[] = {
+static const GDBusSignalTable dummy_signals[] = {
{ "VoiceDial", "" },
{ }
};
diff --git a/audio/transport.c b/audio/transport.c
index e9e40c6..7223f38 100644
--- a/audio/transport.c
+++ b/audio/transport.c
@@ -924,7 +924,7 @@ static const GDBusMethodTable transport_methods[] = {
{ },
};

-static GDBusSignalTable transport_signals[] = {
+static const GDBusSignalTable transport_signals[] = {
{ "PropertyChanged", "sv" },
{ }
};
diff --git a/health/hdp.c b/health/hdp.c
index 2d3f9bb..3b1ea49 100644
--- a/health/hdp.c
+++ b/health/hdp.c
@@ -2104,7 +2104,7 @@ static const GDBusMethodTable health_device_methods[] = {
{ NULL }
};

-static GDBusSignalTable health_device_signals[] = {
+static const GDBusSignalTable health_device_signals[] = {
{"ChannelConnected", "o" },
{"ChannelDeleted", "o" },
{"PropertyChanged", "sv" },
diff --git a/input/device.c b/input/device.c
index 2d8d724..af90e6d 100644
--- a/input/device.c
+++ b/input/device.c
@@ -1068,7 +1068,7 @@ static const GDBusMethodTable device_methods[] = {
{ }
};

-static GDBusSignalTable device_signals[] = {
+static const GDBusSignalTable device_signals[] = {
{ "PropertyChanged", "sv" },
{ }
};
diff --git a/network/connection.c b/network/connection.c
index d1d417e..77d91d6 100644
--- a/network/connection.c
+++ b/network/connection.c
@@ -560,7 +560,7 @@ static const GDBusMethodTable connection_methods[] = {
{ }
};

-static GDBusSignalTable connection_signals[] = {
+static const GDBusSignalTable connection_signals[] = {
{ "PropertyChanged", "sv" },
{ }
};
diff --git a/proximity/monitor.c b/proximity/monitor.c
index cc90195..b4a52d2 100644
--- a/proximity/monitor.c
+++ b/proximity/monitor.c
@@ -553,7 +553,7 @@ static const GDBusMethodTable monitor_methods[] = {
{ }
};

-static GDBusSignalTable monitor_signals[] = {
+static const GDBusSignalTable monitor_signals[] = {
{ "PropertyChanged", "sv" },
{ }
};
diff --git a/proximity/reporter.c b/proximity/reporter.c
index 983bd33..0a89537 100644
--- a/proximity/reporter.c
+++ b/proximity/reporter.c
@@ -185,7 +185,7 @@ static const GDBusMethodTable reporter_methods[] = {
{ }
};

-static GDBusSignalTable reporter_signals[] = {
+static const GDBusSignalTable reporter_signals[] = {
{ "PropertyChanged", "sv" },
{ }
};
diff --git a/sap/server.c b/sap/server.c
index 39eddc8..b212ea0 100644
--- a/sap/server.c
+++ b/sap/server.c
@@ -1309,7 +1309,7 @@ static const GDBusMethodTable server_methods[] = {
{ }
};

-static GDBusSignalTable server_signals[] = {
+static const GDBusSignalTable server_signals[] = {
{ "PropertyChanged", "sv"},
{ }
};
diff --git a/serial/proxy.c b/serial/proxy.c
index 6c4c33f..5a91186 100644
--- a/serial/proxy.c
+++ b/serial/proxy.c
@@ -1118,7 +1118,7 @@ static const GDBusMethodTable manager_methods[] = {
{ },
};

-static GDBusSignalTable manager_signals[] = {
+static const GDBusSignalTable manager_signals[] = {
{ "ProxyCreated", "s" },
{ "ProxyRemoved", "s" },
{ }
diff --git a/src/adapter.c b/src/adapter.c
index 9c9b08d..9dfed54 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1681,7 +1681,7 @@ static const GDBusMethodTable adapter_methods[] = {
{ }
};

-static GDBusSignalTable adapter_signals[] = {
+static const GDBusSignalTable adapter_signals[] = {
{ "PropertyChanged", "sv" },
{ "DeviceCreated", "o" },
{ "DeviceRemoved", "o" },
diff --git a/src/device.c b/src/device.c
index b497431..16f9d7a 100644
--- a/src/device.c
+++ b/src/device.c
@@ -888,7 +888,7 @@ static const GDBusMethodTable device_methods[] = {
{ }
};

-static GDBusSignalTable device_signals[] = {
+static const GDBusSignalTable device_signals[] = {
{ "PropertyChanged", "sv" },
{ "DisconnectRequested", "" },
{ }
diff --git a/src/manager.c b/src/manager.c
index 8b9243e..e6c1675 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -205,7 +205,7 @@ static const GDBusMethodTable manager_methods[] = {
{ }
};

-static GDBusSignalTable manager_signals[] = {
+static const GDBusSignalTable manager_signals[] = {
{ "PropertyChanged", "sv" },
{ "AdapterAdded", "o" },
{ "AdapterRemoved", "o" },
diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
index 08117a6..1f7b6a6 100644
--- a/thermometer/thermometer.c
+++ b/thermometer/thermometer.c
@@ -970,7 +970,7 @@ static const GDBusMethodTable thermometer_methods[] = {
{ }
};

-static GDBusSignalTable thermometer_signals[] = {
+static const GDBusSignalTable thermometer_signals[] = {
{ "PropertyChanged", "sv" },
{ }
};
--
1.7.10.2


2012-05-16 23:33:03

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ v5 03/13] Constify GDBus method tables

Constify method tables with the following command:

find . -name '*.[ch]' -exec \
sed -i 's/\(GDBusMethodTable .* =\)/const \1/g' {} \;
---
attrib/client.c | 4 ++--
audio/control.c | 2 +-
audio/device.c | 2 +-
audio/gateway.c | 2 +-
audio/headset.c | 2 +-
audio/media.c | 2 +-
audio/sink.c | 2 +-
audio/source.c | 2 +-
audio/telephony-dummy.c | 2 +-
audio/telephony-maemo5.c | 2 +-
audio/transport.c | 2 +-
gdbus/object.c | 2 +-
health/hdp.c | 6 +++---
input/device.c | 2 +-
network/connection.c | 2 +-
network/server.c | 2 +-
plugins/dbusoob.c | 2 +-
plugins/service.c | 2 +-
proximity/monitor.c | 2 +-
proximity/reporter.c | 2 +-
sap/sap-dummy.c | 2 +-
sap/server.c | 2 +-
serial/port.c | 2 +-
serial/proxy.c | 4 ++--
src/adapter.c | 2 +-
src/device.c | 2 +-
src/manager.c | 2 +-
thermometer/thermometer.c | 2 +-
28 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/attrib/client.c b/attrib/client.c
index 35f1c90..2179f63 100644
--- a/attrib/client.c
+++ b/attrib/client.c
@@ -515,7 +515,7 @@ static DBusMessage *set_property(DBusConnection *conn,
return btd_error_invalid_args(msg);
}

-static GDBusMethodTable char_methods[] = {
+static const GDBusMethodTable char_methods[] = {
{ "GetProperties", "", "a{sv}", get_properties },
{ "SetProperty", "sv", "", set_property,
G_DBUS_METHOD_FLAG_ASYNC},
@@ -1015,7 +1015,7 @@ static DBusMessage *prim_get_properties(DBusConnection *conn, DBusMessage *msg,
return reply;
}

-static GDBusMethodTable prim_methods[] = {
+static const GDBusMethodTable prim_methods[] = {
{ "DiscoverCharacteristics", "", "ao", discover_char,
G_DBUS_METHOD_FLAG_ASYNC },
{ "RegisterCharacteristicsWatcher", "o", "",
diff --git a/audio/control.c b/audio/control.c
index a75e992..14820c8 100644
--- a/audio/control.c
+++ b/audio/control.c
@@ -197,7 +197,7 @@ static DBusMessage *control_get_properties(DBusConnection *conn,
return reply;
}

-static GDBusMethodTable control_methods[] = {
+static const GDBusMethodTable control_methods[] = {
{ "IsConnected", "", "b", control_is_connected,
G_DBUS_METHOD_FLAG_DEPRECATED },
{ "GetProperties", "", "a{sv}",control_get_properties },
diff --git a/audio/device.c b/audio/device.c
index ee1ade1..7f454bb 100644
--- a/audio/device.c
+++ b/audio/device.c
@@ -618,7 +618,7 @@ static DBusMessage *dev_get_properties(DBusConnection *conn, DBusMessage *msg,
return reply;
}

-static GDBusMethodTable dev_methods[] = {
+static const GDBusMethodTable dev_methods[] = {
{ "Connect", "", "", dev_connect,
G_DBUS_METHOD_FLAG_ASYNC },
{ "Disconnect", "", "", dev_disconnect },
diff --git a/audio/gateway.c b/audio/gateway.c
index 7b9347d..5eee163 100644
--- a/audio/gateway.c
+++ b/audio/gateway.c
@@ -712,7 +712,7 @@ done:
return dbus_message_new_method_return(msg);
}

-static GDBusMethodTable gateway_methods[] = {
+static const GDBusMethodTable gateway_methods[] = {
{ "Connect", "", "", ag_connect, G_DBUS_METHOD_FLAG_ASYNC },
{ "Disconnect", "", "", ag_disconnect, G_DBUS_METHOD_FLAG_ASYNC },
{ "GetProperties", "", "a{sv}", ag_get_properties },
diff --git a/audio/headset.c b/audio/headset.c
index fb10c36..ca8f711 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -2057,7 +2057,7 @@ static DBusMessage *hs_set_property(DBusConnection *conn,
return btd_error_invalid_args(msg);
}

-static GDBusMethodTable headset_methods[] = {
+static const GDBusMethodTable headset_methods[] = {
{ "Connect", "", "", hs_connect,
G_DBUS_METHOD_FLAG_ASYNC },
{ "Disconnect", "", "", hs_disconnect },
diff --git a/audio/media.c b/audio/media.c
index 61ec153..7a83fbd 100644
--- a/audio/media.c
+++ b/audio/media.c
@@ -1790,7 +1790,7 @@ static DBusMessage *unregister_player(DBusConnection *conn, DBusMessage *msg,
return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
}

-static GDBusMethodTable media_methods[] = {
+static const GDBusMethodTable media_methods[] = {
{ "RegisterEndpoint", "oa{sv}", "", register_endpoint },
{ "UnregisterEndpoint", "o", "", unregister_endpoint },
{ "RegisterPlayer", "oa{sv}a{sv}","", register_player },
diff --git a/audio/sink.c b/audio/sink.c
index 52f70a9..ea7f26e 100644
--- a/audio/sink.c
+++ b/audio/sink.c
@@ -555,7 +555,7 @@ static DBusMessage *sink_get_properties(DBusConnection *conn,
return reply;
}

-static GDBusMethodTable sink_methods[] = {
+static const GDBusMethodTable sink_methods[] = {
{ "Connect", "", "", sink_connect,
G_DBUS_METHOD_FLAG_ASYNC },
{ "Disconnect", "", "", sink_disconnect,
diff --git a/audio/source.c b/audio/source.c
index 4c6e2d0..98f3e3f 100644
--- a/audio/source.c
+++ b/audio/source.c
@@ -476,7 +476,7 @@ static DBusMessage *source_get_properties(DBusConnection *conn,
return reply;
}

-static GDBusMethodTable source_methods[] = {
+static const GDBusMethodTable source_methods[] = {
{ "Connect", "", "", source_connect,
G_DBUS_METHOD_FLAG_ASYNC },
{ "Disconnect", "", "", source_disconnect,
diff --git a/audio/telephony-dummy.c b/audio/telephony-dummy.c
index 1f89079..83c5a13 100644
--- a/audio/telephony-dummy.c
+++ b/audio/telephony-dummy.c
@@ -378,7 +378,7 @@ static DBusMessage *set_subscriber_number(DBusConnection *conn,
return dbus_message_new_method_return(msg);
}

-static GDBusMethodTable dummy_methods[] = {
+static const GDBusMethodTable dummy_methods[] = {
{ "OutgoingCall", "s", "", outgoing_call },
{ "IncomingCall", "s", "", incoming_call },
{ "CancelCall", "", "", cancel_call },
diff --git a/audio/telephony-maemo5.c b/audio/telephony-maemo5.c
index 49230f1..6ab43b4 100644
--- a/audio/telephony-maemo5.c
+++ b/audio/telephony-maemo5.c
@@ -1951,7 +1951,7 @@ static DBusMessage *set_callerid(DBusConnection *conn, DBusMessage *msg,
return btd_error_invalid_args(msg);
}

-static GDBusMethodTable telephony_maemo_methods[] = {
+static const GDBusMethodTable telephony_maemo_methods[] = {
{"SetCallerId", "s", "", set_callerid,
G_DBUS_METHOD_FLAG_ASYNC},
{ }
diff --git a/audio/transport.c b/audio/transport.c
index 7bf7309..e9e40c6 100644
--- a/audio/transport.c
+++ b/audio/transport.c
@@ -914,7 +914,7 @@ static DBusMessage *get_properties(DBusConnection *conn, DBusMessage *msg,
return reply;
}

-static GDBusMethodTable transport_methods[] = {
+static const GDBusMethodTable transport_methods[] = {
{ "GetProperties", "", "a{sv}", get_properties },
{ "Acquire", "s", "hqq", acquire,
G_DBUS_METHOD_FLAG_ASYNC},
diff --git a/gdbus/object.c b/gdbus/object.c
index e378074..0ef6c80 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -496,7 +496,7 @@ done:
g_free(parent_path);
}

-static GDBusMethodTable introspect_methods[] = {
+static const GDBusMethodTable introspect_methods[] = {
{ "Introspect", "", "s", introspect },
{ }
};
diff --git a/health/hdp.c b/health/hdp.c
index 455240c..2d3f9bb 100644
--- a/health/hdp.c
+++ b/health/hdp.c
@@ -424,7 +424,7 @@ static void manager_path_unregister(gpointer data)
g_slist_foreach(adapters, (GFunc) update_adapter, NULL);
}

-static GDBusMethodTable health_manager_methods[] = {
+static const GDBusMethodTable health_manager_methods[] = {
{"CreateApplication", "a{sv}", "o", manager_create_application},
{"DestroyApplication", "o", "", manager_destroy_application},
{ NULL }
@@ -731,7 +731,7 @@ end:
hdp_channel_unref(hdp_chan);
}

-static GDBusMethodTable health_channels_methods[] = {
+static const GDBusMethodTable health_channels_methods[] = {
{"GetProperties","", "a{sv}", channel_get_properties },
{"Acquire", "", "h", channel_acquire,
G_DBUS_METHOD_FLAG_ASYNC },
@@ -2093,7 +2093,7 @@ static void health_device_destroy(void *data)
health_device_unref(device);
}

-static GDBusMethodTable health_device_methods[] = {
+static const GDBusMethodTable health_device_methods[] = {
{"Echo", "", "b", device_echo,
G_DBUS_METHOD_FLAG_ASYNC },
{"CreateChannel", "os", "o", device_create_channel,
diff --git a/input/device.c b/input/device.c
index 092560d..2d8d724 100644
--- a/input/device.c
+++ b/input/device.c
@@ -1060,7 +1060,7 @@ static DBusMessage *input_device_get_properties(DBusConnection *conn,
return reply;
}

-static GDBusMethodTable device_methods[] = {
+static const GDBusMethodTable device_methods[] = {
{ "Connect", "", "", input_device_connect,
G_DBUS_METHOD_FLAG_ASYNC },
{ "Disconnect", "", "", input_device_disconnect },
diff --git a/network/connection.c b/network/connection.c
index 36b51a7..d1d417e 100644
--- a/network/connection.c
+++ b/network/connection.c
@@ -552,7 +552,7 @@ static void path_unregister(void *data)
peer_free(peer);
}

-static GDBusMethodTable connection_methods[] = {
+static const GDBusMethodTable connection_methods[] = {
{ "Connect", "s", "s", connection_connect,
G_DBUS_METHOD_FLAG_ASYNC },
{ "Disconnect", "", "", connection_disconnect },
diff --git a/network/server.c b/network/server.c
index 58c7297..688ec7d 100644
--- a/network/server.c
+++ b/network/server.c
@@ -685,7 +685,7 @@ static void path_unregister(void *data)
adapter_free(na);
}

-static GDBusMethodTable server_methods[] = {
+static const GDBusMethodTable server_methods[] = {
{ "Register", "ss", "", register_server },
{ "Unregister", "s", "", unregister_server },
{ }
diff --git a/plugins/dbusoob.c b/plugins/dbusoob.c
index 2c03780..bcd0556 100644
--- a/plugins/dbusoob.c
+++ b/plugins/dbusoob.c
@@ -175,7 +175,7 @@ static DBusMessage *remove_remote_data(DBusConnection *conn, DBusMessage *msg,
return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
}

-static GDBusMethodTable oob_methods[] = {
+static const GDBusMethodTable oob_methods[] = {
{"AddRemoteData", "sayay", "", add_remote_data},
{"RemoveRemoteData", "s", "", remove_remote_data},
{"ReadLocalData", "", "ayay", read_local_data,
diff --git a/plugins/service.c b/plugins/service.c
index 14a5cb6..978e371 100644
--- a/plugins/service.c
+++ b/plugins/service.c
@@ -696,7 +696,7 @@ done:
return dbus_message_new_method_return(msg);
}

-static GDBusMethodTable service_methods[] = {
+static const GDBusMethodTable service_methods[] = {
{ "AddRecord", "s", "u", add_service_record },
{ "UpdateRecord", "us", "", update_service_record },
{ "RemoveRecord", "u", "", remove_service_record },
diff --git a/proximity/monitor.c b/proximity/monitor.c
index 687b41c..cc90195 100644
--- a/proximity/monitor.c
+++ b/proximity/monitor.c
@@ -546,7 +546,7 @@ static DBusMessage *set_property(DBusConnection *conn,
return btd_error_invalid_args(msg);
}

-static GDBusMethodTable monitor_methods[] = {
+static const GDBusMethodTable monitor_methods[] = {
{ "GetProperties", "", "a{sv}", get_properties },
{ "SetProperty", "sv", "", set_property,
G_DBUS_METHOD_FLAG_ASYNC},
diff --git a/proximity/reporter.c b/proximity/reporter.c
index cb30da5..983bd33 100644
--- a/proximity/reporter.c
+++ b/proximity/reporter.c
@@ -180,7 +180,7 @@ err:
return btd_error_failed(msg, "not enough memory");
}

-static GDBusMethodTable reporter_methods[] = {
+static const GDBusMethodTable reporter_methods[] = {
{ "GetProperties", "", "a{sv}", get_properties },
{ }
};
diff --git a/sap/sap-dummy.c b/sap/sap-dummy.c
index 389548b..a2f2968 100644
--- a/sap/sap-dummy.c
+++ b/sap/sap-dummy.c
@@ -315,7 +315,7 @@ static DBusMessage *card_status(DBusConnection *conn, DBusMessage *msg,
return dbus_message_new_method_return(msg);
}

-static GDBusMethodTable dummy_methods[] = {
+static const GDBusMethodTable dummy_methods[] = {
{ "OngoingCall", "b", "", ongoing_call},
{ "MaxMessageSize", "u", "", max_msg_size},
{ "DisconnectImmediate", "", "", disconnect_immediate},
diff --git a/sap/server.c b/sap/server.c
index 945d599..39eddc8 100644
--- a/sap/server.c
+++ b/sap/server.c
@@ -1303,7 +1303,7 @@ static DBusMessage *get_properties(DBusConnection *c,
return reply;
}

-static GDBusMethodTable server_methods[] = {
+static const GDBusMethodTable server_methods[] = {
{"GetProperties", "", "a{sv}", get_properties},
{"Disconnect", "", "", disconnect},
{ }
diff --git a/serial/port.c b/serial/port.c
index ea45c7a..1c48bf7 100644
--- a/serial/port.c
+++ b/serial/port.c
@@ -567,7 +567,7 @@ static DBusMessage *port_disconnect(DBusConnection *conn,
return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
}

-static GDBusMethodTable port_methods[] = {
+static const GDBusMethodTable port_methods[] = {
{ "Connect", "s", "s", port_connect, G_DBUS_METHOD_FLAG_ASYNC },
{ "ConnectFD", "s", "h", port_connect, G_DBUS_METHOD_FLAG_ASYNC },
{ "Disconnect", "s", "", port_disconnect },
diff --git a/serial/proxy.c b/serial/proxy.c
index ea5c29f..6c4c33f 100644
--- a/serial/proxy.c
+++ b/serial/proxy.c
@@ -728,7 +728,7 @@ static DBusMessage *proxy_set_serial_params(DBusConnection *conn,
return dbus_message_new_method_return(msg);
}

-static GDBusMethodTable proxy_methods[] = {
+static const GDBusMethodTable proxy_methods[] = {
{ "Enable", "", "", proxy_enable },
{ "Disable", "", "", proxy_disable },
{ "GetInfo", "", "a{sv}",proxy_get_info },
@@ -1111,7 +1111,7 @@ static void manager_path_unregister(void *data)
g_free(adapter);
}

-static GDBusMethodTable manager_methods[] = {
+static const GDBusMethodTable manager_methods[] = {
{ "CreateProxy", "ss", "s", create_proxy },
{ "ListProxies", "", "as", list_proxies },
{ "RemoveProxy", "s", "", remove_proxy },
diff --git a/src/adapter.c b/src/adapter.c
index 8e95ab2..9c9b08d 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -1655,7 +1655,7 @@ static DBusMessage *unregister_agent(DBusConnection *conn, DBusMessage *msg,
return dbus_message_new_method_return(msg);
}

-static GDBusMethodTable adapter_methods[] = {
+static const GDBusMethodTable adapter_methods[] = {
{ "GetProperties", "", "a{sv}",get_properties },
{ "SetProperty", "sv", "", set_property,
G_DBUS_METHOD_FLAG_ASYNC},
diff --git a/src/device.c b/src/device.c
index 2a8812e..b497431 100644
--- a/src/device.c
+++ b/src/device.c
@@ -877,7 +877,7 @@ static DBusMessage *disconnect(DBusConnection *conn, DBusMessage *msg,
return NULL;
}

-static GDBusMethodTable device_methods[] = {
+static const GDBusMethodTable device_methods[] = {
{ "GetProperties", "", "a{sv}", get_properties },
{ "SetProperty", "sv", "", set_property },
{ "DiscoverServices", "s", "a{us}", discover_services,
diff --git a/src/manager.c b/src/manager.c
index 6244516..8b9243e 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -196,7 +196,7 @@ static DBusMessage *get_properties(DBusConnection *conn,
return reply;
}

-static GDBusMethodTable manager_methods[] = {
+static const GDBusMethodTable manager_methods[] = {
{ "GetProperties", "", "a{sv}",get_properties },
{ "DefaultAdapter", "", "o", default_adapter },
{ "FindAdapter", "s", "o", find_adapter },
diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
index 92c0225..08117a6 100644
--- a/thermometer/thermometer.c
+++ b/thermometer/thermometer.c
@@ -959,7 +959,7 @@ static DBusMessage *disable_intermediate(DBusConnection *conn, DBusMessage *msg,
return dbus_message_new_method_return(msg);
}

-static GDBusMethodTable thermometer_methods[] = {
+static const GDBusMethodTable thermometer_methods[] = {
{ "GetProperties", "", "a{sv}", get_properties },
{ "SetProperty", "sv", "", set_property,
G_DBUS_METHOD_FLAG_ASYNC },
--
1.7.10.2


2012-05-16 23:33:02

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ v5 02/13] gdbus: do not call memset for terminating NUL

---
gdbus/object.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdbus/object.c b/gdbus/object.c
index 7a94156..e378074 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -72,7 +72,6 @@ static void print_arguments(GString *gstr, const char *sig,

complete = FALSE;
struct_level = dict_level = 0;
- memset(type, 0, sizeof(type));

/* Gather enough data to have a single complete type */
for (len = 0; len < (sizeof(type) - 1) && sig[i]; len++, i++) {
@@ -107,6 +106,8 @@ static void print_arguments(GString *gstr, const char *sig,
break;
}

+ type[len + 1] = '\0';
+
if (!complete) {
error("Unexpected signature: %s", sig);
return;
--
1.7.10.2


2012-05-16 23:33:01

by Lucas De Marchi

[permalink] [raw]
Subject: [PATCH BlueZ v5 01/13] gdbus: return if method signature is malformed

---
gdbus/object.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/gdbus/object.c b/gdbus/object.c
index 8bc12f5..7a94156 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -107,6 +107,10 @@ static void print_arguments(GString *gstr, const char *sig,
break;
}

+ if (!complete) {
+ error("Unexpected signature: %s", sig);
+ return;
+ }

if (direction)
g_string_append_printf(gstr,
--
1.7.10.2