Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: James Prestwood <prestwoj@gmail.com>, iwd@lists.linux.dev
Subject: Re: [PATCH 2/3] client: add helper to call method via builder
Date: Thu, 9 Nov 2023 20:22:19 -0600	[thread overview]
Message-ID: <8963c077-984f-474d-afec-5e02ef8182e3@gmail.com> (raw)
In-Reply-To: <20231109184926.52629-2-prestwoj@gmail.com>

Hi James,

On 11/9/23 12:49, James Prestwood wrote:
> 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.

Is this correct?

>    *
>    *  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);

Do you really need this 2 line function for a single call site?

> +}
> +
> +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;

Regards,
-Denis


  reply	other threads:[~2023-11-10  2:22 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 ` [PATCH 2/3] client: add helper to call method via builder James Prestwood
2023-11-10  2:22   ` Denis Kenzior [this message]
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=8963c077-984f-474d-afec-5e02ef8182e3@gmail.com \
    --to=denkenz@gmail.com \
    --cc=iwd@lists.linux.dev \
    --cc=prestwoj@gmail.com \
    /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