Hi dear hamidreza,

I think you have to just remove this line :

   pkt = *msg;

because when you define BlinkToRadioMsg* btrpkt = (BlinkToRadioMsg*)payload;
, it's a pointer so when you modify it,It will affect the pointed source
too.
It should be ok with that.


On Sun, Sep 12, 2010 at 2:30 PM, Hamidreza Ghafghazi <
[email protected]> wrote:

> Dear all,
>
> I want to send, for example, a number from node 1 to node 2 and in node 2 I
> need to modify that number and send the new number to node 3.
> I know how to access to that data, but I don`t know how to assign the new
> value to the packet that will be send.
>
> Is it right that I write sth like below:
>
> For example the data that has been received is X and in the receive event I
> have written :
>
> event void message_t* Receive.receive(message_t* msg, void* payload,
> unit8_t len) {
>       if (len == sizeof(BlinkToRadioMsg)) {       // the AM message is
> called BlinkToRadioMsg
>            BlinkToRadioMsg* btrpkt = (BlinkToRadioMsg*)payload;
>            unit16_t y = btrpkt->X;
>            y = y +15;
>            pkt = *msg;    // message_t pkt has been introduced
>            btrpkt->X = y;
>            // now sending to the next node
>            if (call AMSend.send(3, &pkt, sizeof (BlinkToRadioMsg)) ==
> SUCCESS) {
>            }
>
>        ...
>
> Actually in the compiling there is no problem but when I downloaded it in
> the motes they don`t work as I expected. I think that I have not assigned
> the new value correctly or the     ( pkt = *msg) is wrong.
> So I need help and I will appreciate any suggestion.
> thanks in advance
>
> best regards,
> hamidreza
>
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>



-- 
Mojtaba Raznahan
BS of Computer engineering
TMU university
www.raznahan.com
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to