good catch...I stared at that for a while and then just gave up...
Anyway, just in case it's not the result of pseudo-code:
tempBuffer is not set to anything before doing the memcpy()
so there will be Trouble(TM) at runtime there as well...

MS

Philip Levis wrote:
On Feb 10, 2007, at 5:09 AM, Muhammad Azhar wrote:

Hi all,

I'm thinking that my programming logic might be wrong which is why the compiler gave me this warning:

XxxxC.nc: In function `Receive.receive':
XxxxC.nc:117: warning: passing argument 2 of `AMSend.send' from incompatible pointer type

I read through the Receive interface and was told that if I wanted to return the same message_t packet buffer for later use by the same signalling component, I can do so provided I have copied the data that I wanted. In my program, I wanted selected nodes with certain IDs to modify the data that they received from another node and send it to another different node - hence, in my Receive.receive(message_t* bufPtr, void* payload, uint8_t len), I signalled AMSend.send after I have modified the data... This was what I did:

   message_t* tempBuffer;
   struct* something = (struct*)payload;
   something->data = something->value + count - something->data
   memcpy(tempBuffer, bufPtr, sizeof(message_t));
   call AMSend.send(nodeid, &tempBuffer, sizeof(struct));
   return bufPtr;

I'm not really sure if this will actually send the modified data to the required nodeid, but anyway, I still don't know why the message appears. I'm not even sure if I need tempBuffer in the first place - can I just send &bufPtr? Any help is very much appreciated. Thank you.

You're passing &tempBuffer rather than tempBuffer. The former is a mesage_t**, the latter is a message_t*.

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

Reply via email to