public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Henrique Dante de Almeida <hdante@profusion.mobi>
To: linux-bluetooth@vger.kernel.org
Cc: Henrique Dante de Almeida <hdante@profusion.mobi>
Subject: [PATCH 05/11] Convert GDBus methods and signals to use macro helpers
Date: Wed, 23 May 2012 10:20:02 -0300	[thread overview]
Message-ID: <1337779208-3555-6-git-send-email-hdante@profusion.mobi> (raw)
In-Reply-To: <1337779208-3555-1-git-send-email-hdante@profusion.mobi>

With these macro helpers we can separate in/out arguments and use their
own vector.
---
 src/adapter.c |   19 ++++++++++++-------
 src/device.c  |   15 +++++++++++----
 src/manager.c |   17 ++++++++++++-----
 src/ndef.c    |    4 +++-
 src/tag.c     |   15 +++++++++++----
 5 files changed, 49 insertions(+), 21 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index 8574d52..5cbafa1 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -463,17 +463,22 @@ static void tag_present_cb(uint32_t adapter_idx, uint32_t target_idx,
 }
 
 static const GDBusMethodTable adapter_methods[] = {
-	{ "GetProperties",     "",      "a{sv}", get_properties     },
-	{ "SetProperty",       "sv",    "",      set_property       },
-	{ "StartPoll",         "",      "",      start_poll         },
-	{ "StopPoll",          "",      "",      stop_poll          },
+	{ _GDBUS_METHOD("GetProperties", "", "a{sv}",
+				NULL, GDBUS_ARGS({"properties", "a{sv}"}),
+				get_properties) },
+	{ _GDBUS_METHOD("SetProperty", "sv", "",
+				GDBUS_ARGS({"name", "s"}, {"value", "v"}),
+				NULL, set_property) },
+	{ _GDBUS_METHOD("StartPoll", "", "", NULL, NULL, start_poll) },
+	{ _GDBUS_METHOD("StopPoll", "", "", NULL, NULL, stop_poll) },
 	{ },
 };
 
 static const GDBusSignalTable adapter_signals[] = {
-	{ "PropertyChanged",		"sv"	},
-	{ "TagFound",		        "o"	},
-	{ "TagLost",			"o"	},
+	{ _GDBUS_SIGNAL("PropertyChanged", "sv",
+				GDBUS_ARGS({"name", "s"}, {"value", "v"})) },
+	{ _GDBUS_SIGNAL("TagFound", "o", GDBUS_ARGS({"address", "o"})) },
+	{ _GDBUS_SIGNAL("TagLost", "o", GDBUS_ARGS({"address", "o"})) },
 	{ }
 };
 
diff --git a/src/device.c b/src/device.c
index b53e24d..2b1527d 100644
--- a/src/device.c
+++ b/src/device.c
@@ -234,14 +234,21 @@ error:
 }
 
 static const GDBusMethodTable device_methods[] = {
-	{ "GetProperties",     "",      "a{sv}", get_properties     },
-	{ "SetProperty",       "sv",    "",      set_property       },
-	{ "Push",             "a{sv}",  "",      push_ndef          },
+	{ _GDBUS_METHOD("GetProperties", "", "a{sv}",
+				NULL, GDBUS_ARGS({"properties", "a{sv}"}),
+				get_properties) },
+	{ _GDBUS_METHOD("SetProperty", "sv", "",
+				GDBUS_ARGS({"name", "s"}, {"value", "v"}),
+				NULL, set_property) },
+	{ _GDBUS_METHOD("Push", "a{sv}", "",
+					GDBUS_ARGS({"attributes", "a{sv}"}),
+					NULL, push_ndef) },
 	{ },
 };
 
 static const GDBusSignalTable device_signals[] = {
-	{ "PropertyChanged",		"sv"	},
+	{ _GDBUS_SIGNAL("PropertyChanged", "sv",
+				GDBUS_ARGS({"name", "s"}, {"value", "v"})) },
 	{ }
 };
 
diff --git a/src/manager.c b/src/manager.c
index 241c472..f1ac5ea 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -134,15 +134,22 @@ void __near_manager_adapter_remove(uint32_t idx)
 }
 
 static const GDBusMethodTable manager_methods[] = {
-	{ "GetProperties",     "",      "a{sv}", get_properties     },
-	{ "SetProperty",       "sv",    "",      set_property       },
+	{ _GDBUS_METHOD("GetProperties", "", "a{sv}",
+				NULL, GDBUS_ARGS({"properties", "a{sv}"}),
+				get_properties) },
+	{ _GDBUS_METHOD("SetProperty", "sv", "",
+				GDBUS_ARGS({"name", "s"}, {"value", "v"}),
+				NULL, set_property) },
 	{ },
 };
 
 static const GDBusSignalTable manager_signals[] = {
-	{ "PropertyChanged",		"sv"	},
-	{ "AdapterAdded",		"o"	},
-	{ "AdapterRemoved",		"o"	},
+	{ _GDBUS_SIGNAL("PropertyChanged", "sv",
+				GDBUS_ARGS({"name", "s"}, {"value", "v"})) },
+	{ _GDBUS_SIGNAL("AdapterAdded", "o",
+					GDBUS_ARGS({"adapter", "o" })) },
+	{ _GDBUS_SIGNAL("AdapterRemoved", "o",
+					GDBUS_ARGS({"adapter", "o" })) },
 	{ }
 };
 
diff --git a/src/ndef.c b/src/ndef.c
index 029941a..a23c508 100644
--- a/src/ndef.c
+++ b/src/ndef.c
@@ -419,7 +419,9 @@ static DBusMessage *get_properties(DBusConnection *conn,
 }
 
 static const GDBusMethodTable record_methods[] = {
-	{ "GetProperties",     "",      "a{sv}", get_properties     },
+	{ _GDBUS_METHOD("GetProperties", "", "a{sv}",
+				NULL, GDBUS_ARGS({"properties", "a{sv}"}),
+				get_properties) },
 	{ },
 };
 
diff --git a/src/tag.c b/src/tag.c
index d660749..f3ab092 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -323,14 +323,21 @@ fail:
 }
 
 static const GDBusMethodTable tag_methods[] = {
-	{ "GetProperties",     "",      "a{sv}", get_properties     },
-	{ "SetProperty",       "sv",    "",      set_property       },
-	{ "Write",             "a{sv}", "",      write_ndef         },
+	{ _GDBUS_METHOD("GetProperties", "", "a{sv}",
+				NULL, GDBUS_ARGS({"properties", "a{sv}"}),
+				get_properties) },
+	{ _GDBUS_METHOD("SetProperty", "sv", "",
+				GDBUS_ARGS({"name", "s"}, {"value", "v"}),
+				NULL, set_property) },
+	{ _GDBUS_METHOD("Write", "a{sv}", "",
+					GDBUS_ARGS({"attributes", "a{sv}"}),
+					NULL, write_ndef) },
 	{ },
 };
 
 static const GDBusSignalTable tag_signals[] = {
-	{ "PropertyChanged",		"sv"	},
+	{ _GDBUS_SIGNAL("PropertyChanged", "sv",
+				GDBUS_ARGS({"name", "s"}, {"value", "v"})) },
 	{ }
 };
 
-- 
1.7.9.5


  parent reply	other threads:[~2012-05-23 13:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-23 13:19 [PATCH 00/11] gdbus: Better D-Bus introspection Henrique Dante de Almeida
2012-05-23 13:19 ` [PATCH 01/11] Constify GDBus method tables Henrique Dante de Almeida
2012-05-23 13:19 ` [PATCH 02/11] Constify GDBus signal tables Henrique Dante de Almeida
2012-05-23 13:20 ` [PATCH 03/11] gdbus: add argument info to methods and signals Henrique Dante de Almeida
2012-05-23 13:20 ` [PATCH 04/11] gdbus: add and use helpers for table declarations Henrique Dante de Almeida
2012-05-23 13:20 ` Henrique Dante de Almeida [this message]
2012-05-23 13:20 ` [PATCH 06/11] gdbus: use GDBusArgInfo to generate introspection Henrique Dante de Almeida
2012-05-23 13:20 ` [PATCH 07/11] gdbus: loop over args to check message signature Henrique Dante de Almeida
2012-05-23 13:20 ` [PATCH 08/11] Do not set signature and reply in GDBus tables Henrique Dante de Almeida
2012-05-23 13:20 ` [PATCH 09/11] gdbus: remove signature and reply from tables Henrique Dante de Almeida
2012-05-23 13:20 ` [PATCH 10/11] gdbus: add Deprecated annotation in introspection Henrique Dante de Almeida
2012-05-23 13:20 ` [PATCH 11/11] gdbus: add Method.NoReply " Henrique Dante de Almeida
2012-05-23 13:28 ` [PATCH 00/11] gdbus: Better D-Bus introspection Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1337779208-3555-6-git-send-email-hdante@profusion.mobi \
    --to=hdante@profusion.mobi \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox