From c54b3f4a506425a17549a4c12d0201c49adcb1e2 Mon Sep 17 00:00:00 2001 From: Andreas Bauer Date: Thu, 13 Jun 2024 20:52:25 +0200 Subject: [PATCH] Upgrade to SpeziNetworking 2.0 --- Package.swift | 4 ++-- .../OmronRecordAccessOperand.swift | 21 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Package.swift b/Package.swift index 6dceda9..0af8924 100644 --- a/Package.swift +++ b/Package.swift @@ -25,8 +25,8 @@ let package = Package( .library(name: "SpeziOmron", targets: ["SpeziOmron"]) ], dependencies: [ - .package(url: "https://github.com/StanfordSpezi/SpeziBluetooth", branch: "main"), - .package(url: "https://github.com/StanfordSpezi/SpeziNetworking", from: "1.0.0") + .package(url: "https://github.com/StanfordSpezi/SpeziBluetooth", branch: "feature/accessory-discovery"), + .package(url: "https://github.com/StanfordSpezi/SpeziNetworking", from: "2.0.0") ], targets: [ .target( diff --git a/Sources/SpeziOmron/Characteristic/OmronRecordAccessOperand.swift b/Sources/SpeziOmron/Characteristic/OmronRecordAccessOperand.swift index b9db20f..2336125 100644 --- a/Sources/SpeziOmron/Characteristic/OmronRecordAccessOperand.swift +++ b/Sources/SpeziOmron/Characteristic/OmronRecordAccessOperand.swift @@ -44,25 +44,24 @@ extension OmronRecordAccessOperand: RecordAccessOperand { public init?( // swiftlint:disable:this cyclomatic_complexity from byteBuffer: inout ByteBuffer, - preferredEndianness endianness: Endianness, opCode: RecordAccessOpCode, operator: RecordAccessOperator ) { switch opCode { case .responseCode: - guard let response = RecordAccessGeneralResponse(from: &byteBuffer, preferredEndianness: endianness) else { + guard let response = RecordAccessGeneralResponse(from: &byteBuffer) else { return nil } self = .generalResponse(response) case .reportStoredRecords, .deleteStoredRecords, .reportNumberOfStoredRecords: switch `operator` { case .lessThanOrEqualTo, .greaterThanOrEqual: - guard let filterCriteria = RecordAccessFilterCriteria(from: &byteBuffer, preferredEndianness: endianness) else { + guard let filterCriteria = RecordAccessFilterCriteria(from: &byteBuffer) else { return nil } self = .filterCriteria(filterCriteria) case .withinInclusiveRangeOf: - guard let filterCriteria = RecordAccessRangeFilterCriteria(from: &byteBuffer, preferredEndianness: endianness) else { + guard let filterCriteria = RecordAccessRangeFilterCriteria(from: &byteBuffer) else { return nil } self = .rangeFilterCriteria(filterCriteria) @@ -70,12 +69,12 @@ extension OmronRecordAccessOperand: RecordAccessOperand { return nil } case .numberOfStoredRecordsResponse: - guard let count = UInt16(from: &byteBuffer, preferredEndianness: endianness) else { + guard let count = UInt16(from: &byteBuffer) else { return nil } self = .numberOfRecords(count) case .omronSequenceNumberOfLatestRecordsResponse: - guard let sequenceNumber = UInt16(from: &byteBuffer, preferredEndianness: endianness) else { + guard let sequenceNumber = UInt16(from: &byteBuffer) else { return nil } self = .sequenceNumber(sequenceNumber) @@ -84,16 +83,16 @@ extension OmronRecordAccessOperand: RecordAccessOperand { } } - public func encode(to byteBuffer: inout ByteBuffer, preferredEndianness endianness: Endianness) { + public func encode(to byteBuffer: inout ByteBuffer) { switch self { case let .generalResponse(response): - response.encode(to: &byteBuffer, preferredEndianness: endianness) + response.encode(to: &byteBuffer) case let .filterCriteria(criteria): - criteria.encode(to: &byteBuffer, preferredEndianness: endianness) + criteria.encode(to: &byteBuffer) case let .rangeFilterCriteria(criteria): - criteria.encode(to: &byteBuffer, preferredEndianness: endianness) + criteria.encode(to: &byteBuffer) case let .numberOfRecords(value), let .sequenceNumber(value): - value.encode(to: &byteBuffer, preferredEndianness: endianness) + value.encode(to: &byteBuffer) } } }