summaryrefslogtreecommitdiff
path: root/dslog/Main.java
blob: c8c93fb6456824ffe5b894ff0d7659e703ac6a20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package dslog;

import java.io.EOFException;
import java.io.FileInputStream;
import java.io.IOException;

class Main {
	public static String line(DslogReader.Entry e) {
		return
			e.time+","+
			e.tripTime+","+
			e.lostPackets+","+
			e.voltageVolts+","+
			e.cpuPct+","+
			e.robotDisable+","+
			e.robotAuto+","+
			e.robotTele+","+
			e.dsDisable+","+
			e.dsAuto+","+
			e.dsTele+","+
			e.watchdog+","+
			e.brownout+","+
			e.canPct+","+
			e.signalDB+","+
			e.bandwidthMb+","+
			e.pdpID+","+
			e.pdpPad+","+
			e.pdpValues[0]+","+
			e.pdpValues[1]+","+
			e.pdpValues[2]+","+
			e.pdpValues[3]+","+
			e.pdpValues[4]+","+
			e.pdpValues[5]+","+
			e.pdpValues[6]+","+
			e.pdpValues[7]+","+
			e.pdpValues[8]+","+
			e.pdpValues[9]+","+
			e.pdpValues[10]+","+
			e.pdpValues[11]+","+
			e.pdpValues[12]+","+
			e.pdpValues[13]+","+
			e.pdpValues[14]+","+
			e.pdpValues[15]+","+
			e.pdpResistance+","+
			e.pdpVoltage+","+
			e.pdpTemperature;
	}
	public static void main(String[] args) throws IOException {
		for (String filename : args) {
			System.out.println("Filename: "+filename);
			DslogReader file = new DslogReader(new FileInputStream(filename));
			System.out.println("Format Version: "+file.version);
			System.out.println("Start Time: "+file.startTime);
			System.out.println("time,tripTime,lost (packets),voltage (V),cpu (%),robot disable,robot auto,robot tele,ds disable,ds auto,ds tele,watchdog,brownout,CAN (%),signal (dB),bandwidth (Mb),PDP ID,PDP pad,PDP-0,PDP-1,PDP-2,PDP-3,PDP-4,PDP-5,PDP-6,PDP-7,PDP-8,PDP-9,PDP-10,PDP-11,PDP-12,PDP-13,PDP-14,PDP-15,PDP Resistance,PDP Voltage,PDP Temperature");
			for (;;) {
				try {
					System.out.println(line(file.readEntry()));
				} catch (EOFException e) {
					break;
				}
			}
			file.close();
		}
	}
}