Yep Urs ,I think that will work..
but,I guess that  the solution proposed by Michael & Chad
can work as well.I 'll try the both propositions..and will choose
the best..
Thank u guys.
BB.

Quoting Urs Hunkeler <[EMAIL PROTECTED]>:

> Hi,
> 
> How about a this approach: From java you call the motelist command and
> extract the list of all connected motes. You then *dynamically*
> connect
> to each of the motes (see code attached).
> 
> If you want to be even more dynamically, you could periodically check
> (by calling the motelist command repeatedly) whether the list of
> connected motes has changed. The only problem is that if you are
> removing a mote, the default error handler will call System.exit() and
> thus your program terminates without a chance to recover. I have
> written
> a work-around for this somewhere on the tinyos mailing list.
> 
> Cheers,
> Urs
> 
> 
> // ------------------------------------------
> import java.io.*;
> import java.util.StringTokenizer;
> import java.util.Vector;
> 
> import net.tinyos.message.*;
> import net.tinyos.packet.*;
> import net.tinyos.util.PrintStreamMessenger;
> 
> public class Test implements MessageListener {
>   public static final String MOTELISTCMDL = "/usr/local/bin/motelist
> -c";
>   public static final String MOTELISTCMDW =
> "c:\\cygwin\\bin\\motelist.exe -c";
>   public static final String PLATFORM = "tmote";
> 
>   public static void main(String[] args) {
>     InputStreamReader isr = null;
>     BufferedReader br = null;
>     Vector motes = new Vector();
> 
>     try {
>       Process p = null;
> 
>       System.out.println(">>> OS is " +
> System.getProperty("os.name"));
>       if(System.getProperty("os.name").equals("Linux")) {
>         p = Runtime.getRuntime().exec(MOTELISTCMDL);
>       } else {
>         p = Runtime.getRuntime().exec(MOTELISTCMDW);
>       }
> 
>       isr = new InputStreamReader(p.getInputStream());
>       br = new BufferedReader(isr);
>       String line = null;
> 
>       if((line = br.readLine()) != null) {
>         StringTokenizer parser = new StringTokenizer(line, ",");
>         String id = parser.nextToken();
>         String port = parser.nextToken().trim();
>         System.out.println("*** " + id + " - " + port);
>         String comm = "serial@" + port + ":" + PLATFORM;
>         PhoenixSource ps = BuildSource.makePhoenix(comm,
> PrintStreamMessenger.err);
>         MoteIF mif = new MoteIF(ps);
>         Test test = new Test(mif);
>         mif.registerListener(new TestMsg(), test);
>         motes.add(test);
>       }
>     } catch(Exception ex) {
>       ex.printStackTrace();
>     } finally {
>       if( br != null) try {  br.close(); } catch(Exception ex) {}
>       if(isr != null) try { isr.close(); } catch(Exception ex) {}
>     }
>   }
> 
>   // rest of the code
> }
> 
> // ------------------------------------------
> 
> Chad Metcalf schrieb:
> > I'm with Michael on this one. If your mote hardware has what it
> takes
> > to hook up to a PC (serial, USB, etc) or a Gateway (Tmote Connect,
> > etc) then it doesn't matter what application you run on it.
> > 
> > Some T2 application sends data over the serial to a serial
> forwarder.
> > Your application hooks up to this SF via a MoteIF. Your application
> > can have as many MoteIFs up as you want. I just had 52 up without
> > breaking a sweat.
> > 
> > Lightly covered here:
> > http://www.tinyos.net/tinyos-2.x/doc/html/tutorial/lesson4.html
> > 
> > Now if your problem is with the SF then maybe you should look at at
> a
> > different SF, like the C or C++ one. Or maybe your problem is
> > elsewhere.
> > 
> > Cheers
> > Chad
> > 
> > On 9/18/07, Michael Schippling <[EMAIL PROTECTED]> wrote:
> >> Lets run this back to the help list, since I don't fully understand
> the
> >> question....
> >>
> >> If you want a physical connection between mote and PC you need one
> >> MIB5x0 (or whatever) and one USB or serial 'port' per mote. Aside
> >> from expense, I don't know that there is any limit to the number
> >> of any of those you may use (well, maybe 256 ports or
> something...).
> >>
> >> I'm not sure why you want so many base-stations. We may have
> >> a terminology problem because your use of "server" and "client"
> >> has me confused. But if what you really want is a bunch of motes
> >> hardwired to a PC, then the approach metcalfc and I have outlined
> >> should do you fine. Each PacketSource is directly mapped to a
> single
> >> port, and thus a single mote, and keeping track of which is which
> is
> >> just, as they say, a matter of software...
> >>
> >> MS
> >>
> >> [EMAIL PROTECTED] wrote:
> >>> I'm using tinyos-2.0,I think that that will work as
> >>> Michael proposed but it still limits the number of
> >>> base station that I can connect and also all theses BS's
> >>> should be physically connected to the pc.
> >>>
> >>> The whole idea is that I have several base stations as clients
> >>> and one sever.Each client wants to connect to the sever in
> >>> order to send sensing messages to its table in a data base.
> >>> In the other words, the application is just a datalogger.
> >>> So if my server receives a sensing message it should know
> >>> to which table should  send it.
> >>> For instance,I have a single client version of this application
> >>> (one BS communicates with one application)but I try to create
> >>> a multiclient version.
> >>> BB.
> 
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to