Drone

@objcMembers
@objc(GSDrone)
public class Drone : NSObject, PilotingItfProvider, InstrumentProvider, PeripheralProvider
extension Drone: GSInstrumentProvider
extension Drone: GSPeripheralProvider
extension Drone: GSPilotingItfProvider

Generic drone.

  • Drone model.

    See more

    Declaration

    Swift

    @objc(GSDroneModel)
    public enum Model : Int, CustomStringConvertible
  • uid

    Drone unique identifier, persistant between sessions.

    Declaration

    Swift

    public var uid: String { get }
  • Drone model.

    Declaration

    Swift

    public var model: Model { get }
  • Drone name.

    Declaration

    Swift

    public var name: String { get }
  • Drone state.

    Declaration

    Swift

    public var state: DeviceState { get }
  • Debug description.

    Declaration

    Swift

    override public var description: String { get }
  • Equatable (override the isEqual function because Drone inherits from NSObject)

    Declaration

    Swift

    override public func isEqual(_ object: Any?) -> Bool
  • Gets the drone name and registers an observer notified each time it changes.

    The observer is called immediately with the current drone name and will be called each time it changes.

    Seealso

    property name to get current name without registering an observer

    Declaration

    Swift

    public func getName(observer: @escaping Ref<String>.Observer) -> Ref<String>

    Parameters

    observer

    observer to notify when the drone name changes

    Return Value

    reference to drone name

  • Gets the drone state and registers an observer notified each time it changes.

    The observer is called immediately with the current drone state and will be called each time it changes.

    Seealso

    property state to get current state without registering an observer

    Declaration

    Swift

    public func getState(observer: @escaping Ref<DeviceState>.Observer) -> Ref<DeviceState>

    Parameters

    observer

    observer to notify when the drone state changes

    Return Value

    reference to drone state

  • Forgets the drone.

    Persisted drone data are deleted and the drone is removed from the list of drones if it’s no more available.

    Declaration

    Swift

    public func forget() -> Bool

    Return Value

    true if the drone has been forgotten, false otherwise

  • Connects the drone.

    Declaration

    Swift

    public func connect(connector: DeviceConnector) -> Bool

    Parameters

    connector

    connector to use to connect the drone

    Return Value

    true if the connection process has started

  • Connects the drone with a password.

    Declaration

    Swift

    public func connect(connector: DeviceConnector, password: String) -> Bool

    Parameters

    connector

    connector to use to connect the drone

    password

    password to connect the drone

    Return Value

    true if the connection process has started

  • Connects the drone using the best connector.

    Declaration

    Swift

    public func connect() -> Bool

    Return Value

    true if the connection process has started, false otherwise.

  • Disconnects the drone.

    This method can be use to disconnect the drone when connected or to cancel the connection process if the drone is connecting.

    Declaration

    Swift

    public func disconnect() -> Bool

    Return Value

    true if the disconnection process has started, false otherwise.

  • Gets a piloting interface.

    Return the requested piloting interface or nil if the drone doesn’t have the requested piloting interface, or if the piloting interface is not available in the current connection state.

    Declaration

    Swift

    public func getPilotingItf<Desc>(_ desc: Desc) -> Desc.ApiProtocol? where Desc : PilotingItfClassDesc

    Parameters

    desc

    requested piloting interface. See PilotingItfs api for available descriptors instances.

    Return Value

    requested piloting interface

  • Gets a piloting interface and registers an observer notified each time it changes.

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

    Declaration

    Swift

    public func getPilotingItf<Desc: PilotingItfClassDesc>(_ desc: Desc,
                               observer: @escaping Ref<Desc.ApiProtocol>.Observer) -> Ref<Desc.ApiProtocol>

    Parameters

    desc

    requested piloting interface. See PilotingItfs api for available descriptors instances.

    observer

    observer to notify when the piloting interface changes

    Return Value

    reference to the requested piloting interface

  • 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

    public 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

    public 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

  • Gets a peripheral.

    Returns 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

    public 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

    public 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

  • Gets the drone name and registers an observer notified each time it changes.

    If the drone is removed, the observer will be notified and the referenced value is set to nil.

    Note

    This method is for Objective-C only. Swift must use func getName:observer.

    Seealso

    property name to get current name without registering an observer

    Declaration

    Swift

    @objc(getNameRef:)
    func getNameRef(observer: @escaping (String?) -> Void) -> GSNameRef

    Parameters

    observer

    observer to notify when the drone name changes

    Return Value

    reference to drone name

  • Gets the drone state and registers an observer notified each time it changes

    If the drone is removed, the observer will be notified and the referenced value is set to nil.

    Note

    This method is for Objective-C only. Swift must use func getState:observer.

    Seealso

    property state to get current state without registering an observer

    Declaration

    Swift

    @objc(getStateRef:)
    func getStateRef(observer: @escaping (DeviceState?) -> Void) -> GSDeviceStateRef

    Parameters

    observer

    observer to notify when the drone state changes

    Return Value

    reference to drone state

  • Wrapper around a Set of GSDroneModel. This is only for Objective-C use.

    See more

    Declaration

    Swift

    @objc
    class GSDroneModelSet : NSObject
  • Gets an instrument.

    Note

    This method is for Objective-C only. Swift must use func getInstrument:.

    Declaration

    Swift

    public func getInstrument(desc: ComponentDescriptor) -> Instrument?

    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.

    Note

    This method is for Objective-C only. Swift must use func getInstrument:desc:observer.

    Declaration

    Swift

    public func getInstrumentRef(desc: ComponentDescriptor, observer: @escaping (Instrument?) -> Void)
        -> GSInstrumentRef

    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

  • Gets a peripheral.

    Note

    This method is for Objective-C only. Swift must use func getPeripheral:.

    Declaration

    Swift

    public func getPeripheral(desc: ComponentDescriptor) -> Peripheral?

    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.

    Note

    This method is for Objective-C only. Swift must use func getPeripheral:desc:observer.

    Declaration

    Swift

    public func getPeripheralRef(desc: ComponentDescriptor, observer: @escaping (Peripheral?) -> Void)
        -> GSPeripheralRef

    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

  • Gets a piloting interface.

    Note

    This method is for Objective-C only. Swift must use func getPilotingItf:.

    Declaration

    Swift

    @objc(getPilotingItf:)
    public func getPilotingItf(desc: ComponentDescriptor) -> PilotingItf?

    Parameters

    desc

    requested piloting interface. See PilotingItfs api for available descriptors instances.

    Return Value

    requested piloting interface

  • Gets a piloting interface and registers an observer notified each time it changes.

    Note

    this method is for Objective-C only. Swift must use func getPilotingItf:desc:observer.

    Declaration

    Swift

    @objc(getPilotingItf:observer:)
    public func getPilotingItfRef(desc: ComponentDescriptor, observer: @escaping (PilotingItf?) -> Void)
        -> GSPilotingItfRef

    Parameters

    desc

    requested piloting interface. See PilotingItfs api for available descriptors instances.

    observer

    observer to notify when the piloting interface changes

    Return Value

    reference to the requested piloting interface