How to get an item of the Argument with the type of array in thin core

asked 2015-04-21 20:35:01 -0700

bling gravatar image

updated 2015-04-21 23:55:38 -0700

I find there is a function called "alljoyn_msgarg_array_element " in standard core.
This function can get the pointer to the item of the index in the Array.
In Alljoyn thin core, after doing AJ_UnmarshalArg() the message, I get the argument with the type of array.
Then I want to get the pointer to the item of an index in the array.
Is there any function doing that in AllJoyn thin core?
Or I need to de-structure the array by myself.
Thank you for your great help.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-04-22 09:34:44 -0700

jprestwo gravatar image

updated 2015-04-22 09:37:39 -0700

You cannot pull out a single item in the array. You will first need to unmarshal the array into a buffer. There is a function AJ_UnmarshalContainer which tells the unmarshaller that there is a container object (array or struct). After that call you can loop over AJ_UnmarshalArgs with the array element type. Have a look at "test/mutter.c". It shows how to marshal and unmarshal many different signature types, its a very good reference.

Another option (which requires that you know what your doing) is AJ_UnmarshalRaw which will let you unmarshal the message as raw data with no type. This is good for sending/receiving raw buffers of data like an array of bytes for example ("ay"). If you have anything that is more of a complex type I don't recommend this because it would require that you know the wire protocol to untangle the data.

edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-04-21 20:35:01 -0700

Seen: 51 times

Last updated: Apr 22 '15