diff --git a/Sources/LibDCSwift/DiveLogRetriever.swift b/Sources/LibDCSwift/DiveLogRetriever.swift index 868d0aa..5dafc39 100644 --- a/Sources/LibDCSwift/DiveLogRetriever.swift +++ b/Sources/LibDCSwift/DiveLogRetriever.swift @@ -150,7 +150,8 @@ public class DiveLogRetriever { model: modelToUse, diveNumber: context.logCount, diveData: data, - dataSize: Int(size) + dataSize: Int(size), + fingerprint: fingerprintData ) DispatchQueue.main.async { diff --git a/Sources/LibDCSwift/Models/DiveData.swift b/Sources/LibDCSwift/Models/DiveData.swift index 61bb313..0b5a580 100644 --- a/Sources/LibDCSwift/Models/DiveData.swift +++ b/Sources/LibDCSwift/Models/DiveData.swift @@ -265,7 +265,11 @@ public struct DiveData: Identifiable { // Decompression data public var decoStop: DecoStop? - + + // Raw fingerprint bytes identifying the specific dive on the computer, + // returned by dc_device_foreach's per-dive callback. + public var fingerprint: Data? + public struct Tank { public var volume: Double public var workingPressure: Double @@ -411,7 +415,8 @@ public struct DiveData: Identifiable { setpoint: Double?, ppo2Readings: [(sensor: UInt32, value: Double)], cns: Double?, - decoStop: DecoStop? + decoStop: DecoStop?, + fingerprint: Data? = nil ) { self.number = number self.datetime = datetime @@ -441,5 +446,6 @@ public struct DiveData: Identifiable { self.ppo2Readings = ppo2Readings self.cns = cns self.decoStop = decoStop + self.fingerprint = fingerprint } -} +} diff --git a/Sources/LibDCSwift/Parser/GenericParser.swift b/Sources/LibDCSwift/Parser/GenericParser.swift index 6f2c204..bc269c0 100644 --- a/Sources/LibDCSwift/Parser/GenericParser.swift +++ b/Sources/LibDCSwift/Parser/GenericParser.swift @@ -205,7 +205,8 @@ public class GenericParser { diveNumber: Int, diveData: UnsafePointer, dataSize: Int, - context: OpaquePointer? = nil + context: OpaquePointer? = nil, + fingerprint: Data? = nil ) throws -> DiveData { var parser: OpaquePointer? @@ -533,7 +534,8 @@ public class GenericParser { time: TimeInterval(deco.time), type: Int(deco.type.rawValue) ) - } + }, + fingerprint: fingerprint ) }