On Fri, 2006-02-24 at 14:15 -0500, Vinayak Naik wrote:
> 
> Option #1 is better if you don't want to maintain 3 different
> programs.
> 
> - Vinayak


Agreed. An even better way to do it is this:

typedef enum {
  ROLE_A = 0,
  ROLE_B = 1,
  ROLE_C = 2
} AppRole;


In initialization:

uint8_t myRole;

if (TOS_LOCAL_ADDRESS == x) {
  myRole = ROLE_A;
}
if (TOS_LOCAL_ADDRESS == y) {
  myRole = ROLE_B;
}

etc.

You can then do stuff like have a message handler that lets you
dynamically set a node's role. THe init code means that when you turn
them on they'll be in a state you want, but you also get runtime
experimental flexibility. Of course, you could also then make it that
your nodes adapt to network conditions and change their roles
accordingly...

Phil

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

Reply via email to