PeripheralProvider
public protocol PeripheralProvider
Protocol that provides functions to get peripherals.
-
Gets a peripheral.
Return the requested peripheral or
nil
if the drone doesn’t have the requested peripheral, or if the peripheral is not available in the current connection state.Declaration
Swift
func getPeripheral<Desc>(_ desc: Desc) -> Desc.ApiProtocol? where Desc : PeripheralClassDesc
Parameters
desc
requested peripheral. See
Peripherals
api for available descriptors instances.Return Value
requested peripheral
-
Gets a peripheral and registers an observer notified each time it changes.
If the peripheral is present, the observer will be called immediately with. If the peripheral is not present, the observer won’t be called until the peripheral is added to the drone. If the peripheral or the drone are removed, the observer will be notified and referenced value is set to
nil
.Declaration
Swift
func getPeripheral<Desc: PeripheralClassDesc>(_ desc: Desc, observer: @escaping Ref<Desc.ApiProtocol>.Observer) -> Ref<Desc.ApiProtocol>
Parameters
desc
requested peripheral. See
Peripherals
api for available descriptors instances.observer
observer to notify when the peripheral changes
Return Value
reference to the requested peripheral