IviDiscoverableServiceIdProvider

Function interface to provide an IviServiceId for a discoverable IVI service interface.

The purpose of this interface is to reduce clutter in an IviServiceHostBuilder implementation to provide discoverable IVI service interface implementations with an IviServiceId.

An implementation of this interface can obtain the value from the IviServiceHostBuilder.discoverableServiceIds property. The provider is given the discoverable IVI service interface class; see provide for details.

Example

This example shows the function interface implementation given as the last argument (as a lambda) to the DiscoverableExampleService constructor:

class ExampleServiceHostBuilder : IviServiceHostBuilder() {
override fun build(iviServiceHostContext: IviServiceHostContext) =
SimpleIviServiceHost(
setOf(
DiscoverableExampleService(iviServiceHostContext) { interfaceClass ->
getDiscoverableServiceId(interfaceClass)
},
...
)
)
}

Functions

Link copied to clipboard
abstract fun provide(interfaceClass: KClass<*>): IviServiceId

Function interface to provide an IviServiceId for the given interfaceClass