@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class IviServiceFun

Exposes an IVI service interface function in the <Interface>Api class.

Every member function must have the suspend modifier; compilation will fail otherwise. The suspend modifier allows service implementations to suspend a function call and process other function calls before resuming the suspended function.

Member functions can have default implementations and can have default argument values. The default argument values may only reside at the end. A mix is not allowed.

Member function overloading is supported but argument types should not contain type aliases.

Each member function is exposed in the <Interface>Api class in two variants:

  1. Asynchronous, like fun <name>Async(..., onResult = null). When not null, onResult is invoked when the service function execution completes with that result or when the execution failed.

  2. A suspendable function, like suspend fun co<Name>(...): <ReturnType>. This allows the function to be called from a Kotlin coroutine. The co<Name> function throws an exception when the execution failed.

This annotation only takes effect on a interfaces annotated with an IviService or IviDiscoverableService annotation.


Link copied to clipboard
fun IviServiceFun()