IviServiceApiBase

abstract class IviServiceApiBase<C : IviServiceConnection<P, PO>, P : Any, PO : IviServicePropertiesObserver, LP : Any> constructor(    connectionManager: IviServiceConnectionManager<C, LP>,     lifecycleOwner: LifecycleOwner,     serviceId: IviServiceId,     iviInstanceIdProvider: IviInstanceIdProvider) : IviServiceApi<C, P, PO, LP>

Base class for <Interface>Api classes.

Goal for this class is to keep the generated <Interface>Api class as simple as possible. As a result, the generic types of this class are a bit complex.

This class is parameterized by a <Interface>Connection interface C of the IVI service. Interface C extends the IviServiceConnection interface which is parameterized by the <Interface>Properties class P and the <Interface>PropertiesObserver interface PO of the IVI service.

As such, this class is parameterized by C, P, PO and LP:

  • C: The connection interface of the IVI service.

  • P: The properties class of the IVI services.

  • PO: The properties observer interface of the IVI service.

  • LP: The LiveData properties class of the IVI service.

As any <Interface>Api has to deal with observing an IviServiceConnectionManager and register the observer on a new connection, this base class deals with it as best as it can.

Parameters

connectionManager

The connection manager used to connect to the service instance.

lifecycleOwner

The lifecycle owner of this <Interface>Api instance.

serviceId

The service ID of the IVI service.

iviInstanceIdProvider

The IVI instance ID provider.

Constructors

Link copied to clipboard
fun <C : IviServiceConnection<P, PO>, LP : Any> IviServiceApiBase(    connectionManager: IviServiceConnectionManager<C, LP>,     lifecycleOwner: LifecycleOwner,     serviceId: IviServiceId,     iviInstanceIdProvider: IviInstanceIdProvider)

Types

Link copied to clipboard
interface IviServiceApiBaseEvents : TraceEventListener

Properties

Link copied to clipboard
open override val serviceAvailable: LiveData<Boolean>

Report the service as available after connectionToAvailableService is set to a non-null value.

Functions

Link copied to clipboard
open override fun queueOrRunAction(action: () -> Unit)

Runs an action if the service is available. Otherwise, it adds the action to a queue that will be processed when the service becomes available.