Sending / Receiving of byte arrays

Bogdan Lotko boguslaw.lotko at chello.at
Tue Feb 7 14:24:45 PST 2012


Hello,

In the following (C++) structure the *buff *shall be sent as a byte array

struct XX
{
   QString               xxx;
   int                        yyy;
   char *buff*[4];
}

In Qt I have to declare metatype
Q_DECLARE_METATYPE(  XX )

and "<<",  ">>" operators

how to declare these operators, so that the *buff* will be sent as a 
byte array and not an ordinary string ('\0's inside possible)

I don't think
....
argument << mystruct.xxx
<< mystruct.yyy
<< mystruct*.buff *;

will be correct in this case.

I've also been thinking to use the structure with  QByteArray instead of 
*buff. *Is it feasible?
  e.g construct the QByteArray using  fromRawData(buff,4)  just before 
sending.

How to do this same using low-level API?

I suppose the signature will be something like (sia(yyyy)), and I have 
to send all bytes separately, or there is a better way to do it

How to receive this byte array ( there is nothing like "toRawData()" ) ?

Thanks for your help

bogdan



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20120207/21d862a2/attachment.htm>


More information about the dbus mailing list