Skip to content

Commit

Permalink
Continues starting up services after learning the car language
Browse files Browse the repository at this point in the history
  • Loading branch information
hufman committed Jan 23, 2021
1 parent 05195ea commit 1b2ceb9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/src/main/java/me/hufman/androidautoidrive/MainService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import android.os.IBinder
import android.util.Log
import androidx.core.app.NotificationCompat
import com.bmwgroup.connected.car.app.BrandType
import me.hufman.androidautoidrive.carapp.CDSConnection
import me.hufman.androidautoidrive.carapp.CDSConnectionAsync
import me.hufman.androidautoidrive.carapp.CDSVehicleLanguage
import me.hufman.androidautoidrive.carapp.RHMIDimensions
import me.hufman.androidautoidrive.carapp.*
import me.hufman.androidautoidrive.carapp.assistant.AssistantControllerAndroid
import me.hufman.androidautoidrive.carapp.assistant.AssistantApp
import me.hufman.androidautoidrive.carapp.maps.MapAppMode
Expand Down Expand Up @@ -46,6 +43,7 @@ class MainService: Service() {
val securityServiceThread by lazy { SecurityServiceThread(securityAccess) }

val carInformationObserver = CarInformationObserver()
val cdsObserver = CDSEventHandler { _, _ -> combinedCallback() }
var threadCapabilities: CarThread? = null
var carappCapabilities: CarInformationDiscovery? = null

Expand Down Expand Up @@ -81,6 +79,7 @@ class MainService: Service() {
override fun onDestroy() {
handleActionStop()
// one time things
carInformationObserver.cdsData.removeEventHandler(CDS.VEHICLE.LANGUAGE, cdsObserver)
try {
iDriveConnectionReceiver.unsubscribe(this)
} catch (e: IllegalArgumentException) {
Expand Down Expand Up @@ -120,6 +119,8 @@ class MainService: Service() {
carInformationObserver.callback = {
combinedCallback()
}
// start some more services as the car language is discovered
carInformationObserver.cdsData.addEventHandler(CDS.VEHICLE.LANGUAGE, 1000, cdsObserver)
}

private fun createNotificationChannel() {
Expand Down

0 comments on commit 1b2ceb9

Please sign in to comment.