On Wed, 2006-03-08 at 23:51 -0800, Avinash Sridharan wrote:
> Hi,
>  I am starting to use TinyOS 2.x. How do you I get the local address
> in TinyOS -2.x. TOS_LOCAL_ADDRESS is not present should I be using
> TOS_NODE_ID. The problem is that I am using TOSSIM in TinyOS-2.x and
> in code I had used TOS_NODE_ID, but it doesn't get intitalized to the
> node id. Since it keeps throwing the value of 1 for all nodes. I tried
> TOS_AM_ADDRESS with the same results. 

This is a bug. I've fixed it in CVS. It required two changes. The first
is in sim_tossim.c, where it sets TOS_NODE_ID when you switch nodes. The
second is in ActiveMessageAddressC, where it initializes addr to
TOS_NODE_ID. The modified functions:

void sim_set_node(unsigned long node) __attribute__ ((C, spontaneous)) {
  current_node = node;
  TOS_NODE_ID = node;
}

  async command am_addr_t amAddress() {
    if (!set) {
      addr = TOS_NODE_ID;
      set = TRUE;
    }
    return addr;
  }

Let me know if you have any other problems,

Phil

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

Reply via email to