This looks like a structure assignment which should copy
between two pointers:
     nmsg->neighbors = tableOfNeighbors;
but I think it might not work correctly with arrays.
You probably need to do a memcpy() to get the contents
of your table into the message. I'm a little rusty on my C
pointers (too much Java lately) so you may have to fiddle
with *'s and &'s to get the two sides to be pointers
to the beginning of each array...as written I think
they should both be pointers, but obviously the compiler
doesn't agree...

MS


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 did 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? Is it possible to send arrays 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
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to