mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-01-09 03:30:01 +00:00
moved Avrora motes into the mspsim array and renamed
This commit is contained in:
parent
f8ea34a689
commit
1da3c2544c
@ -24,7 +24,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: GUI.java,v 1.106 2009/02/20 16:50:16 fros4943 Exp $
|
* $Id: GUI.java,v 1.107 2009/02/23 08:33:23 joxe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja;
|
package se.sics.cooja;
|
||||||
@ -2189,12 +2189,15 @@ public class GUI extends Observable {
|
|||||||
moteTypeOK = newMoteType.configureAndInit(GUI.getTopParentContainer(), mySimulation, isVisualized());
|
moteTypeOK = newMoteType.configureAndInit(GUI.getTopParentContainer(), mySimulation, isVisualized());
|
||||||
} catch (InstantiationException e) {
|
} catch (InstantiationException e) {
|
||||||
logger.fatal("Exception when creating mote type: " + e);
|
logger.fatal("Exception when creating mote type: " + e);
|
||||||
|
e.printStackTrace();
|
||||||
return;
|
return;
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
logger.fatal("Exception when creating mote type: " + e);
|
logger.fatal("Exception when creating mote type: " + e);
|
||||||
|
e.printStackTrace();
|
||||||
return;
|
return;
|
||||||
} catch (MoteTypeCreationException e) {
|
} catch (MoteTypeCreationException e) {
|
||||||
logger.fatal("Exception when creating mote type: " + e);
|
logger.fatal("Exception when creating mote type: " + e);
|
||||||
|
e.printStackTrace();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: Simulation.java,v 1.40 2009/02/18 16:01:31 fros4943 Exp $
|
* $Id: Simulation.java,v 1.41 2009/02/23 08:33:23 joxe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja;
|
package se.sics.cooja;
|
||||||
@ -134,11 +134,11 @@ public class Simulation extends Observable implements Runnable {
|
|||||||
|
|
||||||
private EventQueue eventQueue = new EventQueue();
|
private EventQueue eventQueue = new EventQueue();
|
||||||
|
|
||||||
private Mote[] mspMoteArray;
|
private Mote[] emulatedMoteArray;
|
||||||
private TimeEvent tickMspMotesEvent = new TimeEvent(0) {
|
private TimeEvent tickemulatedMotesEvent = new TimeEvent(0) {
|
||||||
public void execute(long t) {
|
public void execute(long t) {
|
||||||
/*logger.info("MSP motes tick at: " + t);*/
|
/*logger.info("MSP motes tick at: " + t);*/
|
||||||
if (mspMoteArray.length == 0) {
|
if (emulatedMoteArray.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ public class Simulation extends Observable implements Runnable {
|
|||||||
while (wantMoreTicks) {
|
while (wantMoreTicks) {
|
||||||
/* Tick all MSP motes until none need more ticks */
|
/* Tick all MSP motes until none need more ticks */
|
||||||
wantMoreTicks = false;
|
wantMoreTicks = false;
|
||||||
for (Mote element : mspMoteArray) {
|
for (Mote element : emulatedMoteArray) {
|
||||||
if (element.tick(currentSimulationTime)) {
|
if (element.tick(currentSimulationTime)) {
|
||||||
wantMoreTicks = true;
|
wantMoreTicks = true;
|
||||||
}
|
}
|
||||||
@ -191,16 +191,19 @@ public class Simulation extends Observable implements Runnable {
|
|||||||
|
|
||||||
private void recreateTickLists() {
|
private void recreateTickLists() {
|
||||||
/* Tick MSP motes separately */
|
/* Tick MSP motes separately */
|
||||||
ArrayList<Mote> mspMotes = new ArrayList<Mote>();
|
ArrayList<Mote> emulatedMotes = new ArrayList<Mote>();
|
||||||
ArrayList<Mote> contikiMotes = new ArrayList<Mote>();
|
ArrayList<Mote> contikiMotes = new ArrayList<Mote>();
|
||||||
for (Mote mote: motes) {
|
for (Mote mote: motes) {
|
||||||
|
/* TODO: fixe an emulatedMote generic class */
|
||||||
if (mote.getType().getClass().toString().contains(".mspmote.")) {
|
if (mote.getType().getClass().toString().contains(".mspmote.")) {
|
||||||
mspMotes.add(mote);
|
emulatedMotes.add(mote);
|
||||||
|
} else if (mote.getType().getClass().toString().contains(".avrmote.")) {
|
||||||
|
emulatedMotes.add(mote);
|
||||||
} else {
|
} else {
|
||||||
contikiMotes.add(mote);
|
contikiMotes.add(mote);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mspMoteArray = mspMotes.toArray(new Mote[mspMotes.size()]);
|
emulatedMoteArray = emulatedMotes.toArray(new Mote[emulatedMotes.size()]);
|
||||||
moteArray = contikiMotes.toArray(new Mote[contikiMotes.size()]);
|
moteArray = contikiMotes.toArray(new Mote[contikiMotes.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +215,7 @@ public class Simulation extends Observable implements Runnable {
|
|||||||
|
|
||||||
/* Schedule tick events */
|
/* Schedule tick events */
|
||||||
scheduleEventUnsafe(tickMotesEvent, currentSimulationTime);
|
scheduleEventUnsafe(tickMotesEvent, currentSimulationTime);
|
||||||
scheduleEventUnsafe(tickMspMotesEvent, currentSimulationTime);
|
scheduleEventUnsafe(tickemulatedMotesEvent, currentSimulationTime);
|
||||||
scheduleEventUnsafe(delayEvent, currentSimulationTime);
|
scheduleEventUnsafe(delayEvent, currentSimulationTime);
|
||||||
|
|
||||||
/* Simulation starting */
|
/* Simulation starting */
|
||||||
@ -229,7 +232,7 @@ public class Simulation extends Observable implements Runnable {
|
|||||||
if (rescheduleEvents) {
|
if (rescheduleEvents) {
|
||||||
rescheduleEvents = false;
|
rescheduleEvents = false;
|
||||||
scheduleEventUnsafe(tickMotesEvent, currentSimulationTime);
|
scheduleEventUnsafe(tickMotesEvent, currentSimulationTime);
|
||||||
scheduleEventUnsafe(tickMspMotesEvent, currentSimulationTime);
|
scheduleEventUnsafe(tickemulatedMotesEvent, currentSimulationTime);
|
||||||
scheduleEventUnsafe(delayEvent, currentSimulationTime);
|
scheduleEventUnsafe(delayEvent, currentSimulationTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user