The only way I've found to share state between modules is by
defining a struct containing all the interesting variables in
a common header file.

I allocate one in the main module and pass a pointer to it to
all the sub-modules using a struct specific interface in each
sub-module, like:

  /**
   * set 'global' variable pointers
   */
  command result_t setCmdP( RoboCmdMsg *cmdbuf );
  command result_t setStatP( TOS_Msg *statmsg );
  command result_t setCntlP( RoboControl *cntlbuf );

Each of those commands stores it's argument in a module local
pointer of the specified type.

Phil Levis suggested that this could be done with a separate
component that contained the variables and accessor commands,
with the claim that nescc would optimize out the funtion calls.
However my one attempt at this did no optimization, so it boils
down to needing the same mechanism as above.

MS

[EMAIL PROTECTED] wrote:
Hi, i want to know if it is possible to pass the value of a variable between 
two differents modules and how i can do it.

Moreover is it possible to create a variable that can be modifided by all 
modules of a application and how i can do it?

Thanks

------------------------------------------------------
Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom
http://click.libero.it/infostrada



_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to