Skip to content

Commit

Permalink
refactor: Unify naming describing vehicle state
Browse files Browse the repository at this point in the history
  • Loading branch information
tzebrowski committed Jan 23, 2025
1 parent a91852d commit 524d87e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions app/src/main/java/org/obd/graphs/activity/Receivers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -229,24 +229,24 @@ internal fun MainActivity.receive(intent: Intent?) {
handleStop()
}

EVENT_VEHICLE_STATUS_VEHICLE_MOVING -> {
updateVehicleStatus("MOV")
EVENT_VEHICLE_STATUS_VEHICLE_RUNNING -> {
updateVehicleStatus("Running")
}

EVENT_VEHICLE_STATUS_VEHICLE_IDLING -> {
updateVehicleStatus("IDL")
updateVehicleStatus("Idling")
}

EVENT_VEHICLE_STATUS_IGNITION_OFF -> {
updateVehicleStatus("OFF")
updateVehicleStatus("Key off")
if (dataLoggerPreferences.instance.vehicleStatusDisconnectWhenOff){
Log.i(LOG_TAG,"Received vehicle status OFF event. Closing the session.")
dataLogger.stop()
}
}

EVENT_VEHICLE_STATUS_IGNITION_ON -> {
updateVehicleStatus("ON")
updateVehicleStatus("Key on")
}

EVENT_VEHICLE_STATUS_CHANGED->{
Expand Down Expand Up @@ -323,7 +323,7 @@ internal fun MainActivity.registerReceiver() {
it.addAction(REQUEST_LOCATION_PERMISSIONS)
it.addAction(RESET_TOOLBAR_ANIMATION)

it.addAction(EVENT_VEHICLE_STATUS_VEHICLE_MOVING)
it.addAction(EVENT_VEHICLE_STATUS_VEHICLE_RUNNING)
it.addAction(EVENT_VEHICLE_STATUS_VEHICLE_IDLING)
it.addAction(EVENT_VEHICLE_STATUS_IGNITION_OFF)
it.addAction(EVENT_VEHICLE_STATUS_VEHICLE_ACCELERATING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ internal class NavTemplateCarScreen(
it.addAction(CarConnection.ACTION_CAR_CONNECTION_UPDATED)
it.addAction(CHANGE_SCREEN_EVENT)

it.addAction(EVENT_VEHICLE_STATUS_VEHICLE_MOVING)
it.addAction(EVENT_VEHICLE_STATUS_VEHICLE_RUNNING)
it.addAction(EVENT_VEHICLE_STATUS_VEHICLE_IDLING)
it.addAction(EVENT_VEHICLE_STATUS_IGNITION_OFF)
it.addAction(EVENT_VEHICLE_STATUS_VEHICLE_ACCELERATING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import org.obd.graphs.bl.query.isVehicleStatus
import org.obd.graphs.sendBroadcastEvent
import org.obd.metrics.api.model.ObdMetric

const val EVENT_VEHICLE_STATUS_VEHICLE_MOVING = "event.vehicle.status.vehicle.moving"
const val EVENT_VEHICLE_STATUS_VEHICLE_RUNNING = "event.vehicle.status.vehicle.running"
const val EVENT_VEHICLE_STATUS_VEHICLE_IDLING = "event.vehicle.status.vehicle.idling"
const val EVENT_VEHICLE_STATUS_IGNITION_OFF = "event.vehicle.status.vehicle.ignition_off"
const val EVENT_VEHICLE_STATUS_IGNITION_ON = "event.vehicle.status.vehicle.ignition_on"
Expand Down Expand Up @@ -48,7 +48,7 @@ internal class VehicleStatusMetricsProcessor : MetricsProcessor {
currentVehicleDecelerating = value["vehicle.decelerating"]!!

if (currentEngineRunning && currentVehicleRunning) {
sendBroadcastEvent(EVENT_VEHICLE_STATUS_VEHICLE_MOVING)
sendBroadcastEvent(EVENT_VEHICLE_STATUS_VEHICLE_RUNNING)
}

if (currentEngineRunning && !currentVehicleRunning) {
Expand Down

0 comments on commit 524d87e

Please sign in to comment.