C is unforgiving in it's approach to variable declarations:
They all have to be at the beginning of the function block.
Try:

RssiMsg* buf;
tx_power = call PacketTransmitPower.get(&msg);
buf = (RssiMsg*)(call RssiMsgSend.getPayload(&msg, sizeof(RssiMsg)));

MS

David Li wrote:
> Hi,
> 
> I am trying to read the tx power on the Sending mote in the RssiDemo 
> code.  The strange thing is if I do:
> 
> message_t msg;
> RssiMsg* buf = (RssiMsg*)(call RssiMsgSend.getPayload(&msg, 
> sizeof(RssiMsg)));
> tx_power = call PacketTransmitPower.get(&msg);
> 
> Then everything compiles OK.
> 
> But if I reversed the calls like this:
> 
> tx_power = call PacketTransmitPower.get(&msg);
> RssiMsg* buf = (RssiMsg*)(call RssiMsgSend.getPayload(&msg, 
> sizeof(RssiMsg)));
>     
> 
> Then I got an error:
> "syntax error before `*' " for the second line.
> 
> I am curious why?
> 
> David
> 
> 
>      
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> 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