Skip to content

Commit

Permalink
GroundSdk release 7.5.0-rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins.onyxia committed Dec 27, 2022
1 parent bc98abd commit 9beb688
Show file tree
Hide file tree
Showing 66 changed files with 5,910 additions and 1,781 deletions.
7 changes: 4 additions & 3 deletions GroundSdk.podspec
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@

Pod::Spec.new do |s|
s.name = "GroundSdk"
s.version = "7.4.0"
s.version = "7.5.0-rc1"
s.summary = "Parrot Drone SDK"
s.homepage = "https://developer.parrot.com"
s.license = "{ :type => 'BSD 3-Clause License', :file => 'LICENSE' }"
s.author = 'Parrot Drone SAS'
s.source = { :git => 'https://github.com/Parrot-Developers/pod_groundsdk.git', :tag => "7.4.0" }
s.source = { :git => 'https://github.com/Parrot-Developers/pod_groundsdk.git', :tag => "7.5.0-rc1" }
s.platform = :ios
s.ios.deployment_target = '12.0'
s.source_files = 'GroundSdk/**/*.{swift,h,m}'
s.resources = 'GroundSdk/**/*.{vsh,fsh,txt,png}'
s.dependency 'SdkCore', '7.4.0'
s.dependency 'SdkCore', '7.5.0-rc1'
s.dependency 'SwiftProtobuf', '1.13.0'
s.public_header_files = ["GroundSdk/GroundSdk.h"]
s.swift_version = '5'
s.pod_target_xcconfig = {'SWIFT_VERSION' => '5'}
Expand Down
2 changes: 1 addition & 1 deletion GroundSdk/Device/DeviceModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public enum DeviceModel: CustomStringConvertible {

/// List of devices that can be connectable through usb.
private static var usbDevices: Set<DeviceModel> = [.rc(.skyCtrl3), .rc(.skyCtrl4), .rc(.skyCtrl4Black),
.rc(.skyCtrlUA)]
.rc(.skyCtrlUA), .rc(.skyCtrl5)]

/// List of devices that can be connectable through wifi.
private static var wifiDevices: Set<DeviceModel> = [.drone(.anafi4k), .drone(.anafiThermal), .drone(.anafi2),
Expand Down
6 changes: 5 additions & 1 deletion GroundSdk/Device/Instrument/Alarms.swift
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ public class Alarm: NSObject {
/// Battery is too cold, so forced landing auto trigger is planned.
case automaticLandingBatteryTooCold

/// DRI is not functional.
case driFailing

/// Debug description.
public var description: String {
switch self {
Expand Down Expand Up @@ -250,6 +253,7 @@ public class Alarm: NSObject {
case .automaticLandingPropellerIcingIssue: return "automaticLandingPropellerIcingIssue"
case .automaticLandingBatteryTooHot: return "automaticLandingBatteryTooHot"
case .automaticLandingBatteryTooCold: return "automaticLandingBatteryTooCold"
case .driFailing: return "driFailing"
}
}

Expand All @@ -269,7 +273,7 @@ public class Alarm: NSObject {
.obstacleAvoidanceBlindMotionDirection, .inclinationTooHigh, .horizontalGeofenceReached,
.verticalGeofenceReached, .obstacleAvoidanceFreeze, .freeFallDetected,
.stereoCameraDecalibrated, .automaticLandingPropellerIcingIssue, .automaticLandingBatteryTooHot,
.automaticLandingBatteryTooCold]
.automaticLandingBatteryTooCold, .driFailing]
}

/// Alarm level.
Expand Down
8 changes: 2 additions & 6 deletions GroundSdk/Device/Instrument/BatteryInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,9 @@ public extension BatteryDescription {
/// - cellMinVoltage: cell minimum voltage in mV
/// - cellMaxVoltage: cell maximum voltage in mV
/// - designCapacity: design capacity in mAh
init(date: String, serial: String, cellCount: UInt, cellMinVoltage: UInt, cellMaxVoltage: UInt,
init(date: Date?, serial: String, cellCount: UInt, cellMinVoltage: UInt, cellMaxVoltage: UInt,
designCapacity: UInt) {
var datetime: tm = tm()
let configurationDate = strptime_l(date.cString(using: .utf8), "%d/%m/%Y", &datetime, nil).map { _ -> Date in
Date(timeIntervalSince1970: TimeInterval(mktime(&datetime)))
}
self = BatteryDescription(configurationDate: configurationDate,
self = BatteryDescription(configurationDate: date,
serial: serial,
cellCount: cellCount,
cellMinVoltage: cellMinVoltage,
Expand Down
11 changes: 8 additions & 3 deletions GroundSdk/Device/Instrument/TakeoffChecklist.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ public class TakeoffAlarm: NSObject {
/// Cellular modem firmware updating check
case cellularModemFirmwareUpdate

/// Drone Remote Identification check.
case dri

/// Drone inclination check
case droneInclination

Expand Down Expand Up @@ -100,6 +103,7 @@ public class TakeoffAlarm: NSObject {
case .batteryTooHot: return "batteryTooHot"
case .batteryUsbPortConnection: return "batteryUsbPortConnection"
case .cellularModemFirmwareUpdate: return "cellularModemFirmwareUpdate"
case .dri: return "dri"
case .droneInclination: return "droneInclination"
case .gps: return "gps"
case .gyro: return "gyro"
Expand All @@ -114,9 +118,10 @@ public class TakeoffAlarm: NSObject {

/// Set containing all possible kinds of alarm.
public static let allCases: Set<Kind> = [
.baro, .batteryGaugeUpdateRequired, .batteryIdentification, .batteryLevel, .batteryPoorConnection,
.batteryTooCold, .batteryTooHot, .batteryUsbPortConnection, .cellularModemFirmwareUpdate, .droneInclination,
.gps, .gyro, .magneto, .magnetoCalibration, .ultrasound, .updateOngoing, .vcam, .verticalTof]
.baro, .batteryGaugeUpdateRequired, .batteryIdentification, .batteryLevel,
.batteryPoorConnection, .batteryTooCold, .batteryTooHot, .batteryUsbPortConnection,
.cellularModemFirmwareUpdate, .dri, .droneInclination, .gps, .gyro, .magneto,
.magnetoCalibration, .ultrasound, .updateOngoing, .vcam, .verticalTof]
}

/// Alarm level.
Expand Down
21 changes: 14 additions & 7 deletions GroundSdk/Device/Peripheral/Camera2/Camera2PhotoCapture.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,15 @@ public enum Camera2PhotoCaptureState: Equatable, CustomStringConvertible {
case starting

/// Photo capture is started.
/// - startTime: photo capture start time
/// - startTime: time when the capture did start, in the remote drone clock reference;
/// DEPRECATED, use`startTimeOnSystemClock` or `duration()` instead
/// - startTimeOnSystemClock: time when the capture did start, in seconds in the local device's default clock
/// reference; may be negative if the capture started before local device boot
/// - duration: closure allowing to retrieve capture duration so far
/// - photoCount: number of photo taken in the session
/// - mediaStorage: destination storage for produced media, `nil` if unknown
case started(startTime: Date, photoCount: Int, mediaStorage: StorageType?)
case started(startTime: Date, startTimeOnSystemClock: Double, duration: () -> TimeInterval, photoCount: Int,
mediaStorage: StorageType?)

/// Photo capture is stopping.
/// - reason: reason why the photo capture is stopping
Expand Down Expand Up @@ -80,9 +85,10 @@ public enum Camera2PhotoCaptureState: Equatable, CustomStringConvertible {
case (.starting, .starting):
return true

case (let started(startTimeL, photoCountL, mediaStorageL),
let started(startTimeR, photoCountR, mediaStorageR)):
return startTimeL == startTimeR && photoCountL == photoCountR && mediaStorageL == mediaStorageR
case (let started(startTimeL, startTimeOnSystemClockL, _, photoCountL, mediaStorageL),
let started(startTimeR, startTimeOnSystemClockR, _, photoCountR, mediaStorageR)):
return startTimeL == startTimeR && startTimeOnSystemClockL == startTimeOnSystemClockR
&& photoCountL == photoCountR && mediaStorageL == mediaStorageR

case (let stopping(reasonL, savedMediaIdL), let stopping(reasonR, savedMediaIdR)):
return reasonL == reasonR && savedMediaIdL == savedMediaIdR
Expand All @@ -98,8 +104,9 @@ public enum Camera2PhotoCaptureState: Equatable, CustomStringConvertible {
case let .stopped(latestSavedMediaId):
return "stopped \(latestSavedMediaId ?? "")"
case .starting: return "starting"
case let .started(startTime, photoCount, mediaStorage):
return "started \(startTime), \(photoCount), \(String(describing: mediaStorage))"
case let .started(startTime, startTimeOnSystemClock, duration, photoCount, mediaStorage):
return "started \(startTime), \(startTimeOnSystemClock), \(duration()), \(photoCount), "
+ String(describing: mediaStorage)
case let .stopping(reason, savedMediaId):
return "stopping \(reason), \(savedMediaId ?? "none")"
}
Expand Down
21 changes: 14 additions & 7 deletions GroundSdk/Device/Peripheral/Camera2/Camera2Recording.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,15 @@ public enum Camera2RecordingState: Equatable, CustomStringConvertible {
case starting

/// Recording is started.
/// - startTime: recording start time
/// - startTime: time when the capture did start, in the remote drone clock reference;
/// DEPRECATED, use`startTimeOnSystemClock` or `duration()` instead
/// - startTimeOnSystemClock: time when the capture did start, in seconds in the local device's default clock
/// reference; may be negative if the capture started before local device boot
/// - duration: closure allowing to retrieve capture duration so far
/// - videoBitrate: video recording bitrate, in bits per second
/// - mediaStorage: destination storage for produced media, `nil` if unknown
case started(startTime: Date, videoBitrate: UInt, mediaStorage: StorageType?)
case started(startTime: Date, startTimeOnSystemClock: Double, duration: () -> TimeInterval,
videoBitrate: UInt, mediaStorage: StorageType?)

/// Recording is stopping.
/// - reason: reason why the recording is stopping
Expand Down Expand Up @@ -80,9 +85,10 @@ public enum Camera2RecordingState: Equatable, CustomStringConvertible {
case (.starting, .starting):
return true

case (let started(startTimeL, videoBitrateL, mediaStorageL),
let started(startTimeR, videoBitrateR, mediaStorageR)):
return startTimeL == startTimeR && mediaStorageL == mediaStorageR && videoBitrateL == videoBitrateR
case (let started(startTimeL, startTimeOnSystemClockL, _, videoBitrateL, mediaStorageL),
let started(startTimeR, startTimeOnSystemClockR, _, videoBitrateR, mediaStorageR)):
return startTimeL == startTimeR && startTimeOnSystemClockL == startTimeOnSystemClockR
&& mediaStorageL == mediaStorageR && videoBitrateL == videoBitrateR

case (let stopping(reasonL, savedMediaIdL), let stopping(reasonR, savedMediaIdR)):
return reasonL == reasonR && savedMediaIdL == savedMediaIdR
Expand All @@ -99,8 +105,9 @@ public enum Camera2RecordingState: Equatable, CustomStringConvertible {
return "stopped \(latestSavedMediaId ?? "none")"
case .starting:
return "starting"
case let .started(startTime, videoBitrate, mediaStorage):
return "started \(startTime) \(videoBitrate) \(String(describing: mediaStorage))"
case let .started(startTime, startTimeOnSystemClock, duration, videoBitrate, mediaStorage):
return "started \(startTime) \(startTimeOnSystemClock), \(duration()), \(videoBitrate) "
+ String(describing: mediaStorage)
case let .stopping(reason, savedMediaId):
return "stopping \(reason), \(savedMediaId ?? "none")"
}
Expand Down
68 changes: 65 additions & 3 deletions GroundSdk/Device/Peripheral/CertificateUploader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,52 @@

import Foundation

/// Certificate upload state.
public enum CertificateUploadState: CustomStringConvertible {

/// The certificate upload is in progress.
case uploading

/// The certificate upload was successful.
case success

/// The certificate upload has failed.
case failed

/// The certificate upload has been canceled.
case canceled

/// Debug description.
public var description: String {
switch self {
case .uploading: return "uploading"
case .success: return "success"
case .failed: return "failed"
case .canceled: return "canceled"
}
}
}

/// Information about the certificate.
public struct CertificateInfo {

/// The list of debug features.
public let debugFeatures: [String]

/// The list of premium features.
public let premiumFeatures: [String]

/// Constructor.
///
/// - Parameters:
/// - debugFeatures: list of debug features
/// - premiumFeatures: list of premium features
public init(debugFeatures: [String], premiumFeatures: [String]) {
self.debugFeatures = debugFeatures
self.premiumFeatures = premiumFeatures
}
}

/// Certificate Uploader peripheral interface.
///
/// This peripheral allows to upload certificates to connected devices, in order to unlock new features on the drone.
Expand All @@ -38,13 +84,29 @@ import Foundation
/// device.getPeripheral(Peripherals.certificateUploader)
/// ```
public protocol CertificateUploader: Peripheral {
/// Latest upload state.
var state: CertificateUploadState? { get }

/// Uploads a certificate file to the drone.
///
/// When the upload ends, the drone will restart
/// For a successful upload, the drone has to remain in a landed state for the whole upload duration.
///
/// - Parameter certificate: local path of the file to upload
func upload(certificate filepath: String) -> CancelableCore?

/// Fetches the signature of the current license certificate installed on the device.
///
/// - Parameters:
/// - completion: the completion callback
/// - signature: the retrieved signature
func fetchSignature(completion: @escaping (_ signature: String?) -> Void)

/// Fetches the information of the current license certificate installed on the drone.
///
/// - Parameter filepath: local path of the file to upload
func upload(certificate filepath: String)
/// - Parameters:
/// - completion: the completion callback
/// - info: the retrieved information
func fetchInfo(completion: @escaping (_ info: CertificateInfo?) -> Void)
}

/// :nodoc:
Expand Down
10 changes: 10 additions & 0 deletions GroundSdk/Device/Peripheral/Dri.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public enum DriType: String, CustomStringConvertible, CaseIterable {
/// DRI wifi beacon respects the french regulation.
case french

/// DRI wifi beacon respects the ASTN F341122 US regulation.
case astmF3411

/// Debug description.
public var description: String { rawValue }
}
Expand All @@ -64,13 +67,18 @@ public enum DriTypeConfig: Hashable, CustomStringConvertible {
/// - operatorId: operator identifier
case en4709_002(operatorId: String = "")

/// DRI wifi beacon respects the ASTN F341122 US regulation.
/// - operatorId: operator identifier
case astmF3411(operatorId: String = "")

/// DRI wifi beacon respects the french regulation.
case french

/// DRI type associated to this configuration.
public var type: DriType {
switch self {
case .en4709_002: return .en4709_002
case .astmF3411: return .astmF3411
case .french: return .french
}
}
Expand All @@ -82,6 +90,7 @@ public enum DriTypeConfig: Hashable, CustomStringConvertible {
public var isValid: Bool {
switch self {
case .en4709_002(let operatorId): return validateEn4709UasOperator(operatorId)
case .astmF3411(let operatorId): return validateAstmf3411UasOperator(operatorId)
case .french: return true
}
}
Expand All @@ -91,6 +100,7 @@ public enum DriTypeConfig: Hashable, CustomStringConvertible {
switch self {
case .french: return "french"
case .en4709_002(let operatorId): return "en4709_002 \(operatorId)"
case .astmF3411(let operatorId): return "astmF3411 \(operatorId)"
}
}
}
Expand Down
Loading

0 comments on commit 9beb688

Please sign in to comment.