qisdk / com.aldebaran.qi.sdk / Qi / onHandler

onHandler

static fun <Arg : Any!, Ret : Any!> onHandler(function: Function<Arg, Ret>!, handler: Handler!): Function<Arg, Ret>!

Wrap the Function so that its callbacks are executed on the Handler.

Parameters

function - Function<Arg, Ret>!: the function to wrap

handler - Handler!: the handler

- the output future type

- the input future type

Return
Function<Arg, Ret>!: a Function executed on the Handler

static fun <Arg : Any!> onHandler(consumer: Consumer<Arg>!, handler: Handler!): Consumer<Arg>!

Wrap the Consumer so that its callbacks are executed on the Handler.

Parameters

consumer - Consumer<Arg>!: the function to wrap

handler - Handler!: the handler

- the input future type

Return
Consumer<Arg>!: a Consumer executed on the Handler

static fun onHandler(listener: QiDisconnectionListener!, handler: Handler!): QiDisconnectionListener!

Wrap the QiDisconnectionListener so that its callbacks are executed on the Handler.

Parameters

listener - QiDisconnectionListener!: the listener to wrap

handler - Handler!: the handler

Return
QiDisconnectionListener!: a QiDisconnectionListener executed on the Handler

static fun <T : Any!> onHandler(interf: Class<T>!, callback: Any!, handler: Handler!): T

Wrap the interface implementation so that its callbacks are executed on the Handler.

Parameters

interf - Class<T>!: the interface to implement

callback - Any!: the callback to wrap

handler - Handler!: the handler

- the output type

Return
T: an instance of the interface that will call the callback on theHandler