This is especially for kaskade and qoncept, but others might find this interesting or worth their time to add their 2c.
kascade: I love what you've done, no complaints, what I'm bringing up in this thread is to help future proof your efforts. Awesome stuff man!
I've gotten a few random PM's asking about future logging support for things like LM1's and TXS Tuner Pros etc. There is more than likely the chance that we might decide to support other devices in the future. Basically anything that provides useful information relevant to driving a subaru, might be something we want to log.
I'm proposing we define an interface for such devices for other devs to code against. A published interface that a dev can provide an implementing JAR for a piece of hardware is the way to go.
What I'd like to see is (yes, I like ordered flow, Im anal)
1) User wants a new device of whatever functionality supported.
2) Dev has hardware at hand.
3) Dev codes a JAR against published spec.
4) We dump said JAR into a folder of JARS that all implement said interface providing support for misc harware.
5) Upon RomRaider startup the logger scans the logger dir for any such jars, pulls needed information from jars and provides their functionality to the end users.
Here is a proposed set of interfaces
Each logger would have a jar that implements this interface:
Code:
public interface LoggerInterface {
//A place to register to listen for new logger information
public void addLoggerListener(LoggerListener loggerListener, String loggerName);
//Names of available loggers (AFR, KNOCK, Accel, etc), same name as used in above method.
public String[] getNames();
//Axes name values
public String getXName(); //Left - right
public String getYName(); //Up - down
public String getZName(); //Into monitor
//Logger dimension information
public double getMaxXValue();
public double getMaxYValue();
public double getMaxZValue();
//Logger state commands
public void initLogger();
public void stopLogger();
public void startLogger();
public void pauseLogger();
public void resetLogger();
}
The RomRaider logger would register with the above interface by implementing the below:
Code:
public interface LoggerListener {
public void newLoggerValue(LoggerData data);
}
A specialized class for passing data between listeners is often helpful, we can add and remove with ease:
Code:
public class LoggerData {
private double value; //Value of new data
private String loggerName; //need to know what type of data this is
//etc....
public LoggerData(double value, String loggerName){
this.value = value;
this.loggerName = loggerName;
}
//Getters
public double getValue() {
return value;
}
public String getLoggerName() {
return loggerName;
}
}
If something like the above was in place, I could more easily get off my butt and add TXS Tuner pro support.
This is just a quick hack, we'd probably need something diff, but you get the idea.
-Eric-