look it's a bugfix!
This commit is contained in:
parent
1d9af6ef1f
commit
53f7d2e16e
|
@ -25,39 +25,37 @@ public class JavaSensorsConsumer implements ConfigurationConsumer {
|
|||
ConfigField configField = iterator.cf;
|
||||
ConfigField next = iterator.next;
|
||||
|
||||
if (configField.isBit()) {
|
||||
// do not support bits for now but need to account for size
|
||||
tsPosition += configField.getSize(next);
|
||||
return tsPosition;
|
||||
if (!configField.isBit()) {
|
||||
sb.append(configField.getName()).append("(");
|
||||
|
||||
String string = readerState.variableRegistry.applyVariables(configField.getComment());
|
||||
if (string == null || string.isEmpty()) {
|
||||
string = quote(configField.getName());
|
||||
} else if (string.charAt(0) != '"') {
|
||||
// huh? weird conditional quoting?
|
||||
string = quote(string);
|
||||
}
|
||||
|
||||
sb.append(string).append(", ");
|
||||
|
||||
sb.append("SensorCategory.SENSOR_INPUTS, ");
|
||||
sb.append(JavaFieldsConsumer.getJavaType(configField.getElementSize())).append(", ");
|
||||
sb.append(tsPosition).append(", ");
|
||||
sb.append(configField.autoscaleSpecNumber()).append(", "); // scale
|
||||
sb.append(configField.getMin()).append(", ");
|
||||
sb.append(configField.getMax()).append(", ");
|
||||
|
||||
sb.append(quote(configField.getUnits())).append(")");
|
||||
|
||||
|
||||
sb.append(",");
|
||||
sb.append("\n");
|
||||
|
||||
|
||||
}
|
||||
sb.append(configField.getName()).append("(");
|
||||
|
||||
String string = readerState.variableRegistry.applyVariables(configField.getComment());
|
||||
if (string == null || string.isEmpty()) {
|
||||
string = quote(configField.getName());
|
||||
} else if (string.charAt(0) != '"') {
|
||||
// huh? weird conditional quoting?
|
||||
string = quote(string);
|
||||
}
|
||||
|
||||
sb.append(string).append(", ");
|
||||
|
||||
sb.append("SensorCategory.SENSOR_INPUTS, ");
|
||||
sb.append(JavaFieldsConsumer.getJavaType(configField.getElementSize())).append(", ");
|
||||
sb.append(tsPosition).append(", ");
|
||||
sb.append(configField.autoscaleSpecNumber()).append(", "); // scale
|
||||
sb.append(configField.getMin()).append(", ");
|
||||
sb.append(configField.getMax()).append(", ");
|
||||
|
||||
sb.append(quote(configField.getUnits())).append(")");
|
||||
|
||||
|
||||
sb.append(",");
|
||||
sb.append("\n");
|
||||
|
||||
|
||||
tsPosition += configField.getSize(next);
|
||||
// this value would be consumed by UsagesReader
|
||||
// todo: too many variables that's fragile shall we move tsPosition to iterator state?
|
||||
sensorTsPosition = tsPosition;
|
||||
|
||||
return tsPosition;
|
||||
|
|
|
@ -53,6 +53,6 @@ public class JavaSensorsConsumerTest {
|
|||
JavaSensorsConsumer javaSensorsConsumer = new JavaSensorsConsumer();
|
||||
state.readBufferedReader(outputChannels, javaSensorsConsumer);
|
||||
|
||||
assertEquals(0, javaSensorsConsumer.sensorTsPosition);
|
||||
assertEquals(4, javaSensorsConsumer.sensorTsPosition);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue