good, you caught that =/== thing...

From looking at the SimpleCmdMsg.h file, I think what you want is:

        cmd->args.rl_args.destaddr

since rl_args is a struct itself.

Also on the question you sent to me directly:
From the Cygwin command, if I type java.net.tools.BcastInject led_on 1
> (1 is mote address of node 1), I can see only led on the mote 1 is on,
>  mote 2 is not.
I am quite confused here, because I left SImpleCmd unchanged, so how
> the mote 2 know that this broadcasted packet does not belong to it?
> Because, I think, althought the packet is sent from TOSBase with
> address of mote 1, mote 2 still can receive it (radio signal).

I haven't used BcastInject. It looks like all messages are BCAST to
every mote, but the mote app itself looks at the rl_args.destaddr and
decides if is is going to execute the command, turning on the LED in
this case. You could  change SimpleCmd to flash an led every time it
gets a message of any kind, just to see that things are working...

MS


Hieu Tran wrote:
Sorry, I think in the command if (cmd->args.rl_args=TOS_LOCAL_ADDRESS)
it must be if (cmd->args.rl_args==TOS_LOCAL_ADDRESS).
However, when I change this, the Cygwin display "invalid operands to binary ==". How can I solve this problem? Thanks alot. Hi all! I am a new to TinyOS. I am doing a simulation with one mote program with TOSBase. I use BcastIject to send radio packet. In BcastInject, I modify it with destination address is received from command. After that, I put this address in the read_log_arg variable of SimpleCmd. Here are some structes in SimpleCmd: typedef struct {
    uint16_t destaddr;
} read_log_args;
// SimpleCmd message structure
typedef struct SimpleCmdMsg {
    int8_t seqno;
    int8_t action;
    uint16_t source;
    uint8_t hop_count;
    union {
      start_sense_args ss_args;
      read_log_args rl_args; (I put destination address here)
      uint8_t untyped_args[0];
    } args;
} SimpleCmdMsg;
The packet is sent with broadcast address. I want to programming one node as the relay node. It receives radio packet, make comparision of its TOS_LOCAL_ADDRESS with destination address (encapsulated in SimpleCmd). If these addresses are equal, the node keep the packet, other it forward the packet. In the program for the relay mote, I declare cmd as a SimpleCmd structure pointer that point to packet
struct SimpleCmdMsg * cmd = (struct SimpleCmdMsg *) msg->data;
and I make comparision with command if (cmd->args.rl_args=TOS_LOCAL_ADDRESS) I run the make mica2 to compile this program. However, the Cygwin display "Incompatible types in assignment" (cmd->args.rl_args=TOS_LOCAL_ADDRESS) I can not figure it out what is wrong with this. Can you give me some advice?
Many thanks!

New Yahoo! Messenger with Voice. Call regular phones from your PC <http://us.rd.yahoo.com/mail_us/taglines/postman5/*http://us.rd.yahoo.com/evt=39666/*http://messenger.yahoo.com> and save big.


------------------------------------------------------------------------

_______________________________________________
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