btelman96/letsrobot-android

View on GitHub
letsrobotandroid-api/src/main/java/tv/letsrobot/android/api/interfaces/IComponent.kt

Summary

Maintainability
A
0 mins
Test Coverage
package tv.letsrobot.android.api.interfaces

import android.os.Message
import kotlinx.coroutines.Deferred
import tv.letsrobot.android.api.enums.ComponentType

/**
 * Base methods that any component requires
 */
interface IComponent{
    /**
     * Enables the component asynchronously, and will return the result to a listening co-routine
     */
    fun enable() : Deferred<Boolean>
    /**
     * Disables the component asynchronously, and will return the result to a listening co-routine
     */
    fun disable() : Deferred<Boolean>

    /**
     * Dispatches a message to the component's handler.
     */
    fun dispatchMessage(message: Message)

    /**
     * Set an event listener for this component
     */
    fun setEventListener(listener : ComponentEventListener?)

    /**
     * Gets the current type of the component based on Component.Companion.Event
     */
    fun getType() : ComponentType
}