Hi all, I saw this line in the mote-mote radio communication:
BlinkToRadioMsg* btrpkt = (BlinkToRadioMsg*)(call Packet.getPayload(&pkt, NULL)); I was wondering if anyone can help me understand what does the following call mean? call Packet.getPayload(&pkt, NULL)); is this creating a new instance/pointer of the BlinkToRadioMsg? as in is it creating new memory for this pointer, or is it using the same memory space used by &pkt? If my question is not clear, maybe if I explain what I am trying to do will give you an idea how I am using it, I feel what I am doing is wrong though! What I am trying to do is have an array of messages/packets, so I have a struct like the one in the tutorial (BlinkToRadioMsg), so when ever I have to add a new message to the array what I do is: BlinkToRadioMsg* newMessage = (BlinkToRadioMsg*)(call Packet.getPayload(&pkt, NULL)); then I fill the fields of the newMessage and just simply add it to the array as follows tasksSet[index] = newMessage; So now I am wondering if the call Packet.getPayload(&pkt,NULL) actually allocates new memory space to the newMessage or does it reuse the previous memory that was used by what ever was held by the previous message pointer, so at the end all the message pointers in the array are actually pointing at the same thing. Thanks. _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
