example script demonstrating how to interface powertracker plugin

This commit is contained in:
Fredrik Osterlind 2012-04-10 13:52:12 +02:00
parent 6dd1c42e8d
commit 88eafcf479
1 changed files with 6 additions and 4 deletions

View File

@ -38,16 +38,18 @@ while (counter<10) {
GENERATE_MSG(1000, "wait"); GENERATE_MSG(1000, "wait");
YIELD_THEN_WAIT_UNTIL(msg.equals("wait")); YIELD_THEN_WAIT_UNTIL(msg.equals("wait"));
/* Extract Timeline statistics */ /* Extract PowerTracker statistics */
plugin = mote.getSimulation().getGUI().getStartedPlugin("se.sics.cooja.plugins.TimeLine"); plugin = mote.getSimulation().getGUI().getStartedPlugin("PowerTracker");
if (plugin != null) { if (plugin != null) {
plugins++; plugins++;
stats = plugin.extractStatistics(); stats = plugin.radioStatistics();
if (stats.length() > 40) { if (stats.length() > 40) {
/* Stripping */ /* Stripping */
stats = stats.substring(0, 40) + "..."; stats = stats.substring(0, 40) + "...";
} }
log.log("Timeline: Extracted statistics:\n" + stats + "\n"); log.log("PowerTracker: Extracted statistics:\n" + stats + "\n");
} else {
log.log("No PowerTracker plugin\n");
} }
GENERATE_MSG(1000, "wait"); GENERATE_MSG(1000, "wait");