InstrumentProvider

public protocol InstrumentProvider

Protocol that provides functions to get instruments.

  • Gets an instrument.

    Returns the requested instrument or nil if the drone doesn’t have the requested instrument or if the instrument is not available in the current connection state.

    Declaration

    Swift

    func getInstrument<Desc>(_ desc: Desc) -> Desc.ApiProtocol? where Desc : InstrumentClassDesc

    Parameters

    desc

    requested instrument. See Instruments api for available descriptors instances.

    Return Value

    requested instrument

  • Gets an instrument and registers an observer notified each time it changes.

    If the instrument is present, the observer will be called immediately with. If the instrument is not present, the observer won’t be called until the instrument is added to the drone. If the instrument or the drone are removed, the observer will be notified and referenced value is set to nil.

    Declaration

    Swift

    func getInstrument<Desc: InstrumentClassDesc>(_ desc: Desc,
                              observer: @escaping Ref<Desc.ApiProtocol>.Observer) -> Ref<Desc.ApiProtocol>

    Parameters

    desc

    requested instrument. See Instruments api for available descriptors instances.

    observer

    observer to notify when the instrument changes

    Return Value

    reference to the requested instrument