|
@@ -11,17 +11,41 @@ pluginContext.table.addOutputControlColumn(3);
|
11
|
11
|
pluginContext.table.addOutputControlColumn(4);
|
12
|
12
|
pluginContext.table.addOutputAnnotationColumn(5);
|
13
|
13
|
var lines = pluginContext.data.split('\n');
|
14
|
|
-for(var i = 0; i < lines.length; i++) {
|
15
|
|
- var fields = lines[i].split(',');
|
16
|
|
- if(fields[5] == "roasting") {
|
17
|
|
- var time = new QTime;
|
18
|
|
- time = time.addSecs(Number(fields[0]));
|
19
|
|
- pluginContext.newMeasurement(new Measurement(Units.convertTemperature(fields[4], Units.Celsius, Units.Fahrenheit), time), 1);
|
20
|
|
- pluginContext.newMeasurement(new Measurement(Units.convertTemperature(fields[2], Units.Celsius, Units.Fahrenheit), time), 2);
|
21
|
|
- pluginContext.newMeasurement(new Measurement(fields[1], time, Units.Unitless), 3);
|
22
|
|
- pluginContext.newMeasurement(new Measurement(fields[6], time, Units.Unitless), 4);
|
23
|
|
- }
|
|
14
|
+var headers = lines[0].split(',');
|
|
15
|
+if(headers[1] == 'state') {
|
|
16
|
+ importV2(lines);
|
|
17
|
+} else {
|
|
18
|
+ importV1(lines);
|
24
|
19
|
}
|
25
|
20
|
for(var i = 1; i < 5; i++) {
|
26
|
21
|
pluginContext.table.newAnnotation("End", i, 5);
|
27
|
|
-}
|
|
22
|
+}
|
|
23
|
+
|
|
24
|
+function importV1(lines) {
|
|
25
|
+ for(var i = 0; i < lines.length; i++) {
|
|
26
|
+ var fields = lines[i].split(',');
|
|
27
|
+ if(fields[5] == "roasting") {
|
|
28
|
+ var time = new QTime;
|
|
29
|
+ time = time.addSecs(Number(fields[0]));
|
|
30
|
+ pluginContext.newMeasurement(new Measurement(Units.convertTemperature(fields[4], Units.Celsius, Units.Fahrenheit), time), 1);
|
|
31
|
+ pluginContext.newMeasurement(new Measurement(Units.convertTemperature(fields[2], Units.Celsius, Units.Fahrenheit), time), 2);
|
|
32
|
+ pluginContext.newMeasurement(new Measurement(fields[1], time, Units.Unitless), 3);
|
|
33
|
+ pluginContext.newMeasurement(new Measurement(fields[6], time, Units.Unitless), 4);
|
|
34
|
+ }
|
|
35
|
+ }
|
|
36
|
+}
|
|
37
|
+
|
|
38
|
+function importV2(lines) {
|
|
39
|
+ for(var i = 0; i < lines.length; i++) {
|
|
40
|
+ var fields = lines[i].split(',');
|
|
41
|
+ if(fields[1] == "roasting") {
|
|
42
|
+ var time = new QTime;
|
|
43
|
+ time = time.addSecs(Number(fields[0]));
|
|
44
|
+ pluginContext.newMeasurement(new Measurement(Units.convertTemperature(fields[3], Units.Celsius, Units.Fahrenheit), time), 1);
|
|
45
|
+ pluginContext.newMeasurement(new Measurement(Units.convertTemperature(fields[2], Units.Celsius, Units.Fahrenheit), time), 2);
|
|
46
|
+ pluginContext.newMeasurement(new Measurement(fields[4], time, Units.Unitless), 3);
|
|
47
|
+ pluginContext.newMeasurement(new Measurement(fields[6], time, Units.Unitless), 4);
|
|
48
|
+ }
|
|
49
|
+ }
|
|
50
|
+}
|
|
51
|
+
|