On 12/15/2011 12:06 PM, Martin Stehlik wrote:
> Hello!
>
> In my application, I have defined following structure:
>
> typedef nx_struct neighbors {
>       nx_uint16_t id; // id of the neighbor
>       nx_uint8_t rssi; // rssi of the signal received from neighbor
> } neighbors_t;
>
> Then, I have following array:
>
> neighbors_t tableOfNeighbors[MAX_NEIGHBORS];
>
> I need to send the array to the PC for analyzing in my Java application.
> I would like to send following message using SerialActiveMessageC:
>
> typedef nx_struct neighborsMsg {
>       neighbors_t neighbors[MAX_NEIGHBORS];
> } neighborsMsg_t;
>
> but this assignment does not work:
>
> neighborsMsg_t* nmsg = (neighborsMsg_t*)(call
> SerialPacket.getPayload(&pkt, sizeof(neighborsMsg_t)));
>
> nmsg->neighbors = tableOfNeighbors;
>
> resulting in:
>
> invalid lvalue in assignment
>
> Could anyone write me what is the best way how we can transfer arrays
> from the nodes to the PC and between the nodes? Is it possible to send
> arrays of struct in messages?
>
> I would really appreciate any answer! I spent time searching google and
> mailinglist.
>
> Regards,
> Martin
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
Hi,

The assignment, you 've wrote, guides compiler to pointer copy.
I guess you want to copy table tableOfNeighbors to nmsg->neighbors .

If so ,try
    memcpy(nmsg->neighbors, tableOfNeighbors, 
sizeof(neighbors_t)*MAX_NEIGHBORS);
instead.

--
Igglezakis Antonios
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to