static values when retrieving data
Hi elton, when i retrieve data from the elm237 device with your library, i always get a static values. for example, vehicle speed is always either 52 km\h or 65 km\h. i have tried different protocols. do you know what could be the problem? thanks, doron.
Hey @DoronShaul sorry for the late response. Can you provide an example of how are you retrieving these values?
BTW, I created a new OBD API, entirely rewritten in kotlin: https://github.com/eltonvs/kotlin-obd-api and I strongly recommend using this new one as there are a lot of improvements.
Thank you @eltonvs for the reply. i'm trying to use your kotlin library instead (my project is in java). i succeed to create an ObdDeviceConnection but i'm having issues with retrieving data because i don't really know how to convert this kotlin code - "val response = obdConnection.run(SpeedCommand())" for example, to a java code. can you help me with that? Thanks again.
Hey @DoronShaul! Sure, in java, the equivalent would be something like:
// As you have the obdConnection already
final ObdResponse response = obdConnection.run(new SpeedCommand());
The run method basically accepts an ObdCommand instance and returns an ObdResponse. Let me know if this code works for you.
Hey @eltonvs, i tried this code but it doesn't work. it seems like i have to fill all the arguments (useCache, delay, $completion). i have no problem with the useCache and delay, but i don't understand that last argument and what should i put in.
http://www.siz.co.il/my.php?i=ztzgnxmy5ncg.png
Thanks!
This code seems to be working, but of course i should return a not null value. what should it be? Thank you @eltonvs!
final ObdResponse response = (ObdResponse) deviceConnection.run(new SpeedCommand(), false, 0, new Continuation<ObdResponse>() {
@NotNull
@Override
public CoroutineContext getContext() {
return null;
}
@Override
public void resumeWith(@NotNull Object o) {
}
});
I am also experiencing this issue
I got this issue too and I found the problem that is by the response value from emulator that have all 8 bytes which includes ECU,.. and I resolve it by requesting the ATH0 command. so we will get response value we need. I think this issue because the Emulator run on ATH1.
Good Luck.