On Fri, 23.06.17 20:45, guhan balasubramanian (guhan....@gmail.com) wrote:

> Hi,
> 
> I'm currently trying out sd-bus methods for my application. I am in a
> situation where I must accept an input and return a byte array based on the
> input.
> 
> In the vtable. the following declaration is present:
> SD_BUS_METHOD("method_id", "x", "ay", method_1, 0)
> 
> And inside the definition for method_1, for returning:
> uint8_t b[2] = {0x01, 0x02};
> sd_bus_reply_method_return(m, "ay", b);

if you use sd_bus_reply_method_return() (or sd_bus_append()) the
arguments to pass for an array is the array's size followed by the
members. Hence, the following should do what you want:

        sd_bus_reply_method_return(m, "ay", 2, 0x01, 0x02);

Lennart

-- 
Lennart Poettering, Red Hat
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to