Skip to content

Commit

Permalink
Changed test UI to test obd
Browse files Browse the repository at this point in the history
  • Loading branch information
Corwin-Kh committed Sep 25, 2024
1 parent eaf9eee commit 47a3d0f
Show file tree
Hide file tree
Showing 10 changed files with 538 additions and 296 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ object OBDDataComputer {
FUEL_LEFT_DISTANCE(true,
listOf(OBD_FUEL_LEVEL_COMMAND),
{ data -> OBDValue(OBD_FUEL_LEVEL_COMMAND, data) }),
FUEL_LEFT_LITERS(false,
listOf(OBD_FUEL_LEVEL_COMMAND),
{ data -> OBDValue(OBD_FUEL_LEVEL_COMMAND, data) }),
// FUEL_LEFT_LITERS(false,
// listOf(OBD_FUEL_LEVEL_COMMAND),
// { data -> OBDValue(OBD_FUEL_LEVEL_COMMAND, data) }),
FUEL_LEFT_PERCENT(false,
listOf(OBD_FUEL_LEVEL_COMMAND),
{ data -> OBDValue(OBD_FUEL_LEVEL_COMMAND, data) }),
Expand Down Expand Up @@ -231,7 +231,7 @@ object OBDDataComputer {
null
}

FUEL_LEFT_LITERS,
// FUEL_LEFT_LITERS,
FUEL_LEFT_PERCENT -> {
if (locValues.size > 0) {
locValues[locValues.size - 1].doubleValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,17 @@ object OBDDispatcher {
readStatusListener = listener
}

fun setReadWriteStreams(readStream: Source, writeStream: Sink) {
fun setReadWriteStreams(readStream: Source?, writeStream: Sink?) {
scope?.cancel()
inputStream = readStream
outputStream = writeStream
startReadObdLooper()
if(readStream != null && writeStream != null) {
startReadObdLooper()
}
}

fun stopReading() {
setReadWriteStreams(null, null)
}

private fun consumeResponse(command: OBDCommand, result: String) {
Expand Down
Loading

0 comments on commit 47a3d0f

Please sign in to comment.