Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: Denis Kenzior <denkenz@gmail.com>, iwd@lists.linux.dev
Subject: Re: [PATCH 2/3] client: add helper to call method via builder
Date: Fri, 10 Nov 2023 04:28:32 -0800	[thread overview]
Message-ID: <f4eae46b-977a-435b-8798-0e59343c1e2d@gmail.com> (raw)
In-Reply-To: <8963c077-984f-474d-afec-5e02ef8182e3@gmail.com>

Hi Denis,

On 11/9/23 6:22 PM, Denis Kenzior wrote:
> 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?

I'm generally terrible about updating the dates on the copyright and 
really never do it. Decided I'd try and do better this time :)

But I'm not actually sure how this works. Should there be multiple 
copyright notices if different companies touch existing files? or should 
we just leave the copyrights as-is if the file already exists.

> 
>>    *
>>    *  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?

With knowledge that l_dbus_message_set_arguments can handle dictionaries 
I don't need this patch at all :)

> 
>> +}
>> +
>> +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 12:28 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
2023-11-10 12:28     ` James Prestwood [this message]
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=f4eae46b-977a-435b-8798-0e59343c1e2d@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=denkenz@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