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");
YIELD_THEN_WAIT_UNTIL(msg.equals("wait"));
/* Extract Timeline statistics */
plugin = mote.getSimulation().getGUI().getStartedPlugin("se.sics.cooja.plugins.TimeLine");
/* Extract PowerTracker statistics */
plugin = mote.getSimulation().getGUI().getStartedPlugin("PowerTracker");
if (plugin != null) {
plugins++;
stats = plugin.extractStatistics();
stats = plugin.radioStatistics();
if (stats.length() > 40) {
/* Stripping */
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");