Example #1
0
 private void SetDataSource() {
   if (sf.useDummyData) {
     sf.dataSource = new DummySource(sf);
   } else if (sf.bSourceSim) {
     try {
       sf.dataSource =
           (DataSource)
               (Class.forName("net.tinyos.sf.old.nido.SimNetworkDataSource").newInstance());
       sf.dataSource.setSerialForward(sf);
     } catch (Exception e) {
       System.err.println("Cannot instantiate SimNetworkDataSource - did you compile it? " + e);
       return;
     }
   } else if (sf.bNidoSerialData) {
     // Doing it this way to avoid having to compile NidoSerialDataSource
     // which requires all of the TOSSIM event classes
     // sf.dataSource = new NidoSerialDataSource(sf);
     try {
       sf.dataSource =
           (DataSource)
               (Class.forName("net.tinyos.sf.old.nido.NidoSerialDataSource").newInstance());
       sf.dataSource.setSerialForward(sf);
     } catch (Exception e) {
       System.err.println("Cannot instantiate NidoSerialDataSource - did you compile it? " + e);
       return;
     }
   } else if (sf.bSourceDB) {
     sf.dataSource = new DBSource(sf);
   } else if (sf.bQueuedSerial) {
     System.out.println("USING QUEUED SERIAL SOURCE");
     sf.dataSource = new QueuedSerialSource(sf);
   } else if (sf.commPort_is_socket) {
     sf.dataSource = new NetworkSource(sf);
   } else {
     sf.dataSource = new SerialSource(sf);
   }
 }