From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH 2/3] client: add helper to call method via builder
Date: Thu, 9 Nov 2023 10:49:25 -0800 [thread overview]
Message-ID: <20231109184926.52629-2-prestwoj@gmail.com> (raw)
In-Reply-To: <20231109184926.52629-1-prestwoj@gmail.com>
There was no way to call a method with anything except basic
arguments. Add a helper to use a builder to create more complex
args.
---
client/dbus-proxy.c | 36 +++++++++++++++++++++++++++++++++++-
client/dbus-proxy.h | 9 +++++++++
2 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/client/dbus-proxy.c b/client/dbus-proxy.c
index 42b8427f..de252427 100644
--- a/client/dbus-proxy.c
+++ b/client/dbus-proxy.c
@@ -2,7 +2,7 @@
*
* Wireless daemon for Linux
*
- * Copyright (C) 2017-2020 Intel Corporation. All rights reserved.
+ * Copyright (C) 2017-2023 Intel Corporation. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -629,6 +629,40 @@ bool proxy_interface_method_call(const struct proxy_interface *proxy,
return true;
}
+struct l_dbus_message_builder *proxy_interface_new_builder(
+ const struct proxy_interface *proxy,
+ const char *name)
+{
+ struct l_dbus_message *call = l_dbus_message_new_method_call(dbus,
+ IWD_SERVICE, proxy->path,
+ proxy->type->interface, name);
+
+ return l_dbus_message_builder_new(call);
+}
+
+bool proxy_interface_method_call_from_builder(
+ const struct proxy_interface *proxy,
+ struct l_dbus_message_builder *builder,
+ l_dbus_message_func_t callback)
+{
+ struct proxy_callback_data *callback_data;
+ struct l_dbus_message *call;
+
+ if (!proxy || !builder)
+ return false;
+
+ call = l_dbus_message_builder_finalize(builder);
+
+ callback_data = l_new(struct proxy_callback_data, 1);
+ callback_data->callback = callback;
+ callback_data->user_data = (void *) proxy;
+
+ l_dbus_send_with_reply(dbus, call, proxy_callback, callback_data,
+ l_free);
+
+ return true;
+}
+
void *proxy_interface_get_data(const struct proxy_interface *proxy)
{
return proxy->data;
diff --git a/client/dbus-proxy.h b/client/dbus-proxy.h
index cd1b2305..94625b85 100644
--- a/client/dbus-proxy.h
+++ b/client/dbus-proxy.h
@@ -90,6 +90,15 @@ bool proxy_interface_method_call(const struct proxy_interface *proxy,
const char *name, const char *signature,
l_dbus_message_func_t callback, ...);
+bool proxy_interface_method_call_from_builder(
+ const struct proxy_interface *proxy,
+ struct l_dbus_message_builder *builder,
+ l_dbus_message_func_t callback);
+
+struct l_dbus_message_builder *proxy_interface_new_builder(
+ const struct proxy_interface *proxy,
+ const char *name);
+
void proxy_properties_display(const struct proxy_interface *proxy,
const char *caption, const char *margin,
unsigned int name_column_width,
--
2.25.1
next prev parent reply other threads:[~2023-11-09 18:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-09 18:49 [PATCH 1/3] client: Add shared code DBus interface James Prestwood
2023-11-09 18:49 ` James Prestwood [this message]
2023-11-10 2:22 ` [PATCH 2/3] client: add helper to call method via builder Denis Kenzior
2023-11-10 12:28 ` James Prestwood
2023-11-10 12:59 ` James Prestwood
2023-11-09 18:49 ` [PATCH 3/3] client: add client commands for shared code configuration James Prestwood
2023-11-10 2:31 ` Denis Kenzior
2023-11-10 2:17 ` [PATCH 1/3] client: Add shared code DBus interface Denis Kenzior
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=20231109184926.52629-2-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.linux.dev \
/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