diff --git a/MinimedKit/GlucoseEvents/BatteryChangeGlucoseEvent.swift b/MinimedKit/GlucoseEvents/BatteryChangeGlucoseEvent.swift index 298cc9d67..22af2c62f 100644 --- a/MinimedKit/GlucoseEvents/BatteryChangeGlucoseEvent.swift +++ b/MinimedKit/GlucoseEvents/BatteryChangeGlucoseEvent.swift @@ -13,7 +13,7 @@ public struct BatteryChangeGlucoseEvent : GlucoseEvent { public let rawData: Data public let timestamp: DateComponents - public init?(availableData: Data, pumpModel: PumpModel) { + public init?(availableData: Data) { length = 5 guard length <= availableData.count else { diff --git a/MinimedKit/GlucoseEvents/CalBGForGHGlucoseEvent.swift b/MinimedKit/GlucoseEvents/CalBGForGHGlucoseEvent.swift index 5b4d5c799..4383f1162 100644 --- a/MinimedKit/GlucoseEvents/CalBGForGHGlucoseEvent.swift +++ b/MinimedKit/GlucoseEvents/CalBGForGHGlucoseEvent.swift @@ -14,7 +14,7 @@ public struct CalBGForGHGlucoseEvent : GlucoseEvent { public let timestamp: DateComponents public let amount: Int - public init?(availableData: Data, pumpModel: PumpModel) { + public init?(availableData: Data) { length = 6 guard length <= availableData.count else { diff --git a/MinimedKit/GlucoseEvents/DataEndGlucoseEvent.swift b/MinimedKit/GlucoseEvents/DataEndGlucoseEvent.swift index 30ba19b10..a01214fec 100644 --- a/MinimedKit/GlucoseEvents/DataEndGlucoseEvent.swift +++ b/MinimedKit/GlucoseEvents/DataEndGlucoseEvent.swift @@ -13,7 +13,7 @@ public struct DataEndGlucoseEvent : RelativeTimestampedGlucoseEvent { public let rawData: Data public var timestamp: DateComponents - public init?(availableData: Data, pumpModel: PumpModel) { + public init?(availableData: Data) { length = 1 guard length <= availableData.count else { diff --git a/MinimedKit/GlucoseEvents/DateTimeChangeGlucoseEvent.swift b/MinimedKit/GlucoseEvents/DateTimeChangeGlucoseEvent.swift index b57b61f1d..76747caa2 100644 --- a/MinimedKit/GlucoseEvents/DateTimeChangeGlucoseEvent.swift +++ b/MinimedKit/GlucoseEvents/DateTimeChangeGlucoseEvent.swift @@ -13,7 +13,7 @@ public struct DateTimeChangeGlucoseEvent : GlucoseEvent { public let rawData: Data public let timestamp: DateComponents - public init?(availableData: Data, pumpModel: PumpModel) { + public init?(availableData: Data) { length = 5 guard length <= availableData.count else { diff --git a/MinimedKit/GlucoseEvents/Fokko7GlucoseEvent.swift b/MinimedKit/GlucoseEvents/Fokko7GlucoseEvent.swift index 9d719c6d4..a0a2ddc63 100644 --- a/MinimedKit/GlucoseEvents/Fokko7GlucoseEvent.swift +++ b/MinimedKit/GlucoseEvents/Fokko7GlucoseEvent.swift @@ -13,7 +13,7 @@ public struct Fokko7GlucoseEvent : GlucoseEvent { public let rawData: Data public var timestamp: DateComponents - public init?(availableData: Data, pumpModel: PumpModel) { + public init?(availableData: Data) { length = 2 guard length <= availableData.count else { diff --git a/MinimedKit/GlucoseEvents/GlucoseEvent.swift b/MinimedKit/GlucoseEvents/GlucoseEvent.swift index 40f01895e..9085402e3 100644 --- a/MinimedKit/GlucoseEvents/GlucoseEvent.swift +++ b/MinimedKit/GlucoseEvents/GlucoseEvent.swift @@ -10,7 +10,7 @@ import Foundation public protocol GlucoseEvent : DictionaryRepresentable { - init?(availableData: Data, pumpModel: PumpModel) + init?(availableData: Data) var rawData: Data { get diff --git a/MinimedKit/GlucoseEvents/GlucoseSensorDataGlucoseEvent.swift b/MinimedKit/GlucoseEvents/GlucoseSensorDataGlucoseEvent.swift index 7b6c174e7..664f1ca86 100644 --- a/MinimedKit/GlucoseEvents/GlucoseSensorDataGlucoseEvent.swift +++ b/MinimedKit/GlucoseEvents/GlucoseSensorDataGlucoseEvent.swift @@ -14,7 +14,7 @@ public struct GlucoseSensorDataGlucoseEvent : RelativeTimestampedGlucoseEvent { public let sgv: Int public var timestamp: DateComponents - public init?(availableData: Data, pumpModel: PumpModel) { + public init?(availableData: Data) { length = 1 guard length <= availableData.count else { diff --git a/MinimedKit/GlucoseEvents/NineteenSomethingGlucoseEvent.swift b/MinimedKit/GlucoseEvents/NineteenSomethingGlucoseEvent.swift index b10726641..bcab008d8 100644 --- a/MinimedKit/GlucoseEvents/NineteenSomethingGlucoseEvent.swift +++ b/MinimedKit/GlucoseEvents/NineteenSomethingGlucoseEvent.swift @@ -13,7 +13,7 @@ public struct NineteenSomethingGlucoseEvent : RelativeTimestampedGlucoseEvent { public let rawData: Data public var timestamp: DateComponents - public init?(availableData: Data, pumpModel: PumpModel) { + public init?(availableData: Data) { length = 1 guard length <= availableData.count else { diff --git a/MinimedKit/GlucoseEvents/SensorCalFactorGlucoseEvent.swift b/MinimedKit/GlucoseEvents/SensorCalFactorGlucoseEvent.swift index c0a893ad3..c9418335f 100644 --- a/MinimedKit/GlucoseEvents/SensorCalFactorGlucoseEvent.swift +++ b/MinimedKit/GlucoseEvents/SensorCalFactorGlucoseEvent.swift @@ -14,7 +14,7 @@ public struct SensorCalFactorGlucoseEvent : ReferenceTimestampedGlucoseEvent { public let timestamp: DateComponents public let factor: Float - public init?(availableData: Data, pumpModel: PumpModel) { + public init?(availableData: Data) { length = 7 guard length <= availableData.count else { diff --git a/MinimedKit/GlucoseEvents/SensorCalGlucoseEvent.swift b/MinimedKit/GlucoseEvents/SensorCalGlucoseEvent.swift index 9ee96814c..2c46ecfa4 100644 --- a/MinimedKit/GlucoseEvents/SensorCalGlucoseEvent.swift +++ b/MinimedKit/GlucoseEvents/SensorCalGlucoseEvent.swift @@ -14,7 +14,7 @@ public struct SensorCalGlucoseEvent : RelativeTimestampedGlucoseEvent { public let waiting: String public var timestamp: DateComponents - public init?(availableData: Data, pumpModel: PumpModel) { + public init?(availableData: Data) { length = 2 guard length <= availableData.count else { diff --git a/MinimedKit/GlucoseEvents/SensorStatusGlucoseEvent.swift b/MinimedKit/GlucoseEvents/SensorStatusGlucoseEvent.swift index ee5827ab3..ae0b86d5f 100644 --- a/MinimedKit/GlucoseEvents/SensorStatusGlucoseEvent.swift +++ b/MinimedKit/GlucoseEvents/SensorStatusGlucoseEvent.swift @@ -13,7 +13,7 @@ public struct SensorStatusGlucoseEvent : GlucoseEvent { public let rawData: Data public let timestamp: DateComponents - public init?(availableData: Data, pumpModel: PumpModel) { + public init?(availableData: Data) { length = 5 guard length <= availableData.count else { diff --git a/MinimedKit/GlucoseEvents/SensorSyncGlucoseEvent.swift b/MinimedKit/GlucoseEvents/SensorSyncGlucoseEvent.swift index 7a29eba62..84521bc7a 100644 --- a/MinimedKit/GlucoseEvents/SensorSyncGlucoseEvent.swift +++ b/MinimedKit/GlucoseEvents/SensorSyncGlucoseEvent.swift @@ -13,7 +13,7 @@ public struct SensorSyncGlucoseEvent : GlucoseEvent { public let rawData: Data public let timestamp: DateComponents - public init?(availableData: Data, pumpModel: PumpModel) { + public init?(availableData: Data) { length = 5 guard length <= availableData.count else { diff --git a/MinimedKit/GlucoseEvents/SensorTimestampGlucoseEvent.swift b/MinimedKit/GlucoseEvents/SensorTimestampGlucoseEvent.swift index 3657be1f4..85719e8e9 100644 --- a/MinimedKit/GlucoseEvents/SensorTimestampGlucoseEvent.swift +++ b/MinimedKit/GlucoseEvents/SensorTimestampGlucoseEvent.swift @@ -13,7 +13,7 @@ public struct SensorTimestampGlucoseEvent : ReferenceTimestampedGlucoseEvent { public let rawData: Data public let timestamp: DateComponents - public init?(availableData: Data, pumpModel: PumpModel) { + public init?(availableData: Data) { length = 5 guard length <= availableData.count else { diff --git a/MinimedKit/GlucoseEvents/SensorWeakSignalGlucoseEvent.swift b/MinimedKit/GlucoseEvents/SensorWeakSignalGlucoseEvent.swift index 2c9690b03..b4d36e21c 100644 --- a/MinimedKit/GlucoseEvents/SensorWeakSignalGlucoseEvent.swift +++ b/MinimedKit/GlucoseEvents/SensorWeakSignalGlucoseEvent.swift @@ -13,7 +13,7 @@ public struct SensorWeakSignalGlucoseEvent : RelativeTimestampedGlucoseEvent { public let rawData: Data public var timestamp: DateComponents - public init?(availableData: Data, pumpModel: PumpModel) { + public init?(availableData: Data) { length = 1 guard length <= availableData.count else { diff --git a/MinimedKit/GlucoseEvents/TenSomethingGlucoseEvent.swift b/MinimedKit/GlucoseEvents/TenSomethingGlucoseEvent.swift index edca5a401..c492129d7 100644 --- a/MinimedKit/GlucoseEvents/TenSomethingGlucoseEvent.swift +++ b/MinimedKit/GlucoseEvents/TenSomethingGlucoseEvent.swift @@ -13,7 +13,7 @@ public struct TenSomethingGlucoseEvent : ReferenceTimestampedGlucoseEvent { public let rawData: Data public let timestamp: DateComponents - public init?(availableData: Data, pumpModel: PumpModel) { + public init?(availableData: Data) { length = 5 guard length <= availableData.count else { diff --git a/MinimedKit/GlucoseEvents/UnknownGlucoseEvent.swift b/MinimedKit/GlucoseEvents/UnknownGlucoseEvent.swift index 074af38ff..f7088db47 100644 --- a/MinimedKit/GlucoseEvents/UnknownGlucoseEvent.swift +++ b/MinimedKit/GlucoseEvents/UnknownGlucoseEvent.swift @@ -14,7 +14,7 @@ public struct UnknownGlucoseEvent : GlucoseEvent { public var timestamp: DateComponents public let op: String - public init?(availableData: Data, pumpModel: PumpModel) { + public init?(availableData: Data) { length = 1 guard length <= availableData.count else { diff --git a/MinimedKit/GlucosePage.swift b/MinimedKit/GlucosePage.swift index f6f806142..68132b014 100644 --- a/MinimedKit/GlucosePage.swift +++ b/MinimedKit/GlucosePage.swift @@ -17,7 +17,7 @@ public class GlucosePage { public let events: [GlucoseEvent] - public init(pageData: Data, pumpModel: PumpModel) throws { + public init(pageData: Data) throws { guard checkCRC16(pageData) else { events = [GlucoseEvent]() @@ -36,16 +36,16 @@ public class GlucosePage { let remainingData = pageData.subdata(in: offset..= 20 { - return GlucoseSensorDataGlucoseEvent(availableData: remainingData, pumpModel: pumpModel)! + return GlucoseSensorDataGlucoseEvent(availableData: remainingData)! } - return UnknownGlucoseEvent(availableData: remainingData, pumpModel: pumpModel)! + return UnknownGlucoseEvent(availableData: remainingData)! } func addTimestampsToEvents(startTimestamp: DateComponents, eventsNeedingTimestamp: [RelativeTimestampedGlucoseEvent]) -> [GlucoseEvent] { diff --git a/MinimedKitTests/GlucoseEvents/BatteryChangeGlucoseEventTests.swift b/MinimedKitTests/GlucoseEvents/BatteryChangeGlucoseEventTests.swift index 86116b0da..e7af514b8 100644 --- a/MinimedKitTests/GlucoseEvents/BatteryChangeGlucoseEventTests.swift +++ b/MinimedKitTests/GlucoseEvents/BatteryChangeGlucoseEventTests.swift @@ -21,9 +21,8 @@ class BatteryChangeGlucoseEventTests: XCTestCase { } func testDecoding() { - let pumpModel = PumpModel.Model551 let rawData = Data(hexadecimalString: "0a0bae0a0e")! - let subject = BatteryChangeGlucoseEvent(availableData: rawData, pumpModel: pumpModel)! + let subject = BatteryChangeGlucoseEvent(availableData: rawData)! let expectedTimestamp = DateComponents(calendar: Calendar.current, year: 2014, month: 2, day: 10, hour: 11, minute: 46) diff --git a/MinimedKitTests/GlucoseEvents/CalBGForGHGlucoseEventTests.swift b/MinimedKitTests/GlucoseEvents/CalBGForGHGlucoseEventTests.swift index 2adc1ccba..3301e3f75 100644 --- a/MinimedKitTests/GlucoseEvents/CalBGForGHGlucoseEventTests.swift +++ b/MinimedKitTests/GlucoseEvents/CalBGForGHGlucoseEventTests.swift @@ -22,9 +22,8 @@ class CalBGForGHGlucoseEventTests: XCTestCase { } func testDecoding() { - let pumpModel = PumpModel.Model551 let rawData = Data(hexadecimalString: "0e4f5b138fa0")! - let subject = CalBGForGHGlucoseEvent(availableData: rawData, pumpModel: pumpModel)! + let subject = CalBGForGHGlucoseEvent(availableData: rawData)! let expectedTimestamp = DateComponents(calendar: Calendar.current, year: 2015, month: 5, day: 19, hour: 15, minute: 27) diff --git a/MinimedKitTests/GlucoseEvents/DateTimeChangeGlucoseEventTests.swift b/MinimedKitTests/GlucoseEvents/DateTimeChangeGlucoseEventTests.swift index e5b12b38f..ae3b72ea3 100644 --- a/MinimedKitTests/GlucoseEvents/DateTimeChangeGlucoseEventTests.swift +++ b/MinimedKitTests/GlucoseEvents/DateTimeChangeGlucoseEventTests.swift @@ -22,9 +22,8 @@ class DateTimeChangeGlucoseEventTests: XCTestCase { } func testDecoding() { - let pumpModel = PumpModel.Model551 let rawData = Data(hexadecimalString: "0c0ad23e0e")! - let subject = DateTimeChangeGlucoseEvent(availableData: rawData, pumpModel: pumpModel)! + let subject = DateTimeChangeGlucoseEvent(availableData: rawData)! let expectedTimestamp = DateComponents(calendar: Calendar.current, year: 2014, month: 3, day: 30, hour: 10, minute: 18) diff --git a/MinimedKitTests/GlucoseEvents/GlucoseSensorDataGlucoseEventTests.swift b/MinimedKitTests/GlucoseEvents/GlucoseSensorDataGlucoseEventTests.swift index d5983da2a..89654aa08 100644 --- a/MinimedKitTests/GlucoseEvents/GlucoseSensorDataGlucoseEventTests.swift +++ b/MinimedKitTests/GlucoseEvents/GlucoseSensorDataGlucoseEventTests.swift @@ -22,9 +22,8 @@ class GlucoseSensorDataGlucoseEventTests: XCTestCase { } func testDecoding() { - let pumpModel = PumpModel.Model551 let rawData = Data(hexadecimalString: "35")! - let subject = GlucoseSensorDataGlucoseEvent(availableData: rawData, pumpModel: pumpModel)! + let subject = GlucoseSensorDataGlucoseEvent(availableData: rawData)! XCTAssertEqual(subject.sgv, 106) } diff --git a/MinimedKitTests/GlucoseEvents/SensorCalFactorGlucoseEventTests.swift b/MinimedKitTests/GlucoseEvents/SensorCalFactorGlucoseEventTests.swift index c4be3ff32..e5c45f70a 100644 --- a/MinimedKitTests/GlucoseEvents/SensorCalFactorGlucoseEventTests.swift +++ b/MinimedKitTests/GlucoseEvents/SensorCalFactorGlucoseEventTests.swift @@ -22,9 +22,8 @@ class SensorCalFactorGlucoseEventTests: XCTestCase { } func testDecoding() { - let pumpModel = PumpModel.Model551 let rawData = Data(hexadecimalString: "0f4f67130f128c")! - let subject = SensorCalFactorGlucoseEvent(availableData: rawData, pumpModel: pumpModel)! + let subject = SensorCalFactorGlucoseEvent(availableData: rawData)! let expectedTimestamp = DateComponents(calendar: Calendar.current, year: 2015, month: 5, day: 19, hour: 15, minute: 39) diff --git a/MinimedKitTests/GlucoseEvents/SensorCalGlucoseEventTests.swift b/MinimedKitTests/GlucoseEvents/SensorCalGlucoseEventTests.swift index c6aba4c1a..2b14f66d1 100644 --- a/MinimedKitTests/GlucoseEvents/SensorCalGlucoseEventTests.swift +++ b/MinimedKitTests/GlucoseEvents/SensorCalGlucoseEventTests.swift @@ -22,17 +22,15 @@ class SensorCalGlucoseEventTests: XCTestCase { } func testDecodingMeterBgNow() { - let pumpModel = PumpModel.Model551 let rawData = Data(hexadecimalString: "0300")! - let subject = SensorCalGlucoseEvent(availableData: rawData, pumpModel: pumpModel)! + let subject = SensorCalGlucoseEvent(availableData: rawData)! XCTAssertEqual(subject.waiting, "meter_bg_now") } func testDecodingWaiting() { - let pumpModel = PumpModel.Model551 let rawData = Data(hexadecimalString: "0301")! - let subject = SensorCalGlucoseEvent(availableData: rawData, pumpModel: pumpModel)! + let subject = SensorCalGlucoseEvent(availableData: rawData)! XCTAssertEqual(subject.waiting, "waiting") } diff --git a/MinimedKitTests/GlucoseEvents/SensorStatusGlucoseEventTests.swift b/MinimedKitTests/GlucoseEvents/SensorStatusGlucoseEventTests.swift index 985585a59..482863555 100644 --- a/MinimedKitTests/GlucoseEvents/SensorStatusGlucoseEventTests.swift +++ b/MinimedKitTests/GlucoseEvents/SensorStatusGlucoseEventTests.swift @@ -22,9 +22,8 @@ class SensorStatusGlucoseEventTests: XCTestCase { } func testDecoding() { - let pumpModel = PumpModel.Model551 let rawData = Data(hexadecimalString: "0b0baf0a0e")! - let subject = SensorStatusGlucoseEvent(availableData: rawData, pumpModel: pumpModel)! + let subject = SensorStatusGlucoseEvent(availableData: rawData)! let expectedTimestamp = DateComponents(calendar: Calendar.current, year: 2014, month: 2, day: 10, hour: 11, minute: 47) diff --git a/MinimedKitTests/GlucoseEvents/SensorSyncGlucoseEventTests.swift b/MinimedKitTests/GlucoseEvents/SensorSyncGlucoseEventTests.swift index c58443010..8d2a49f56 100644 --- a/MinimedKitTests/GlucoseEvents/SensorSyncGlucoseEventTests.swift +++ b/MinimedKitTests/GlucoseEvents/SensorSyncGlucoseEventTests.swift @@ -27,9 +27,8 @@ class SensorSyncGlucoseEventTests: XCTestCase { } func testPerformanceExample() { - let pumpModel = PumpModel.Model551 let rawData = Data(hexadecimalString: "0d4d44330f")! - let subject = SensorSyncGlucoseEvent(availableData: rawData, pumpModel: pumpModel)! + let subject = SensorSyncGlucoseEvent(availableData: rawData)! let expectedTimestamp = DateComponents(calendar: Calendar.current, year: 2015, month: 5, day: 19, hour: 13, minute: 04) diff --git a/MinimedKitTests/GlucoseEvents/SensorTimestampGlucoseEventTests.swift b/MinimedKitTests/GlucoseEvents/SensorTimestampGlucoseEventTests.swift index 2755f85c5..e899bfb04 100644 --- a/MinimedKitTests/GlucoseEvents/SensorTimestampGlucoseEventTests.swift +++ b/MinimedKitTests/GlucoseEvents/SensorTimestampGlucoseEventTests.swift @@ -22,9 +22,8 @@ class SensorTimestampGlucoseEventTests: XCTestCase { } func testDecoding() { - let pumpModel = PumpModel.Model551 let rawData = Data(hexadecimalString: "088d9b5d0c")! - let subject = SensorTimestampGlucoseEvent(availableData: rawData, pumpModel: pumpModel)! + let subject = SensorTimestampGlucoseEvent(availableData: rawData)! let expectedTimestamp = DateComponents(calendar: Calendar.current, year: 2012, month: 10, day: 29, hour: 13, minute: 27) diff --git a/MinimedKitTests/GlucoseEvents/TenSomethingGlucoseEventTests.swift b/MinimedKitTests/GlucoseEvents/TenSomethingGlucoseEventTests.swift index ae590ed91..6a98b2dec 100644 --- a/MinimedKitTests/GlucoseEvents/TenSomethingGlucoseEventTests.swift +++ b/MinimedKitTests/GlucoseEvents/TenSomethingGlucoseEventTests.swift @@ -22,9 +22,8 @@ class TenSomethingGlucoseEventTests: XCTestCase { } func testDecoding() { - let pumpModel = PumpModel.Model551 let rawData = Data(hexadecimalString: "100bb40a0e")! - let subject = TenSomethingGlucoseEvent(availableData: rawData, pumpModel: pumpModel)! + let subject = TenSomethingGlucoseEvent(availableData: rawData)! let expectedTimestamp = DateComponents(calendar: Calendar.current, year: 2014, month: 2, day: 10, hour: 11, minute: 52) diff --git a/MinimedKitTests/GlucosePageTests.swift b/MinimedKitTests/GlucosePageTests.swift index 7b4fa1ccf..2a7faaa0d 100644 --- a/MinimedKitTests/GlucosePageTests.swift +++ b/MinimedKitTests/GlucosePageTests.swift @@ -22,9 +22,8 @@ class GlucosePageTests: XCTestCase { } func testGlucosePageCRC() { - let pumpModel = PumpModel.Model551 do { - let _ = try GlucosePage(pageData: Data(hexadecimalString: "201E1D1C1A1817161718191B1D1B1C1F212527282A2E3235383C3FCD9086850E0E0000011006850E1043484857EB181006940E0F595E00000110069F0E106670757374767A7D7F8181817D7813726D6663605E5B554F4C4E4F4B484946423E3B38353234332D2B2B2B2C2E302F2F312F2D2D2E2D2C2D2D2A2B292700000110069F1310242323272B2C3235383C00000110069514103E3E3F404141444A4945413E3D3D3A35302C2823201D1B1C1D1A1A1B1C1E2123272B2F3231323235383B3F43484949474542779007A0000E41423D6C171007AD000F3C3D3D3B3C3E3F41474F545A626A6E700000011007860210717271727476797A7A7B7C7D7C7B777472706E6D6C6B6A6763605C5A6064636160605F5D5C5C5B5956545250555A585656555554565654504D4C4A484E515455555452504F4D4D504E4D4E505050504F4E4D4C4C4F50510000011007980910539290079C090E54554BC4141007A8090F4A4A49494C4C4D50515253524F53524F4D4C7590078E0B0E7590878E0B0E4A4947433BD0121007A30B0F373333312F2B26242423252526292A2A2A0000011007810D102A2A2828282B3337383A3F44474746484B4F52504B4846434343413D393500000110079F0F10312F2D2B27211E1D3F90078E100E1C1A191214100798100F181817181F20242A2E33383E41464B4B4F56595E000001100788121065686667660000011007A3121066686B6D6F727375777774707273706C6764615F5A575553453D39322C251F1A1C191614171D2124282C2E31353A3F4144484A4B4C4D50555B000001100790171061656A6665656768C99007B9170E0000011007B917106869659413100889000F625F5D5D5F5D5A56524B4E4E4C4B4847494B494A4D5051514F4E4C4E4E4D4B4A494A4B4B4B4B47474D4E4E4E4E4E4C4B4A46434B4D4C4B49490000011008B804104B4B4B4D515456565655545455595A5800000110088F0610595A5A595A595755555858575655545453525152534E4A474445484B4E4F13505251135113515051525154AF9088A6090E0000011008A6091052505594141008B3090F55565B5A58534F4B49134037132F28132320131A13181514151615171919191A1A1B1A1B1C1D202325242221225890088B0D0E00000110088C0D1023252AEC151008990D0F2B2B2E31393F3A3C41484E555D00000110089F0E1063696E73767A7C7D7F7E7F8085878689E59008B50F0E0000011008B50F10878979CD13100885100F76737272706D0000011008A71010696461605D5A57555352520000011008A11110504C4947484743434278900893120E0000011008941210423F3A3837D6131008A9120F33322F2E2F31322F2C2C2B2828292A2827243A90088E140E211C19181809141008A4140F191A19191028B6140813131313133C95")!, pumpModel: pumpModel) + let _ = try GlucosePage(pageData: Data(hexadecimalString: "201E1D1C1A1817161718191B1D1B1C1F212527282A2E3235383C3FCD9086850E0E0000011006850E1043484857EB181006940E0F595E00000110069F0E106670757374767A7D7F8181817D7813726D6663605E5B554F4C4E4F4B484946423E3B38353234332D2B2B2B2C2E302F2F312F2D2D2E2D2C2D2D2A2B292700000110069F1310242323272B2C3235383C00000110069514103E3E3F404141444A4945413E3D3D3A35302C2823201D1B1C1D1A1A1B1C1E2123272B2F3231323235383B3F43484949474542779007A0000E41423D6C171007AD000F3C3D3D3B3C3E3F41474F545A626A6E700000011007860210717271727476797A7A7B7C7D7C7B777472706E6D6C6B6A6763605C5A6064636160605F5D5C5C5B5956545250555A585656555554565654504D4C4A484E515455555452504F4D4D504E4D4E505050504F4E4D4C4C4F50510000011007980910539290079C090E54554BC4141007A8090F4A4A49494C4C4D50515253524F53524F4D4C7590078E0B0E7590878E0B0E4A4947433BD0121007A30B0F373333312F2B26242423252526292A2A2A0000011007810D102A2A2828282B3337383A3F44474746484B4F52504B4846434343413D393500000110079F0F10312F2D2B27211E1D3F90078E100E1C1A191214100798100F181817181F20242A2E33383E41464B4B4F56595E000001100788121065686667660000011007A3121066686B6D6F727375777774707273706C6764615F5A575553453D39322C251F1A1C191614171D2124282C2E31353A3F4144484A4B4C4D50555B000001100790171061656A6665656768C99007B9170E0000011007B917106869659413100889000F625F5D5D5F5D5A56524B4E4E4C4B4847494B494A4D5051514F4E4C4E4E4D4B4A494A4B4B4B4B47474D4E4E4E4E4E4C4B4A46434B4D4C4B49490000011008B804104B4B4B4D515456565655545455595A5800000110088F0610595A5A595A595755555858575655545453525152534E4A474445484B4E4F13505251135113515051525154AF9088A6090E0000011008A6091052505594141008B3090F55565B5A58534F4B49134037132F28132320131A13181514151615171919191A1A1B1A1B1C1D202325242221225890088B0D0E00000110088C0D1023252AEC151008990D0F2B2B2E31393F3A3C41484E555D00000110089F0E1063696E73767A7C7D7F7E7F8085878689E59008B50F0E0000011008B50F10878979CD13100885100F76737272706D0000011008A71010696461605D5A57555352520000011008A11110504C4947484743434278900893120E0000011008941210423F3A3837D6131008A9120F33322F2E2F31322F2C2C2B2828292A2827243A90088E140E211C19181809141008A4140F191A19191028B6140813131313133C95")!) } catch GlucosePage.GlucosePageError.invalidCRC { XCTFail("page decoding threw invalid crc") } catch GlucosePage.GlucosePageError.unknownEventType(let eventType) { @@ -35,9 +34,8 @@ class GlucosePageTests: XCTestCase { } func testGlucosePageInvalidCRC() { - let pumpModel = PumpModel.Model551 do { - let _ = try GlucosePage(pageData: Data(hexadecimalString: "201E1D1C1A1817161718191B1D1B1C1F212527282A2E3235383C3FCD9086850E0E0000011006850E1043484857EB181006940E0F595E00000110069F0E106670757374767A7D7F8181817D7813726D6663605E5B554F4C4E4F4B484946423E3B38353234332D2B2B2B2C2E302F2F312F2D2D2E2D2C2D2D2A2B292700000110069F1310242323272B2C3235383C00000110069514103E3E3F404141444A4945413E3D3D3A35302C2823201D1B1C1D1A1A1B1C1E2123272B2F3231323235383B3F43484949474542779007A0000E41423D6C171007AD000F3C3D3D3B3C3E3F41474F545A626A6E700000011007860210717271727476797A7A7B7C7D7C7B777472706E6D6C6B6A6763605C5A6064636160605F5D5C5C5B5956545250555A585656555554565654504D4C4A484E515455555452504F4D4D504E4D4E505050504F4E4D4C4C4F50510000011007980910539290079C090E54554BC4141007A8090F4A4A49494C4C4D50515253524F53524F4D4C7590078E0B0E7590878E0B0E4A4947433BD0121007A30B0F373333312F2B26242423252526292A2A2A0000011007810D102A2A2828282B3337383A3F44474746484B4F52504B4846434343413D393500000110079F0F10312F2D2B27211E1D3F90078E100E1C1A191214100798100F181817181F20242A2E33383E41464B4B4F56595E000001100788121065686667660000011007A3121066686B6D6F727375777774707273706C6764615F5A575553453D39322C251F1A1C191614171D2124282C2E31353A3F4144484A4B4C4D50555B000001100790171061656A6665656768C99007B9170E0000011007B917106869659413100889000F625F5D5D5F5D5A56524B4E4E4C4B4847494B494A4D5051514F4E4C4E4E4D4B4A494A4B4B4B4B47474D4E4E4E4E4E4C4B4A46434B4D4C4B49490000011008B804104B4B4B4D515456565655545455595A5800000110088F0610595A5A595A595755555858575655545453525152534E4A474445484B4E4F13505251135113515051525154AF9088A6090E0000011008A6091052505594141008B3090F55565B5A58534F4B49134037132F28132320131A13181514151615171919191A1A1B1A1B1C1D202325242221225890088B0D0E00000110088C0D1023252AEC151008990D0F2B2B2E31393F3A3C41484E555D00000110089F0E1063696E73767A7C7D7F7E7F8085878689E59008B50F0E0000011008B50F10878979CD13100885100F76737272706D0000011008A71010696461605D5A57555352520000011008A11110504C4947484743434278900893120E0000011008941210423F3A3837D6131008A9120F33322F2E2F31322F2C2C2B2828292A2827243A90088E140E211C19181809141008A4140F191A19191028B6140813131313133C94")!, pumpModel: pumpModel) + let _ = try GlucosePage(pageData: Data(hexadecimalString: "201E1D1C1A1817161718191B1D1B1C1F212527282A2E3235383C3FCD9086850E0E0000011006850E1043484857EB181006940E0F595E00000110069F0E106670757374767A7D7F8181817D7813726D6663605E5B554F4C4E4F4B484946423E3B38353234332D2B2B2B2C2E302F2F312F2D2D2E2D2C2D2D2A2B292700000110069F1310242323272B2C3235383C00000110069514103E3E3F404141444A4945413E3D3D3A35302C2823201D1B1C1D1A1A1B1C1E2123272B2F3231323235383B3F43484949474542779007A0000E41423D6C171007AD000F3C3D3D3B3C3E3F41474F545A626A6E700000011007860210717271727476797A7A7B7C7D7C7B777472706E6D6C6B6A6763605C5A6064636160605F5D5C5C5B5956545250555A585656555554565654504D4C4A484E515455555452504F4D4D504E4D4E505050504F4E4D4C4C4F50510000011007980910539290079C090E54554BC4141007A8090F4A4A49494C4C4D50515253524F53524F4D4C7590078E0B0E7590878E0B0E4A4947433BD0121007A30B0F373333312F2B26242423252526292A2A2A0000011007810D102A2A2828282B3337383A3F44474746484B4F52504B4846434343413D393500000110079F0F10312F2D2B27211E1D3F90078E100E1C1A191214100798100F181817181F20242A2E33383E41464B4B4F56595E000001100788121065686667660000011007A3121066686B6D6F727375777774707273706C6764615F5A575553453D39322C251F1A1C191614171D2124282C2E31353A3F4144484A4B4C4D50555B000001100790171061656A6665656768C99007B9170E0000011007B917106869659413100889000F625F5D5D5F5D5A56524B4E4E4C4B4847494B494A4D5051514F4E4C4E4E4D4B4A494A4B4B4B4B47474D4E4E4E4E4E4C4B4A46434B4D4C4B49490000011008B804104B4B4B4D515456565655545455595A5800000110088F0610595A5A595A595755555858575655545453525152534E4A474445484B4E4F13505251135113515051525154AF9088A6090E0000011008A6091052505594141008B3090F55565B5A58534F4B49134037132F28132320131A13181514151615171919191A1A1B1A1B1C1D202325242221225890088B0D0E00000110088C0D1023252AEC151008990D0F2B2B2E31393F3A3C41484E555D00000110089F0E1063696E73767A7C7D7F7E7F8085878689E59008B50F0E0000011008B50F10878979CD13100885100F76737272706D0000011008A71010696461605D5A57555352520000011008A11110504C4947484743434278900893120E0000011008941210423F3A3837D6131008A9120F33322F2E2F31322F2C2C2B2828292A2827243A90088E140E211C19181809141008A4140F191A19191028B6140813131313133C94")!) XCTFail("Should have thrown InvalidCRC") } catch GlucosePage.GlucosePageError.invalidCRC { // Happy path @@ -49,11 +47,10 @@ class GlucosePageTests: XCTestCase { } func testUnknownRecords() { - let pumpModel = PumpModel.Model551 do { //05 is a currently unknown opcode let pageData = Data(hexadecimalString: "051053b394081053b3940b014a60".leftPadding(toLength: 2048, withPad: "0"))! - let page = try GlucosePage(pageData: pageData, pumpModel: pumpModel) + let page = try GlucosePage(pageData: pageData) let events = page.events XCTAssertEqual(events.count, 4) @@ -69,10 +66,9 @@ class GlucosePageTests: XCTestCase { } func testRelativeTimestamping() { - let pumpModel = PumpModel.Model551 do { let pageData = Data(hexadecimalString: "1028B61408131313131341BB".leftPadding(toLength: 2048, withPad: "0"))! - let page = try GlucosePage(pageData: pageData, pumpModel: pumpModel) + let page = try GlucosePage(pageData: pageData) let events = page.events // a sensor timestamp followed by 5 "19-Something" relative timestamp records @@ -93,9 +89,8 @@ class GlucosePageTests: XCTestCase { } func testGlucosePageEventDecoding() { - let pumpModel = PumpModel.Model551 do { - let page = try GlucosePage(pageData: Data(hexadecimalString: "201E1D1C1A1817161718191B1D1B1C1F212527282A2E3235383C3FCD9086850E0E0000011006850E1043484857EB181006940E0F595E00000110069F0E106670757374767A7D7F8181817D7813726D6663605E5B554F4C4E4F4B484946423E3B38353234332D2B2B2B2C2E302F2F312F2D2D2E2D2C2D2D2A2B292700000110069F1310242323272B2C3235383C00000110069514103E3E3F404141444A4945413E3D3D3A35302C2823201D1B1C1D1A1A1B1C1E2123272B2F3231323235383B3F43484949474542779007A0000E41423D6C171007AD000F3C3D3D3B3C3E3F41474F545A626A6E700000011007860210717271727476797A7A7B7C7D7C7B777472706E6D6C6B6A6763605C5A6064636160605F5D5C5C5B5956545250555A585656555554565654504D4C4A484E515455555452504F4D4D504E4D4E505050504F4E4D4C4C4F50510000011007980910539290079C090E54554BC4141007A8090F4A4A49494C4C4D50515253524F53524F4D4C7590078E0B0E7590878E0B0E4A4947433BD0121007A30B0F373333312F2B26242423252526292A2A2A0000011007810D102A2A2828282B3337383A3F44474746484B4F52504B4846434343413D393500000110079F0F10312F2D2B27211E1D3F90078E100E1C1A191214100798100F181817181F20242A2E33383E41464B4B4F56595E000001100788121065686667660000011007A3121066686B6D6F727375777774707273706C6764615F5A575553453D39322C251F1A1C191614171D2124282C2E31353A3F4144484A4B4C4D50555B000001100790171061656A6665656768C99007B9170E0000011007B917106869659413100889000F625F5D5D5F5D5A56524B4E4E4C4B4847494B494A4D5051514F4E4C4E4E4D4B4A494A4B4B4B4B47474D4E4E4E4E4E4C4B4A46434B4D4C4B49490000011008B804104B4B4B4D515456565655545455595A5800000110088F0610595A5A595A595755555858575655545453525152534E4A474445484B4E4F13505251135113515051525154AF9088A6090E0000011008A6091052505594141008B3090F55565B5A58534F4B49134037132F28132320131A13181514151615171919191A1A1B1A1B1C1D202325242221225890088B0D0E00000110088C0D1023252AEC151008990D0F2B2B2E31393F3A3C41484E555D00000110089F0E1063696E73767A7C7D7F7E7F8085878689E59008B50F0E0000011008B50F10878979CD13100885100F76737272706D0000011008A71010696461605D5A57555352520000011008A11110504C4947484743434278900893120E0000011008941210423F3A3837D6131008A9120F33322F2E2F31322F2C2C2B2828292A2827243A90088E140E211C19181809141008A4140F191A19191028B6140813131313133C95")!, pumpModel: pumpModel) + let page = try GlucosePage(pageData: Data(hexadecimalString: "201E1D1C1A1817161718191B1D1B1C1F212527282A2E3235383C3FCD9086850E0E0000011006850E1043484857EB181006940E0F595E00000110069F0E106670757374767A7D7F8181817D7813726D6663605E5B554F4C4E4F4B484946423E3B38353234332D2B2B2B2C2E302F2F312F2D2D2E2D2C2D2D2A2B292700000110069F1310242323272B2C3235383C00000110069514103E3E3F404141444A4945413E3D3D3A35302C2823201D1B1C1D1A1A1B1C1E2123272B2F3231323235383B3F43484949474542779007A0000E41423D6C171007AD000F3C3D3D3B3C3E3F41474F545A626A6E700000011007860210717271727476797A7A7B7C7D7C7B777472706E6D6C6B6A6763605C5A6064636160605F5D5C5C5B5956545250555A585656555554565654504D4C4A484E515455555452504F4D4D504E4D4E505050504F4E4D4C4C4F50510000011007980910539290079C090E54554BC4141007A8090F4A4A49494C4C4D50515253524F53524F4D4C7590078E0B0E7590878E0B0E4A4947433BD0121007A30B0F373333312F2B26242423252526292A2A2A0000011007810D102A2A2828282B3337383A3F44474746484B4F52504B4846434343413D393500000110079F0F10312F2D2B27211E1D3F90078E100E1C1A191214100798100F181817181F20242A2E33383E41464B4B4F56595E000001100788121065686667660000011007A3121066686B6D6F727375777774707273706C6764615F5A575553453D39322C251F1A1C191614171D2124282C2E31353A3F4144484A4B4C4D50555B000001100790171061656A6665656768C99007B9170E0000011007B917106869659413100889000F625F5D5D5F5D5A56524B4E4E4C4B4847494B494A4D5051514F4E4C4E4E4D4B4A494A4B4B4B4B47474D4E4E4E4E4E4C4B4A46434B4D4C4B49490000011008B804104B4B4B4D515456565655545455595A5800000110088F0610595A5A595A595755555858575655545453525152534E4A474445484B4E4F13505251135113515051525154AF9088A6090E0000011008A6091052505594141008B3090F55565B5A58534F4B49134037132F28132320131A13181514151615171919191A1A1B1A1B1C1D202325242221225890088B0D0E00000110088C0D1023252AEC151008990D0F2B2B2E31393F3A3C41484E555D00000110089F0E1063696E73767A7C7D7F7E7F8085878689E59008B50F0E0000011008B50F10878979CD13100885100F76737272706D0000011008A71010696461605D5A57555352520000011008A11110504C4947484743434278900893120E0000011008941210423F3A3837D6131008A9120F33322F2E2F31322F2C2C2B2828292A2827243A90088E140E211C19181809141008A4140F191A19191028B6140813131313133C95")!) let events = page.events diff --git a/RileyLinkKit/PumpOpsSynchronous.swift b/RileyLinkKit/PumpOpsSynchronous.swift index f6832b19e..7952e5293 100644 --- a/RileyLinkKit/PumpOpsSynchronous.swift +++ b/RileyLinkKit/PumpOpsSynchronous.swift @@ -582,7 +582,7 @@ class PumpOpsSynchronous { idx = top } - let page = try GlucosePage(pageData: pageData, pumpModel: pumpModel) + let page = try GlucosePage(pageData: pageData) for event in page.events.reversed() { var timestamp = event.timestamp