KarooSystemService

class KarooSystemService(context: Context)

Karoo System Service for interaction with Karoo-specific state and hardware.

Samples

import android.content.Context
import android.widget.RemoteViews
import io.hammerhead.karooext.KarooSystemService
import io.hammerhead.karooext.extension.DataTypeImpl
import io.hammerhead.karooext.extension.KarooExtension
import io.hammerhead.karooext.internal.Emitter
import io.hammerhead.karooext.internal.ViewEmitter
import io.hammerhead.karooext.models.StreamState
import io.hammerhead.karooext.models.UpdateGraphicConfig
import io.hammerhead.karooext.models.ViewConfig

fun main() { 
   //sampleStart 
   val karooSystem by lazy { KarooSystemService(context) }
// On lifecycle start
karooSystem.connect {
    println("karoo system connected")
}
// On lifecycle end
karooSystem.disconnect() 
   //sampleEnd
}

Constructors

Link copied to clipboard
constructor(context: Context)

Properties

Link copied to clipboard

KarooSystem is connected and ready for calls.

Link copied to clipboard

Get the hardware type of the connected Karoo System.

Link copied to clipboard

Get information about the connected Karoo System.

Link copied to clipboard

Get the version of ext lib service is running.

Link copied to clipboard

Get the serial of the connected Karoo System.

Functions

Link copied to clipboard
inline fun <T : KarooEvent> addConsumer(noinline onError: (String) -> Unit? = null, noinline onComplete: () -> Unit? = null, noinline onEvent: (T) -> Unit): String

Register a listener to events or state changes as they happen.

inline fun <T : KarooEvent> addConsumer(params: KarooEventParams, noinline onError: (String) -> Unit? = null, noinline onComplete: () -> Unit? = null, noinline onEvent: (T) -> Unit): String

Register a listener with params to events or state changes as they happen.

Link copied to clipboard
fun connect(onConnection: (Boolean) -> Unit? = null)

Connect to KarooSystem

Link copied to clipboard

Disconnect from KarooSystem and unregister all consumers

Link copied to clipboard

Send a KarooEffect to the Karoo System service for handling.

Link copied to clipboard
fun removeConsumer(consumerId: String)

Unregister a consume from events.