getPeripheral

abstract fun <P : Peripheral?> getPeripheral(@NonNull peripheralClass: Class<P>): P

Gets a peripheral.

Return

requested peripheral, or null if it's not present

Parameters

peripheralClass

class of the peripheral

<P>

type of the peripheral class

abstract fun <P : Peripheral?> getPeripheral(@NonNull peripheralClass: Class<P>, @NonNull observer: Ref.Observer<P>): Ref<P>

Gets a peripheral and registers an observer notified each time it changes.

Return

reference to the requested peripheral

Parameters

peripheralClass

class of the peripheral

observer

observer to notify when the peripheral changes

<P>

type of the peripheral class