This commit is contained in:
rusefi 2017-11-18 10:04:54 -05:00
parent 1d799a5496
commit b20e996a9b
3 changed files with 17 additions and 1 deletions

View File

@ -5,6 +5,8 @@ package com.rusefi.core;
* (c) Andrey Belomutskiy
*/
public interface ISensorCentral {
void initialize(EngineState es);
double getValue(Sensor sensor);
void setValue(double value, Sensor sensor);
@ -15,5 +17,5 @@ public interface ISensorCentral {
void removeListener(Sensor sensor, SensorCentral.SensorListener listener);
void initialize(EngineState es);
ValueSource getValueSource(Sensor sensor);
}

View File

@ -87,6 +87,11 @@ public class SensorCentral implements ISensorCentral {
listeners.remove(listener);
}
@Override
public ValueSource getValueSource(Sensor sensor) {
return () -> SensorCentral.this.getValue(sensor);
}
@Override
public void initialize(EngineState es) {
addDoubleSensor(RPM_KEY, Sensor.RPM, es);

View File

@ -0,0 +1,9 @@
package com.rusefi.core;
/**
* 11/16/2017
* (c) Andrey Belomutskiy
*/
public interface ValueSource {
double getValue();
}