Hi guys,
 I posted question regarding how to run 2 apps in Tossim. Thanks for all
you guys help and bellow is what I did so far.
 I followed Joe's way becoz I think it is easier and mostly because I am
lazy:)
The wraper component I wrote listed below:
-------------------------
configuration Wrap {
}
implementation {
  components Main, RfmToInt, IntToLeds, Counter, IntToRfm, TimerC;

  if (TOS_LOCAL_ADDRESS == 0)
   {  Main.StdControl -> Counter.StdControl;
      Main.StdControl -> IntToLeds.StdControl;
      Main.StdControl -> IntToRfm.StdControl;
      Main.StdControl -> TimerC.StdControl;
      Counter.Timer -> TimerC.Timer[unique("Timer")];
      IntToLeds <- Counter.IntOutput;
      Counter.IntOutput -> IntToRfm;
   }
  else if (TOS_LOCAL_ADDRESS == 1)
   {
    Main.StdControl -> IntToLeds.StdControl;
    Main.StdControl -> RfmToInt.StdControl;
    RfmToInt.IntOutput -> IntToLeds.IntOutput;
   }
}
---------------------
Above is really nothing but to wrap up CntToLedsAndRfm & RfmToLeds.
But it fails to compile and gives err info: parse error before `if' at line6
anyone has any idea what is going wrong?
Thanks
Leo


> It is not possible to run two different apps, but it is possible to
> initialize each mote differently.
>
> Since TinyOS is component based, you ought to be able to write a
> wrapper component that, depending on the TOS_LOCAL_ADDRESS or other
> parameters, calls StdControl on App1C or App2C appropriately.
>
> The reason for this is because TOSSIM is compiled INTO the application
> (ie main.exe).  Thus if you run two different main.exe files, you're
> running two different simulators.  The wrapper method above is an easy
> and quick fix to your situation (and is what we have done to simulate
> motes with different code).
>
> -Joe

_______________________________________________
Tinyos-users mailing list
[email protected]
http://mail.Millennium.Berkeley.EDU/mailman/listinfo/tinyos-users

Reply via email to