GroundSdk
@objcMembers
public class GroundSdk : NSObject
Ground SDK access class.
-
Creates a GroundSdk instance.
Declaration
Swift
public override init()
-
Gets a list of known drones and register an observer notified each time this list changes.
Declaration
Swift
public func getDroneList( observer: @escaping Ref<[DroneListEntry]>.Observer, filter: @escaping (DroneListEntry) -> Bool = { _ in return true }) -> Ref<[DroneListEntry]>
Parameters
observer
observer notified each time this list changes
filter
drone filter to select drones to include into the returned list. The filter criteria must not change during the list reference lifecycle. By default, the filter accepts all drones.
Return Value
a reference to the requested list
-
Gets a drone by uid.
Declaration
Swift
public func getDrone(uid: String) -> Drone?
Parameters
uid
uid of the desired drone
Return Value
a drone if found,
nil
otherwise -
Gets a drone by uid and register a callback called when the drone has disappeared.
Warning
removedCallback is called as long as the returned Drone instance is referenced. When the drone instance is deinit, the callback is unregistered and is never called.
Declaration
Swift
public func getDrone(uid: String, removedCallback: @escaping (String) -> Void) -> Drone?
Parameters
uid
uid of the desired drone
removedCallback
closure called when the drone is removed. Never called if the requested drone doesn’t exists (i.e. when this function returns
nil
).Return Value
a drone if found,
nil
otherwise -
Forgets a drone identified by it’s uid.
Persisted drone data are deleted and the drone is removed from the list of drones if it’s not visible.
Declaration
Swift
public func forgetDrone(uid: String) -> Bool
Parameters
uid
uid of the drone to forget
Return Value
true
if the drone has been forgotten,false
otherwise -
Connects a drone identified by it’s uid using a connector.
Declaration
Swift
public func connectDrone(uid: String, connector: DeviceConnector) -> Bool
Parameters
uid
uid of the drone to connect
connector
connector to use to connect the drone
Return Value
true
if the connection process has started,false
otherwise, for example if the drone is no more visible. -
Connects a drone identified by it’s uid using a connector, with a password.
Declaration
Swift
public func connectDrone(uid: String, connector: DeviceConnector, password: String) -> Bool
Parameters
uid
uid of the drone to connect
connector
connector to use to connect the drone
password
password to connect the drone.
Return Value
true
if the connection process has started,false
otherwise, for example if the drone is no more visible. -
Connects a drone identified by it’s uid using the local connector.
Declaration
Swift
public func connectDrone(uid: String) -> Bool
Parameters
uid
uid of the drone to connect
Return Value
true
if the connection process has started,false
otherwise, for example if the drone is no more visible. -
Disconnects a drone identified by it’s uid.
Declaration
Swift
public func disconnectDrone(uid: String) -> Bool
Parameters
uid
uid of the drone to disconnect
Return Value
true
if the disconnection process has started,false
otherwise. -
Gets a list of known remote control and register an observer notified each time this list changes.
Declaration
Swift
public func getRemoteControlList( observer: @escaping Ref<[RemoteControlListEntry]>.Observer, filter: @escaping (RemoteControlListEntry) -> Bool = { _ in return true }) -> Ref<[RemoteControlListEntry]>
Parameters
observer
observer notified each time this list changes
filter
remote control filter to select remote control to include into the returned list. The filter criteria must not change during the list reference lifecycle. By default, the filter accepts all remote controls.
Return Value
a reference to the requested list.
-
Gets a remote control by uid.
Declaration
Swift
public func getRemoteControl(uid: String) -> RemoteControl?
Parameters
uid
uid of the desired remote control
Return Value
a remote control if found,
nil
otherwise -
Gets a remote control by uid and register a callback called when the remote control has disappear.
Warning
removedCallback is called as long as the returned remote control instance is referenced. When the remote control instance is deinit, the callback is unregistered and is never called.
Declaration
Swift
public func getRemoteControl(uid: String, removedCallback: @escaping (String) -> Void) -> RemoteControl?
Parameters
uid
uid of the desired remote control
removedCallback
closure called when the remote control is removed. Never called if the requested remote control doesn’t exists (i.e. when this function returns
nil
).Return Value
a remote control if found,
nil
otherwise -
Forgets a remote control identified by it’s uid.
Persisted remote control data are deleted and the remote control is removed from the list of remote control if it’s not visible.
Declaration
Swift
public func forgetRemoteControl(uid: String) -> Bool
Parameters
uid
uid of the remote control to forget
Return Value
true
if the remote control has been forgotten,false
otherwise. -
Connects a remote control identified by it’s uid.
Declaration
Swift
public func connectRemoteControl(uid: String) -> Bool
Parameters
uid
uid of the remote control to connect.
Return Value
true
if the connection process has started,false
otherwise, for example if the remote control is no more visible. -
Disconnects a remote control identified by it’s uid.
Declaration
Swift
public func disconnectRemoteControl(uid: String) -> Bool
Parameters
uid
uid of the remote control to disconnect.
Return Value
true
if the disconnection process has started,false
otherwise. -
Gets a facility.
Declaration
Swift
public func getFacility<Desc>(_ desc: Desc) -> Desc.ApiProtocol? where Desc : FacilityClassDesc
Parameters
desc
requested facility. See
Facilities
API for available descriptors instancesReturn Value
the requested facility or
nil
if the facility is not yet available. -
Gets a facility and registers an observer notified each time it changes.
If the facility is present, the observer will be called immediately with. If the facility is not present, the observer won’t be called until the facility is added. If the facility is removed, the observer will be notified and referenced value is set to
nil
.Declaration
Swift
public func getFacility<Desc: FacilityClassDesc>( _ desc: Desc, observer: @escaping Ref<Desc.ApiProtocol>.Observer) -> Ref<Desc.ApiProtocol>
Parameters
desc
requested facility. See
Facilities
API for available descriptors instances.observer
observer to notify when the facility changes
Return Value
reference to the requested facility
-
Sets completion handler given by the AppDelegate
application(:handleEventsForBackgroundURLSession:completionHandler:)
function.This will ensure background URLSession task completion handlers are called.
Declaration
Swift
public static func setBackgroundUrlSessionCompletionHandler( _ completionHandler: @escaping () -> Void, forSessionIdentifier identifier: String)
Parameters
completionHandler
the completion handler
identifier
the session identifier
-
Creates a new replay stream for a local file.
Every successful call to this method creates a new replay stream instance for the given file, that must be disposed by dereferencing the returned reference once that stream is not needed. Dereferencing the returned reference automatically stops the referenced media replay stream.
Declaration
Swift
public func replay(source: FileReplaySource, observer: @escaping (_ stream: FileReplay?) -> Void) -> Ref<FileReplay>?
Parameters
source
source to stream
observer
notified when the stream state changes
Return Value
a reference to the replay stream interface, or
nil
in case the provided file cannot be streamed -
Collects latest logs from the given sources and bundles them in an archive in the given destination directory.
Declaration
Swift
public func collectLogs(from sources: Set<LogCollectorSource>, toDirectory directory: URL, observer: @escaping (LogCollector?) -> Void) -> Ref<LogCollector>
Parameters
sources
sources of the logs to collect
directory
destination directory
observer
observer called when the LogCollector changes, indicating collection progress
Return Value
a reference on a LogCollector. Caller must keep this instance referenced until all logs are collected. Setting it to
nil
cancels the collection. -
Get a list of known drones and register an observer notified each time this list changes.
Note
this method is for Objective-C only. Swift must use
getDroneList(observer)
Declaration
Swift
@objc(getDroneList:) func getDroneListRef(_ observer: @escaping ([DroneListEntry]?) -> Void) -> GSDroneListRef
Parameters
observer
observer notified each time this list changes
Return Value
a reference to the requested list
-
Gets a list of known drones and register an observer notified each time this list changes.
Note
this method is for Objective-C only. Swift must use
getDroneList(observer, filter)
Declaration
Swift
@objc(getDroneList:filter:) func getDroneListRef(_ observer: @escaping ([DroneListEntry]?) -> Void, filter: @escaping (DroneListEntry) -> Bool) -> GSDroneListRef
Parameters
observer
observer notified each time this list changes
filter
drone filter to select drones to include into the returned list. The filter criteria must not change during the list reference lifecycle.
Return Value
a reference to the requested list
-
Gets a list of known remote controls and register an observer notified each time this list changes.
Note
this method is for Objective-C only. Swift must use
getRemoteControlList(observer)
Declaration
Swift
@objc(getRemoteControlList:) func getRemoteControlListRef(observer: @escaping ([RemoteControlListEntry]?) -> Void) -> GSRemoteControlListRef
Parameters
observer
observer notified each time this list changes
Return Value
a reference to the requested list
-
Gets a list of known remote controls and register an observer notified each time this list changes.
Note
this method is for Objective-C only. Swift must use
getRemoteControlList(observer, filter)
Declaration
Swift
@objc(getRemoteControlList:filter:) func getRemoteControlListRef(observer: @escaping ([RemoteControlListEntry]?) -> Void, filter: @escaping (RemoteControlListEntry) -> Bool) -> GSRemoteControlListRef
Parameters
observer
observer notified each time this list changes
filter
remote control filter to select remote controls to include into the returned list. The filter criteria must not change during the list reference lifecycle.
Return Value
a reference to the requested list
-
Gets a facility.
Note
this method is for Objective-C only. Swift must usefunc getFacility(:)
Declaration
Swift
@objc(getFacility:) func getFacility(desc: ComponentDescriptor) -> Facility?
Parameters
desc
requested facility. See
Facilities
api for available descriptors instancesReturn Value
requested facility
-
Gets a facility and register an observer notified each time it changes.
If the facility is present, the observer will be called immediately with. If the facility is not present, the observer won’t be called until the facility is added. If the facility is removed, the observer will be notified and referenced value is set to
nil
.Note
this method is for Objective-C only. Swift must usefunc getFacility(:observer:)
Declaration
Swift
@objc(getFacility:observer:) func getFacilityRef(desc: ComponentDescriptor, observer: @escaping (Facility?) -> Void) -> GSFacilityRef
Parameters
desc
requested facility. See
Facilities
api for available descriptors instancesobserver
observer to notify when the facility changes
Return Value
reference to the requested instrument
-
Creates a new replay stream for a local file.
Every successful call to this method creates a new replay stream instance for the given file, that must be disposed by dereferencing the returned reference once that stream is not needed. Dereferencing the returned reference automatically stops the referenced media replay stream.
Declaration
Swift
@objc(replay:observer:) func replayRef(source: FileReplaySource, observer: @escaping (_ stream: FileReplay?) -> Void) -> GSFileReplayRef?
Parameters
source
source to stream
observer
notified when the stream state changes
Return Value
a reference to the replay stream interface, or
nil
in case the provided file cannot be streamed