Improved parsing of serial data and output

This commit is contained in:
adamdunkels 2009-02-08 19:38:22 +00:00
parent 54b4226f70
commit 0d1e7e9b32
2 changed files with 102 additions and 96 deletions

View File

@ -10,16 +10,6 @@ print_stats()
total_dups + " dups, " + total_dups + " dups, " +
(total_dups / nrNodes) + " dups/node, " + (total_dups / nrNodes) + " dups/node, " +
(total_hops / total_received) + " hops/message\n"); (total_hops / total_received) + " hops/message\n");
log.log("Received: ");
for(i = 1; i <= nrNodes; i++) {
log.log(count[i] + " ");
}
log.log("\n");
log.log("Hops: ");
for(i = 1; i <= nrNodes; i++) {
log.log(hops[i] + " ");
}
log.log("\n");
log.log("Seqnos: "); log.log("Seqnos: ");
for(i = 1; i <= nrNodes; i++) { for(i = 1; i <= nrNodes; i++) {
log.log(seqnos[i] + " "); log.log(seqnos[i] + " ");
@ -35,6 +25,16 @@ print_stats()
log.log(dups[i] + " "); log.log(dups[i] + " ");
} }
log.log("\n"); log.log("\n");
log.log("Hops: ");
for(i = 1; i <= nrNodes; i++) {
log.log(hops[i] + " ");
}
log.log("\n");
log.log("Received: ");
for(i = 1; i <= nrNodes; i++) {
log.log(count[i] + " ");
}
log.log("\n");
} }
/* Conf. */ /* Conf. */
@ -84,6 +84,7 @@ while(true) {
YIELD(); YIELD();
/* Count sensor data packets */ /* Count sensor data packets */
if(msg.startsWith("Sink")) {
node_text = msg.split(" ")[4]; node_text = msg.split(" ")[4];
seqno_text = msg.split(" ")[6]; seqno_text = msg.split(" ")[6];
hops_text = msg.split(" ")[8]; hops_text = msg.split(" ")[8];
@ -125,4 +126,6 @@ while(true) {
log.testOK(); log.testOK();
} }
} }
print_stats();
}
} }

View File

@ -10,16 +10,6 @@ print_stats()
total_dups + " dups, " + total_dups + " dups, " +
(total_dups / nrNodes) + " dups/node, " + (total_dups / nrNodes) + " dups/node, " +
(total_hops / total_received) + " hops/message\n"); (total_hops / total_received) + " hops/message\n");
log.log("Received: ");
for(i = 1; i <= nrNodes; i++) {
log.log(count[i] + " ");
}
log.log("\n");
log.log("Hops: ");
for(i = 1; i <= nrNodes; i++) {
log.log(hops[i] + " ");
}
log.log("\n");
log.log("Seqnos: "); log.log("Seqnos: ");
for(i = 1; i <= nrNodes; i++) { for(i = 1; i <= nrNodes; i++) {
log.log(seqnos[i] + " "); log.log(seqnos[i] + " ");
@ -35,6 +25,16 @@ print_stats()
log.log(dups[i] + " "); log.log(dups[i] + " ");
} }
log.log("\n"); log.log("\n");
log.log("Hops: ");
for(i = 1; i <= nrNodes; i++) {
log.log(hops[i] + " ");
}
log.log("\n");
log.log("Received: ");
for(i = 1; i <= nrNodes; i++) {
log.log(count[i] + " ");
}
log.log("\n");
} }
/* Conf. */ /* Conf. */
@ -84,6 +84,7 @@ while(true) {
YIELD(); YIELD();
/* Count sensor data packets */ /* Count sensor data packets */
if(msg.startsWith("Sink")) {
node_text = msg.split(" ")[4]; node_text = msg.split(" ")[4];
seqno_text = msg.split(" ")[6]; seqno_text = msg.split(" ")[6];
hops_text = msg.split(" ")[8]; hops_text = msg.split(" ")[8];
@ -125,4 +126,6 @@ while(true) {
log.testOK(); log.testOK();
} }
} }
print_stats();
}
} }