Thanks, Norman. I totally missed the other constructor in Rpc_in_buffer in my rush to implement a Solution!
I'll use your suggestion on the small buffer object.
Bob
Sent from my android device.
-----Original Message----- From: Norman Feske <norman.feske@...1...> To: genode-main@lists.sourceforge.net Sent: Mon, 22 Dec 2014 10:44 AM Subject: Re: Rpc argument for a binary array?
Hi Bob,
Is there a mechanism for passing an array of 8_bit register values in RPC calls when using base-hw? I see the Rpc_in_buffer class but that's designed for string arrays not arbitrary binary value arrays.
The use case is for implementing an I2C server which has multiple clients each of which implements a specific device on the I2C bus. I2C supports any length of data transfer but practically I don't see more than a dozen bytes being transferred in one contiguous block.
in general, 'Rpc_in_buffer' accepts arbitrary binary data if you specify the pointer to the buffer and the buffer size as constructor arguments. However, since you mentioned that the number of bytes transmitted per RPC call is rather small, I would simply define the argument type as follows (using an upper bound as array boundary):
struct I2c_message { unsigned char bytes[12]; };
If you specify an argument of type 'I2c_message' for an RPC function, the array will be copied as is. In contrast to the use of an 'Rpc_in_buffer', this 'I2c_message' type would work for both ways passing it as argument or as return value.
Cheers Norman