Merge branch 'removeoopweb' into develop
This commit is contained in:
commit
c1de2f771a
|
@ -71,8 +71,6 @@
|
|||
F816E1312439E2DD009EE65B /* DexcomG4BluetoothPeripheralViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F816E1302439E2DD009EE65B /* DexcomG4BluetoothPeripheralViewModel.swift */; };
|
||||
F8177023248CF78300AA3600 /* LibreSensorType.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8177022248CF78300AA3600 /* LibreSensorType.swift */; };
|
||||
F8177025248ED4DE00AA3600 /* Libre1DerivedAlgorithmParameters.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8177024248ED4DE00AA3600 /* Libre1DerivedAlgorithmParameters.swift */; };
|
||||
F8177027248ED57000AA3600 /* LibreRawGlucoseOOPA2Data.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8177026248ED57000AA3600 /* LibreRawGlucoseOOPA2Data.swift */; };
|
||||
F8177029248ED6E600AA3600 /* LibreRawGlucoseOOPData.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8177028248ED6E600AA3600 /* LibreRawGlucoseOOPData.swift */; };
|
||||
F81D6D4822BD5F62005EFAE2 /* DexcomShareUploadManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F81D6D4722BD5F62005EFAE2 /* DexcomShareUploadManager.swift */; };
|
||||
F81D6D4E22BFC762005EFAE2 /* TextsDexcomShareTestResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = F81D6D4D22BFC762005EFAE2 /* TextsDexcomShareTestResult.swift */; };
|
||||
F81D6D5222C27F18005EFAE2 /* BgReading+DexcomShare.swift in Sources */ = {isa = PBXBuildFile; fileRef = F81D6D5122C27F18005EFAE2 /* BgReading+DexcomShare.swift */; };
|
||||
|
@ -101,7 +99,6 @@
|
|||
F821CF9522ADB0D7005C1E43 /* HealthKitManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F821CF9422ADB0D7005C1E43 /* HealthKitManager.swift */; };
|
||||
F821CF9722AE589E005C1E43 /* HealthKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F821CF9622AE589E005C1E43 /* HealthKit.framework */; };
|
||||
F821CF9D22AEF483005C1E43 /* BGReadingSpeaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = F821CF9C22AEF483005C1E43 /* BGReadingSpeaker.swift */; };
|
||||
F82436FA24BDFA5E00BED341 /* LibreReCalibrator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F82436F924BDFA5E00BED341 /* LibreReCalibrator.swift */; };
|
||||
F82436FC24BE014000BED341 /* TextsLibreStates.swift in Sources */ = {isa = PBXBuildFile; fileRef = F82436FB24BE014000BED341 /* TextsLibreStates.swift */; };
|
||||
F82436FE24BE01F700BED341 /* LibreStates.strings in Resources */ = {isa = PBXBuildFile; fileRef = F82436FD24BE01F700BED341 /* LibreStates.strings */; };
|
||||
F824376A24CB7A9800BED341 /* Martian_Gun.caf in Resources */ = {isa = PBXBuildFile; fileRef = F82436FF24CB7A7F00BED341 /* Martian_Gun.caf */; };
|
||||
|
@ -234,6 +231,7 @@
|
|||
F856CE5B22EDC8E50083E436 /* ConstantsBluetoothPairing.swift in Sources */ = {isa = PBXBuildFile; fileRef = F856CE5A22EDC8E50083E436 /* ConstantsBluetoothPairing.swift */; };
|
||||
F857A32A253E2D9E00951BB2 /* LibreAlgorithmThresholds.swift in Sources */ = {isa = PBXBuildFile; fileRef = F857A329253E2D9E00951BB2 /* LibreAlgorithmThresholds.swift */; };
|
||||
F857A334253F6A7600951BB2 /* LibreCalibrationInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = F857A333253F6A7500951BB2 /* LibreCalibrationInfo.swift */; };
|
||||
F858CCED25AE4CD100786B91 /* LibreOOPWebError.swift in Sources */ = {isa = PBXBuildFile; fileRef = F858CCEC25AE4CD100786B91 /* LibreOOPWebError.swift */; };
|
||||
F85DC2ED21CFE2F500B9F74A /* BgReading+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = F85DC2E721CFE2F500B9F74A /* BgReading+CoreDataProperties.swift */; };
|
||||
F85DC2EF21CFE2F500B9F74A /* Sensor+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = F85DC2E921CFE2F500B9F74A /* Sensor+CoreDataProperties.swift */; };
|
||||
F85DC2F321CFE3D400B9F74A /* Calibration+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = F85DC2F021CFE3D400B9F74A /* Calibration+CoreDataClass.swift */; };
|
||||
|
@ -259,11 +257,6 @@
|
|||
F8797CEA255B43960033956B /* GlucoseData+Smoothable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8797CE9255B43960033956B /* GlucoseData+Smoothable.swift */; };
|
||||
F889CB6F236D84AC00A81068 /* M5StackView.strings in Resources */ = {isa = PBXBuildFile; fileRef = F889CB71236D84AC00A81068 /* M5StackView.strings */; };
|
||||
F890E07A247687AE008FB2EC /* URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = F890E079247687AE008FB2EC /* URL.swift */; };
|
||||
F89467EE249EBBDD00F18424 /* LibreRawGlucoseWeb.swift in Sources */ = {isa = PBXBuildFile; fileRef = F89467ED249EBBDD00F18424 /* LibreRawGlucoseWeb.swift */; };
|
||||
F89467F0249FFF5900F18424 /* LibreRawGlucoseOOPGlucose.swift in Sources */ = {isa = PBXBuildFile; fileRef = F89467EF249FFF5900F18424 /* LibreRawGlucoseOOPGlucose.swift */; };
|
||||
F89467F2249FFF8700F18424 /* LibreRawGlucoseOOPA2List.swift in Sources */ = {isa = PBXBuildFile; fileRef = F89467F1249FFF8700F18424 /* LibreRawGlucoseOOPA2List.swift */; };
|
||||
F89467F4249FFFA700F18424 /* LibreRawGlucoseOOPA2Cotent.swift in Sources */ = {isa = PBXBuildFile; fileRef = F89467F3249FFFA700F18424 /* LibreRawGlucoseOOPA2Cotent.swift */; };
|
||||
F89467F824A7C94C00F18424 /* LibreHistoricGlucoseA2.swift in Sources */ = {isa = PBXBuildFile; fileRef = F89467F724A7C94C00F18424 /* LibreHistoricGlucoseA2.swift */; };
|
||||
F897AAF92200F2D200CDDD10 /* CBPeripheralState.swift in Sources */ = {isa = PBXBuildFile; fileRef = F897AAF82200F2D200CDDD10 /* CBPeripheralState.swift */; };
|
||||
F897AAFB2201018800CDDD10 /* String.swift in Sources */ = {isa = PBXBuildFile; fileRef = F897AAFA2201018800CDDD10 /* String.swift */; };
|
||||
F897E24B23FC86CF0075E0E8 /* CGMG5TransmitterDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F897E24A23FC86CF0075E0E8 /* CGMG5TransmitterDelegate.swift */; };
|
||||
|
@ -312,11 +305,9 @@
|
|||
F8AC426521ADEBD60078C348 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F8AC426321ADEBD60078C348 /* Main.storyboard */; };
|
||||
F8AC426721ADEBD70078C348 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F8AC426621ADEBD70078C348 /* Assets.xcassets */; };
|
||||
F8AC426A21ADEBD70078C348 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F8AC426821ADEBD70078C348 /* LaunchScreen.storyboard */; };
|
||||
F8AF11F124B11FD400AE5BA2 /* LibreOOPWebError.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8AF11F024B11FD400AE5BA2 /* LibreOOPWebError.swift */; };
|
||||
F8AF11F324B1279500AE5BA2 /* TextsLibreErrors.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8AF11F224B1279500AE5BA2 /* TextsLibreErrors.swift */; };
|
||||
F8AF11F824B1E6EE00AE5BA2 /* XdripError.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8AF11F724B1E6EE00AE5BA2 /* XdripError.swift */; };
|
||||
F8AF11FA24B1FB3500AE5BA2 /* DexcomError.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8AF11F924B1FB3500AE5BA2 /* DexcomError.swift */; };
|
||||
F8AF11FC24B27A6D00AE5BA2 /* LibreOOPWebServerResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8AF11FB24B27A6C00AE5BA2 /* LibreOOPWebServerResponse.swift */; };
|
||||
F8AF11FD24B3B62D00AE5BA2 /* LibreErrors.strings in Resources */ = {isa = PBXBuildFile; fileRef = F8AF11FF24B3B62D00AE5BA2 /* LibreErrors.strings */; };
|
||||
F8AF120124B9082000AE5BA2 /* Calibration+NightScout.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8AF120024B9082000AE5BA2 /* Calibration+NightScout.swift */; };
|
||||
F8AF36152455C6F700B5977B /* ConstantsTrace.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8AF36142455C6F700B5977B /* ConstantsTrace.swift */; };
|
||||
|
@ -465,9 +456,7 @@
|
|||
F8F9721923A5915900C3F17D /* CGMGNSEntryTransmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8F971DC23A5915900C3F17D /* CGMGNSEntryTransmitter.swift */; };
|
||||
F8F9721A23A5915900C3F17D /* CGMBubbleTransmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8F971DE23A5915900C3F17D /* CGMBubbleTransmitter.swift */; };
|
||||
F8F9721B23A5915900C3F17D /* CGMMiaoMiaoTransmitter.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8F971E023A5915900C3F17D /* CGMMiaoMiaoTransmitter.swift */; };
|
||||
F8F9721C23A5915900C3F17D /* LibreOOPResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8F971E223A5915900C3F17D /* LibreOOPResponse.swift */; };
|
||||
F8F9721E23A5915900C3F17D /* LibreSensorState.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8F971E423A5915900C3F17D /* LibreSensorState.swift */; };
|
||||
F8F9721F23A5915900C3F17D /* LibreOOPClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8F971E523A5915900C3F17D /* LibreOOPClient.swift */; };
|
||||
F8F9722123A5915900C3F17D /* LibreSensorSerialNumber.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8F971E723A5915900C3F17D /* LibreSensorSerialNumber.swift */; };
|
||||
F8F9722223A5915900C3F17D /* CRC.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8F971E823A5915900C3F17D /* CRC.swift */; };
|
||||
F8F9722323A5915900C3F17D /* LibreDataParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8F971E923A5915900C3F17D /* LibreDataParser.swift */; };
|
||||
|
@ -591,8 +580,6 @@
|
|||
F816E1302439E2DD009EE65B /* DexcomG4BluetoothPeripheralViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DexcomG4BluetoothPeripheralViewModel.swift; sourceTree = "<group>"; };
|
||||
F8177022248CF78300AA3600 /* LibreSensorType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibreSensorType.swift; sourceTree = "<group>"; };
|
||||
F8177024248ED4DE00AA3600 /* Libre1DerivedAlgorithmParameters.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Libre1DerivedAlgorithmParameters.swift; sourceTree = "<group>"; };
|
||||
F8177026248ED57000AA3600 /* LibreRawGlucoseOOPA2Data.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibreRawGlucoseOOPA2Data.swift; sourceTree = "<group>"; };
|
||||
F8177028248ED6E600AA3600 /* LibreRawGlucoseOOPData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibreRawGlucoseOOPData.swift; sourceTree = "<group>"; };
|
||||
F817702A2491860F00AA3600 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/SettingsViews.strings; sourceTree = "<group>"; };
|
||||
F81D6D4522B67F55005EFAE2 /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/SpeakReading.strings; sourceTree = "<group>"; };
|
||||
F81D6D4722BD5F62005EFAE2 /* DexcomShareUploadManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DexcomShareUploadManager.swift; sourceTree = "<group>"; };
|
||||
|
@ -624,7 +611,6 @@
|
|||
F821CF9622AE589E005C1E43 /* HealthKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = HealthKit.framework; path = System/Library/Frameworks/HealthKit.framework; sourceTree = SDKROOT; };
|
||||
F821CF9822AE589E005C1E43 /* xdrip.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = xdrip.entitlements; sourceTree = "<group>"; };
|
||||
F821CF9C22AEF483005C1E43 /* BGReadingSpeaker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BGReadingSpeaker.swift; sourceTree = "<group>"; };
|
||||
F82436F924BDFA5E00BED341 /* LibreReCalibrator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibreReCalibrator.swift; sourceTree = "<group>"; };
|
||||
F82436FB24BE014000BED341 /* TextsLibreStates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextsLibreStates.swift; sourceTree = "<group>"; };
|
||||
F82436FD24BE01F700BED341 /* LibreStates.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = LibreStates.strings; sourceTree = "<group>"; };
|
||||
F82436FF24CB7A7F00BED341 /* Martian_Gun.caf */ = {isa = PBXFileReference; lastKnownFileType = file; path = Martian_Gun.caf; sourceTree = "<group>"; };
|
||||
|
@ -760,6 +746,7 @@
|
|||
F856CE5A22EDC8E50083E436 /* ConstantsBluetoothPairing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConstantsBluetoothPairing.swift; sourceTree = "<group>"; };
|
||||
F857A329253E2D9E00951BB2 /* LibreAlgorithmThresholds.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibreAlgorithmThresholds.swift; sourceTree = "<group>"; };
|
||||
F857A333253F6A7500951BB2 /* LibreCalibrationInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LibreCalibrationInfo.swift; sourceTree = "<group>"; };
|
||||
F858CCEC25AE4CD100786B91 /* LibreOOPWebError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LibreOOPWebError.swift; sourceTree = "<group>"; };
|
||||
F85DC2E721CFE2F500B9F74A /* BgReading+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "BgReading+CoreDataProperties.swift"; path = "../Extensions/BgReading+CoreDataProperties.swift"; sourceTree = "<group>"; };
|
||||
F85DC2E921CFE2F500B9F74A /* Sensor+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "Sensor+CoreDataProperties.swift"; path = "../Extensions/Sensor+CoreDataProperties.swift"; sourceTree = "<group>"; };
|
||||
F85DC2F021CFE3D400B9F74A /* Calibration+CoreDataClass.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Calibration+CoreDataClass.swift"; sourceTree = "<group>"; };
|
||||
|
@ -808,11 +795,6 @@
|
|||
F889CB8E236D89C800A81068 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Main.strings; sourceTree = "<group>"; };
|
||||
F889CB97236D89C800A81068 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
F890E079247687AE008FB2EC /* URL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URL.swift; sourceTree = "<group>"; };
|
||||
F89467ED249EBBDD00F18424 /* LibreRawGlucoseWeb.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibreRawGlucoseWeb.swift; sourceTree = "<group>"; };
|
||||
F89467EF249FFF5900F18424 /* LibreRawGlucoseOOPGlucose.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibreRawGlucoseOOPGlucose.swift; sourceTree = "<group>"; };
|
||||
F89467F1249FFF8700F18424 /* LibreRawGlucoseOOPA2List.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibreRawGlucoseOOPA2List.swift; sourceTree = "<group>"; };
|
||||
F89467F3249FFFA700F18424 /* LibreRawGlucoseOOPA2Cotent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibreRawGlucoseOOPA2Cotent.swift; sourceTree = "<group>"; };
|
||||
F89467F724A7C94C00F18424 /* LibreHistoricGlucoseA2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LibreHistoricGlucoseA2.swift; sourceTree = "<group>"; };
|
||||
F897AAF82200F2D200CDDD10 /* CBPeripheralState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CBPeripheralState.swift; sourceTree = "<group>"; };
|
||||
F897AAFA2201018800CDDD10 /* String.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = String.swift; sourceTree = "<group>"; };
|
||||
F897E24A23FC86CF0075E0E8 /* CGMG5TransmitterDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGMG5TransmitterDelegate.swift; sourceTree = "<group>"; };
|
||||
|
@ -865,11 +847,9 @@
|
|||
F8AC426621ADEBD70078C348 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
F8AC426921ADEBD70078C348 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
F8AC426B21ADEBD70078C348 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
F8AF11F024B11FD400AE5BA2 /* LibreOOPWebError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibreOOPWebError.swift; sourceTree = "<group>"; };
|
||||
F8AF11F224B1279500AE5BA2 /* TextsLibreErrors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextsLibreErrors.swift; sourceTree = "<group>"; };
|
||||
F8AF11F724B1E6EE00AE5BA2 /* XdripError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XdripError.swift; sourceTree = "<group>"; };
|
||||
F8AF11F924B1FB3500AE5BA2 /* DexcomError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DexcomError.swift; sourceTree = "<group>"; };
|
||||
F8AF11FB24B27A6C00AE5BA2 /* LibreOOPWebServerResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LibreOOPWebServerResponse.swift; sourceTree = "<group>"; };
|
||||
F8AF11FE24B3B62D00AE5BA2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/LibreErrors.strings; sourceTree = "<group>"; };
|
||||
F8AF120024B9082000AE5BA2 /* Calibration+NightScout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Calibration+NightScout.swift"; sourceTree = "<group>"; };
|
||||
F8AF36142455C6F700B5977B /* ConstantsTrace.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConstantsTrace.swift; sourceTree = "<group>"; };
|
||||
|
@ -1098,9 +1078,7 @@
|
|||
F8F971DC23A5915900C3F17D /* CGMGNSEntryTransmitter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGMGNSEntryTransmitter.swift; sourceTree = "<group>"; };
|
||||
F8F971DE23A5915900C3F17D /* CGMBubbleTransmitter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGMBubbleTransmitter.swift; sourceTree = "<group>"; };
|
||||
F8F971E023A5915900C3F17D /* CGMMiaoMiaoTransmitter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CGMMiaoMiaoTransmitter.swift; sourceTree = "<group>"; };
|
||||
F8F971E223A5915900C3F17D /* LibreOOPResponse.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LibreOOPResponse.swift; sourceTree = "<group>"; };
|
||||
F8F971E423A5915900C3F17D /* LibreSensorState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LibreSensorState.swift; sourceTree = "<group>"; };
|
||||
F8F971E523A5915900C3F17D /* LibreOOPClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LibreOOPClient.swift; sourceTree = "<group>"; };
|
||||
F8F971E723A5915900C3F17D /* LibreSensorSerialNumber.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LibreSensorSerialNumber.swift; sourceTree = "<group>"; };
|
||||
F8F971E823A5915900C3F17D /* CRC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CRC.swift; sourceTree = "<group>"; };
|
||||
F8F971E923A5915900C3F17D /* LibreDataParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LibreDataParser.swift; sourceTree = "<group>"; };
|
||||
|
@ -2228,7 +2206,6 @@
|
|||
F8025E5221EE8CE500ECF0C0 /* Protocol */,
|
||||
F8A54AAC22D6859200934E7A /* SlopeParameters.swift */,
|
||||
F51B9F7C24B216CD00FC0643 /* Libre1NonFixedSlopeCalibrator.swift */,
|
||||
F82436F924BDFA5E00BED341 /* LibreReCalibrator.swift */,
|
||||
);
|
||||
path = Calibration;
|
||||
sourceTree = "<group>";
|
||||
|
@ -2455,30 +2432,20 @@
|
|||
children = (
|
||||
F8F971E823A5915900C3F17D /* CRC.swift */,
|
||||
F8177024248ED4DE00AA3600 /* Libre1DerivedAlgorithmParameters.swift */,
|
||||
F8A5EEAD25791F370085E660 /* Libre2BLEUtilities.swift */,
|
||||
F857A329253E2D9E00951BB2 /* LibreAlgorithmThresholds.swift */,
|
||||
F857A333253F6A7500951BB2 /* LibreCalibrationInfo.swift */,
|
||||
F8F971E923A5915900C3F17D /* LibreDataParser.swift */,
|
||||
F80D915F24F45EB2006840B5 /* LibreError.swift */,
|
||||
F89467F724A7C94C00F18424 /* LibreHistoricGlucoseA2.swift */,
|
||||
F8F971EA23A5915900C3F17D /* LibreMeasurement.swift */,
|
||||
F8F971E523A5915900C3F17D /* LibreOOPClient.swift */,
|
||||
F8F971E223A5915900C3F17D /* LibreOOPResponse.swift */,
|
||||
F8AF11F024B11FD400AE5BA2 /* LibreOOPWebError.swift */,
|
||||
F8AF11FB24B27A6C00AE5BA2 /* LibreOOPWebServerResponse.swift */,
|
||||
F89467F3249FFFA700F18424 /* LibreRawGlucoseOOPA2Cotent.swift */,
|
||||
F8177026248ED57000AA3600 /* LibreRawGlucoseOOPA2Data.swift */,
|
||||
F89467F1249FFF8700F18424 /* LibreRawGlucoseOOPA2List.swift */,
|
||||
F8177028248ED6E600AA3600 /* LibreRawGlucoseOOPData.swift */,
|
||||
F89467EF249FFF5900F18424 /* LibreRawGlucoseOOPGlucose.swift */,
|
||||
F89467ED249EBBDD00F18424 /* LibreRawGlucoseWeb.swift */,
|
||||
F8A5EEB1257CEC290085E660 /* LibreNFC.swift */,
|
||||
F8A5EEC1257D18DC0085E660 /* LibreNFCDelegate.swift */,
|
||||
F858CCEC25AE4CD100786B91 /* LibreOOPWebError.swift */,
|
||||
F8F971E723A5915900C3F17D /* LibreSensorSerialNumber.swift */,
|
||||
F8F971E423A5915900C3F17D /* LibreSensorState.swift */,
|
||||
F8177022248CF78300AA3600 /* LibreSensorType.swift */,
|
||||
F80D915B24F06A40006840B5 /* PreLibre2.swift */,
|
||||
F8A5EEAD25791F370085E660 /* Libre2BLEUtilities.swift */,
|
||||
F8A5EEB1257CEC290085E660 /* LibreNFC.swift */,
|
||||
F8A5EEC1257D18DC0085E660 /* LibreNFCDelegate.swift */,
|
||||
F8F7B8E5259A6EBF00C47B04 /* LibreSmoothing.swift */,
|
||||
F80D915B24F06A40006840B5 /* PreLibre2.swift */,
|
||||
);
|
||||
path = Utilities;
|
||||
sourceTree = "<group>";
|
||||
|
@ -2958,7 +2925,6 @@
|
|||
F816E11C2439243B009EE65B /* Droplet+CoreDataProperties.swift in Sources */,
|
||||
F821CF56229BF43A005C1E43 /* AlertKind.swift in Sources */,
|
||||
F85DC2ED21CFE2F500B9F74A /* BgReading+CoreDataProperties.swift in Sources */,
|
||||
F8AF11FC24B27A6D00AE5BA2 /* LibreOOPWebServerResponse.swift in Sources */,
|
||||
F8F9723123A5915900C3F17D /* M5StackAuthenticateTXMessage.swift in Sources */,
|
||||
F8F9721223A5915900C3F17D /* FirmwareVersionTxMessage.swift in Sources */,
|
||||
F80D916824F7086D006840B5 /* Libre2BluetoothPeripheralViewModel.swift in Sources */,
|
||||
|
@ -2970,19 +2936,16 @@
|
|||
F821CF8122A5C814005C1E43 /* RepeatingTimer.swift in Sources */,
|
||||
F80D915C24F06A40006840B5 /* PreLibre2.swift in Sources */,
|
||||
F8F9722223A5915900C3F17D /* CRC.swift in Sources */,
|
||||
F89467F2249FFF8700F18424 /* LibreRawGlucoseOOPA2List.swift in Sources */,
|
||||
F821CF6F229FC280005C1E43 /* Endpoint+NightScout.swift in Sources */,
|
||||
F8F9722A23A5915900C3F17D /* TransmitterBatteryInfo.swift in Sources */,
|
||||
F878FA7D2405B3CF00BC6DA6 /* BluetoothPeripheralManager+CGMBubbleTransmitterDelegate.swift in Sources */,
|
||||
F821CF5D229BF43A005C1E43 /* NSDateFormatter.swift in Sources */,
|
||||
F8F9721B23A5915900C3F17D /* CGMMiaoMiaoTransmitter.swift in Sources */,
|
||||
F8F9721A23A5915900C3F17D /* CGMBubbleTransmitter.swift in Sources */,
|
||||
F89467F824A7C94C00F18424 /* LibreHistoricGlucoseA2.swift in Sources */,
|
||||
F8EA6CA921BBE3010082976B /* UniqueId.swift in Sources */,
|
||||
F8A1585122EDB597007F5B5D /* ConstantsBGGraphBuilder.swift in Sources */,
|
||||
F81D6D4822BD5F62005EFAE2 /* DexcomShareUploadManager.swift in Sources */,
|
||||
F8C9784D2428052E00A09483 /* CGMSensorType.swift in Sources */,
|
||||
F89467EE249EBBDD00F18424 /* LibreRawGlucoseWeb.swift in Sources */,
|
||||
F8A1586B22EDB967007F5B5D /* ConstantsMaster.swift in Sources */,
|
||||
F8F9723923A5928D00C3F17D /* M5StackBluetoothPeripheralViewModel.swift in Sources */,
|
||||
F8F9722B23A5915900C3F17D /* CGMTransmitterDelegate.swift in Sources */,
|
||||
|
@ -3005,6 +2968,7 @@
|
|||
F8A1587122EDC865007F5B5D /* ConstantsSpeakReadingLanguages.swift in Sources */,
|
||||
F8A1585522EDB706007F5B5D /* ConstantsCalibrationAlgorithms.swift in Sources */,
|
||||
F897AAF92200F2D200CDDD10 /* CBPeripheralState.swift in Sources */,
|
||||
F858CCED25AE4CD100786B91 /* LibreOOPWebError.swift in Sources */,
|
||||
F8F971B623A5914D00C3F17D /* M5Stack+BluetoothPeripheral.swift in Sources */,
|
||||
F830992323C291EE005741DF /* Watlaa+BluetoothPeripheral.swift in Sources */,
|
||||
F821CF57229BF43A005C1E43 /* SnoozeParameters.swift in Sources */,
|
||||
|
@ -3021,7 +2985,6 @@
|
|||
F8297F4E238DCAD800D74D66 /* BluetoothPeripheralsViewController.swift in Sources */,
|
||||
F8B3A848227F090E004BA588 /* SettingsViewHealthKitSettingsViewModel.swift in Sources */,
|
||||
F8025E5021EE746400ECF0C0 /* Calibrator.swift in Sources */,
|
||||
F89467F4249FFFA700F18424 /* LibreRawGlucoseOOPA2Cotent.swift in Sources */,
|
||||
F85DC2F421CFE3D400B9F74A /* Sensor+CoreDataClass.swift in Sources */,
|
||||
F8B3A844227F090E004BA588 /* SettingsViewAlertSettingsViewModel.swift in Sources */,
|
||||
F8D0587C24BCB570008C8734 /* SettingsViewHomeScreenSettingsViewModel.swift in Sources */,
|
||||
|
@ -3096,7 +3059,6 @@
|
|||
F8B3A80A227A3D11004BA588 /* TextsAlertTypeSettings.swift in Sources */,
|
||||
F85FF39125288870004E6FF1 /* HouseKeeper.swift in Sources */,
|
||||
F8F9721823A5915900C3F17D /* CGMBlueReaderTransmitter.swift in Sources */,
|
||||
F8177029248ED6E600AA3600 /* LibreRawGlucoseOOPData.swift in Sources */,
|
||||
F8252867243E50FE0067AF77 /* ConstantsLibre.swift in Sources */,
|
||||
F8A1586D22EDB9BE007F5B5D /* ConstantsDexcomFollower.swift in Sources */,
|
||||
F8F9720923A5915900C3F17D /* AESCrypt.m in Sources */,
|
||||
|
@ -3120,7 +3082,6 @@
|
|||
F8F9721523A5915900C3F17D /* PairRequestTxMessage.swift in Sources */,
|
||||
F8BECB12235CEA9B0060DAE1 /* TimeInterval.swift in Sources */,
|
||||
F8F9720823A5915900C3F17D /* BatteryStatusTxMessage.swift in Sources */,
|
||||
F8F9721C23A5915900C3F17D /* LibreOOPResponse.swift in Sources */,
|
||||
F81F9FFC2288C7530028C70F /* NewAlertSettingsViewController.swift in Sources */,
|
||||
F80D916524F5B3DE006840B5 /* Libre2+CoreDataClass.swift in Sources */,
|
||||
F898EDF2234A8A0500BFB79B /* UInt8.swift in Sources */,
|
||||
|
@ -3141,7 +3102,6 @@
|
|||
F8177025248ED4DE00AA3600 /* Libre1DerivedAlgorithmParameters.swift in Sources */,
|
||||
F808592D23677D6A00F3829D /* ChartPoint.swift in Sources */,
|
||||
F8F9722823A5915900C3F17D /* BluconUtilities.swift in Sources */,
|
||||
F8177027248ED57000AA3600 /* LibreRawGlucoseOOPA2Data.swift in Sources */,
|
||||
F8F9724723A69A8000C3F17D /* BluetoothPeripheralCategory.swift in Sources */,
|
||||
F8B3A79522635A25004BA588 /* AlertType+CoreDataProperties.swift in Sources */,
|
||||
F8AF11FA24B1FB3500AE5BA2 /* DexcomError.swift in Sources */,
|
||||
|
@ -3157,14 +3117,11 @@
|
|||
F897E25323FC871C0075E0E8 /* BluetoothPeripheralManager+WatlaaBluetoothTransmitterDelegate.swift in Sources */,
|
||||
F81D6D5222C27F18005EFAE2 /* BgReading+DexcomShare.swift in Sources */,
|
||||
F8F9723023A5915900C3F17D /* M5StackUtilities.swift in Sources */,
|
||||
F82436FA24BDFA5E00BED341 /* LibreReCalibrator.swift in Sources */,
|
||||
F89467F0249FFF5900F18424 /* LibreRawGlucoseOOPGlucose.swift in Sources */,
|
||||
F8297F52238ECA3200D74D66 /* BluetoothPeripheralViewController.swift in Sources */,
|
||||
F816E1312439E2DD009EE65B /* DexcomG4BluetoothPeripheralViewModel.swift in Sources */,
|
||||
F821CF66229EE68B005C1E43 /* NightScoutFollowManager.swift in Sources */,
|
||||
F8F9722423A5915900C3F17D /* LibreMeasurement.swift in Sources */,
|
||||
F869188C23A044340065B607 /* TextsM5StackView.swift in Sources */,
|
||||
F8F9721F23A5915900C3F17D /* LibreOOPClient.swift in Sources */,
|
||||
F8F9722D23A5915900C3F17D /* M5StackBluetoothTransmitter.swift in Sources */,
|
||||
F808D2C8240323CA0084B5DB /* BubbleBluetoothPeripheralViewModel.swift in Sources */,
|
||||
F8E6C79024CEC22A007C1199 /* TextsSnooze.swift in Sources */,
|
||||
|
@ -3191,7 +3148,6 @@
|
|||
F821CF5E229BF43A005C1E43 /* BgReading+NightScout.swift in Sources */,
|
||||
F8A389EB233175A10010F405 /* SettingsViewM5StackSettingsViewModel.swift in Sources */,
|
||||
F816E1242439DB63009EE65B /* DexcomG4+BluetoothPeripheral.swift in Sources */,
|
||||
F8AF11F124B11FD400AE5BA2 /* LibreOOPWebError.swift in Sources */,
|
||||
F8E5404C2522624800052CE5 /* ConstantsHousekeeping.swift in Sources */,
|
||||
F8AF120124B9082000AE5BA2 /* Calibration+NightScout.swift in Sources */,
|
||||
F808D2D2240329E80084B5DB /* Bubble+BluetoothPeripheral.swift in Sources */,
|
||||
|
|
|
@ -8,8 +8,4 @@ extension DexcomG4: BluetoothPeripheral {
|
|||
|
||||
}
|
||||
|
||||
func overrideNeedsOOPWeb() -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,8 +8,4 @@ extension DexcomG5: BluetoothPeripheral {
|
|||
|
||||
}
|
||||
|
||||
func overrideNeedsOOPWeb() -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,8 +8,4 @@ extension Blucon: BluetoothPeripheral {
|
|||
|
||||
}
|
||||
|
||||
func overrideNeedsOOPWeb() -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,8 +10,4 @@ extension BlueReader: BluetoothPeripheral {
|
|||
|
||||
}
|
||||
|
||||
func overrideNeedsOOPWeb() -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,21 +8,4 @@ extension Bubble: BluetoothPeripheral {
|
|||
|
||||
}
|
||||
|
||||
func overrideNeedsOOPWeb() -> Bool {
|
||||
|
||||
// bubble does decryption for libre2 and libreus
|
||||
if let libreSensorType = blePeripheral.libreSensorType {
|
||||
|
||||
if libreSensorType == .libre2 || libreSensorType == .libreUS {
|
||||
|
||||
return true
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,8 +9,4 @@ extension Droplet: BluetoothPeripheral {
|
|||
|
||||
}
|
||||
|
||||
func overrideNeedsOOPWeb() -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,8 +8,4 @@ extension GNSEntry: BluetoothPeripheral {
|
|||
|
||||
}
|
||||
|
||||
func overrideNeedsOOPWeb() -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,10 +6,4 @@ extension Libre2: BluetoothPeripheral {
|
|||
return .Libre2Type
|
||||
}
|
||||
|
||||
func overrideNeedsOOPWeb() -> Bool {
|
||||
// for Libre 2 we decrypt the data, so the data will be processed as Libre 1, means user can choose to use oop web or not for defining slope parameters
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -8,21 +8,4 @@ extension MiaoMiao: BluetoothPeripheral {
|
|||
|
||||
}
|
||||
|
||||
func overrideNeedsOOPWeb() -> Bool {
|
||||
|
||||
// mm does decryption for libre2 and libreus
|
||||
if let libreSensorType = blePeripheral.libreSensorType {
|
||||
|
||||
if libreSensorType == .libre2 || libreSensorType == .libreUS {
|
||||
|
||||
return true
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,10 +11,5 @@ protocol BluetoothPeripheral {
|
|||
/// a blePeripheral
|
||||
var blePeripheral: BLEPeripheral {get}
|
||||
|
||||
/// for libre sensor. LibreSensortype may require oop web (ie needsWebOOP returns true), but if transmitter supports decryption (to Libre 1 format), then user could still decide not to use oop web and do self calibration. So if the transmitter type (which matches a bluetooth peripheral type) supports decryption, then this value will return true in which case user should be able to enable/disable oopweb himself, meaning this overrides "needsOopWeb", it's the user that decides
|
||||
///
|
||||
/// in the end maybe the funcions needsWebOOP and overrideNeedsWebOOP can be completely removed
|
||||
func overrideNeedsOOPWeb() -> Bool
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,4 @@ extension M5Stack: BluetoothPeripheral {
|
|||
return .M5StackType
|
||||
}
|
||||
|
||||
func overrideNeedsOOPWeb() -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,8 +6,4 @@ extension Watlaa: BluetoothPeripheral {
|
|||
return .WatlaaType
|
||||
}
|
||||
|
||||
func overrideNeedsOOPWeb() -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -531,10 +531,6 @@ class CGMG5Transmitter:BluetoothTransmitter, CGMTransmitter {
|
|||
func setWebOOPEnabled(enabled: Bool) {
|
||||
}
|
||||
|
||||
func setWebOOPSite(oopWebSite: String) {}
|
||||
|
||||
func setWebOOPToken(oopWebToken: String) {}
|
||||
|
||||
func cgmTransmitterType() -> CGMTransmitterType {
|
||||
return .dexcomG5
|
||||
}
|
||||
|
|
|
@ -22,16 +22,6 @@ protocol CGMTransmitter:AnyObject {
|
|||
/// is the CGMTransmitter web oop enabled or not
|
||||
func isWebOOPEnabled() -> Bool
|
||||
|
||||
/// to set oopWebSite and
|
||||
///
|
||||
/// for transmitters that don't support webOOP, there's no need to implemented this function
|
||||
/// --- for transmitters that support webOOP (Bubble, MiaoMiao, ..) this should be implemented
|
||||
func setWebOOPSite(oopWebSite: String)
|
||||
|
||||
/// for transmitters that don't support webOOP, there's no need to implemented this function
|
||||
/// --- for transmitters that support webOOP (Bubble, MiaoMiao, ..) this should be implemented
|
||||
func setWebOOPToken(oopWebToken: String)
|
||||
|
||||
/// get cgmTransmitterType
|
||||
func cgmTransmitterType() -> CGMTransmitterType
|
||||
|
||||
|
|
|
@ -131,10 +131,6 @@ class CGMBlueReaderTransmitter:BluetoothTransmitter, CGMTransmitter {
|
|||
/// this transmitter does not support oopWeb
|
||||
func setWebOOPEnabled(enabled: Bool) {}
|
||||
|
||||
func setWebOOPSite(oopWebSite: String) {}
|
||||
|
||||
func setWebOOPToken(oopWebToken: String) {}
|
||||
|
||||
func cgmTransmitterType() -> CGMTransmitterType {
|
||||
return .blueReader
|
||||
}
|
||||
|
|
|
@ -53,12 +53,6 @@ class CGMBubbleTransmitter:BluetoothTransmitter, CGMTransmitter {
|
|||
/// gives information about type of sensor (Libre1, Libre2, etc..)
|
||||
private var patchInfo: String?
|
||||
|
||||
/// oop website url to use in case oop web would be enabled
|
||||
private var oopWebSite: String
|
||||
|
||||
/// oop token to use in case oop web would be enabled
|
||||
private var oopWebToken: String
|
||||
|
||||
/// bubble firmware version
|
||||
private var firmware: String?
|
||||
|
||||
|
@ -72,12 +66,10 @@ class CGMBubbleTransmitter:BluetoothTransmitter, CGMTransmitter {
|
|||
/// - name : if already connected before, then give here the name that was received during previous connect, if not give nil
|
||||
/// - delegate : CGMTransmitterDelegate intance
|
||||
/// - webOOPEnabled : enabled or not, if nil then default false
|
||||
/// - oopWebSite : oop web site url to use, only used in case webOOPEnabled = true, if nil then default value is used (see Constants)
|
||||
/// - oopWebToken : oop web token to use, only used in case webOOPEnabled = true, if nil then default value is used (see Constants)
|
||||
/// - bluetoothTransmitterDelegate : a BluetoothTransmitterDelegate
|
||||
/// - cGMTransmitterDelegate : a CGMTransmitterDelegate
|
||||
/// - cGMBubbleTransmitterDelegate : a CGMBubbleTransmitterDelegate
|
||||
init(address:String?, name: String?, bluetoothTransmitterDelegate: BluetoothTransmitterDelegate, cGMBubbleTransmitterDelegate: CGMBubbleTransmitterDelegate, cGMTransmitterDelegate:CGMTransmitterDelegate, sensorSerialNumber:String?, webOOPEnabled: Bool?, oopWebSite: String?, oopWebToken: String?, nonFixedSlopeEnabled: Bool?) {
|
||||
init(address:String?, name: String?, bluetoothTransmitterDelegate: BluetoothTransmitterDelegate, cGMBubbleTransmitterDelegate: CGMBubbleTransmitterDelegate, cGMTransmitterDelegate:CGMTransmitterDelegate, sensorSerialNumber:String?, webOOPEnabled: Bool?, nonFixedSlopeEnabled: Bool?) {
|
||||
|
||||
// assign addressname and name or expected devicename
|
||||
var newAddressAndName:BluetoothTransmitter.DeviceAddressAndName = BluetoothTransmitter.DeviceAddressAndName.notYetConnected(expectedName: expectedDeviceNameBubble)
|
||||
|
@ -104,10 +96,6 @@ class CGMBubbleTransmitter:BluetoothTransmitter, CGMTransmitter {
|
|||
// initialize webOOPEnabled
|
||||
self.webOOPEnabled = webOOPEnabled ?? false
|
||||
|
||||
// initialize oopWebToken and oopWebSite
|
||||
self.oopWebToken = oopWebToken ?? ConstantsLibre.token
|
||||
self.oopWebSite = oopWebSite ?? ConstantsLibre.site
|
||||
|
||||
// initiliaze LibreDataParser
|
||||
self.libreDataParser = LibreDataParser()
|
||||
|
||||
|
@ -262,7 +250,7 @@ class CGMBubbleTransmitter:BluetoothTransmitter, CGMTransmitter {
|
|||
|
||||
}
|
||||
|
||||
libreDataParser.libreDataProcessor(libreSensorSerialNumber: libreSensorSerialNumber, patchInfo: patchInfo, webOOPEnabled: webOOPEnabled, oopWebSite: oopWebSite, oopWebToken: oopWebToken, libreData: (rxBuffer.subdata(in: bubbleHeaderLength..<(344 + bubbleHeaderLength))), cgmTransmitterDelegate: cgmTransmitterDelegate, dataIsDecryptedToLibre1Format: dataIsDecryptedToLibre1Format, testTimeStamp: nil) { (sensorState: LibreSensorState?, xDripError: XdripError?) in
|
||||
libreDataParser.libreDataProcessor(libreSensorSerialNumber: libreSensorSerialNumber, patchInfo: patchInfo, webOOPEnabled: webOOPEnabled, libreData: (rxBuffer.subdata(in: bubbleHeaderLength..<(344 + bubbleHeaderLength))), cgmTransmitterDelegate: cgmTransmitterDelegate, dataIsDecryptedToLibre1Format: dataIsDecryptedToLibre1Format, testTimeStamp: nil) { (sensorState: LibreSensorState?, xDripError: XdripError?) in
|
||||
|
||||
if let sensorState = sensorState {
|
||||
self.cGMBubbleTransmitterDelegate?.received(sensorStatus: sensorState, from: self)
|
||||
|
@ -325,14 +313,6 @@ class CGMBubbleTransmitter:BluetoothTransmitter, CGMTransmitter {
|
|||
|
||||
}
|
||||
|
||||
func setWebOOPSite(oopWebSite: String) {
|
||||
self.oopWebSite = oopWebSite
|
||||
}
|
||||
|
||||
func setWebOOPToken(oopWebToken: String) {
|
||||
self.oopWebToken = oopWebToken
|
||||
}
|
||||
|
||||
func cgmTransmitterType() -> CGMTransmitterType {
|
||||
return .Bubble
|
||||
}
|
||||
|
|
|
@ -136,10 +136,6 @@ class CGMDroplet1Transmitter:BluetoothTransmitter, CGMTransmitter {
|
|||
func setWebOOPEnabled(enabled: Bool) {
|
||||
}
|
||||
|
||||
func setWebOOPSite(oopWebSite: String) {}
|
||||
|
||||
func setWebOOPToken(oopWebToken: String) {}
|
||||
|
||||
func cgmTransmitterType() -> CGMTransmitterType {
|
||||
return .Droplet1
|
||||
}
|
||||
|
|
|
@ -246,10 +246,6 @@ class CGMGNSEntryTransmitter:BluetoothTransmitter, CGMTransmitter {
|
|||
nonFixedSlopeEnabled = enabled
|
||||
}
|
||||
|
||||
func setWebOOPSite(oopWebSite: String) {}
|
||||
|
||||
func setWebOOPToken(oopWebToken: String) {}
|
||||
|
||||
func cgmTransmitterType() -> CGMTransmitterType {
|
||||
return .GNSentry
|
||||
}
|
||||
|
|
|
@ -303,10 +303,6 @@ class CGMLibre2Transmitter:BluetoothTransmitter, CGMTransmitter {
|
|||
|
||||
}
|
||||
|
||||
func setWebOOPSite(oopWebSite: String) {/*not used*/}
|
||||
|
||||
func setWebOOPToken(oopWebToken: String) {/*not used*/}
|
||||
|
||||
func cgmTransmitterType() -> CGMTransmitterType {
|
||||
return .Libre2
|
||||
}
|
||||
|
|
|
@ -49,12 +49,6 @@ class CGMMiaoMiaoTransmitter:BluetoothTransmitter, CGMTransmitter {
|
|||
/// is nonFixed enabled for the transmitter or not
|
||||
private var nonFixedSlopeEnabled: Bool
|
||||
|
||||
/// oop website url to use in case oop web would be enabled
|
||||
private var oopWebSite: String
|
||||
|
||||
/// oop token to use in case oop web would be enabled
|
||||
private var oopWebToken: String
|
||||
|
||||
// current sensor serial number, if nil then it's not known yet
|
||||
private var sensorSerialNumber:String?
|
||||
|
||||
|
@ -69,12 +63,10 @@ class CGMMiaoMiaoTransmitter:BluetoothTransmitter, CGMTransmitter {
|
|||
/// - address: if already connected before, then give here the address that was received during previous connect, if not give nil
|
||||
/// - name : if already connected before, then give here the name that was received during previous connect, if not give nil
|
||||
/// - webOOPEnabled : enabled or not
|
||||
/// - oopWebSite : oop web site url to use, only used in case webOOPEnabled = true
|
||||
/// - oopWebToken : oop web token to use, only used in case webOOPEnabled = true
|
||||
/// - bluetoothTransmitterDelegate : a BluetoothTransmitterDelegate
|
||||
/// - cGMTransmitterDelegate : a CGMTransmitterDelegate
|
||||
/// - cGMMiaoMiaoTransmitterDelegate : a CGMMiaoMiaoTransmitterDelegate
|
||||
init(address:String?, name: String?, bluetoothTransmitterDelegate: BluetoothTransmitterDelegate, cGMMiaoMiaoTransmitterDelegate : CGMMiaoMiaoTransmitterDelegate, cGMTransmitterDelegate:CGMTransmitterDelegate, sensorSerialNumber:String?, webOOPEnabled: Bool?, oopWebSite: String?, oopWebToken: String?, nonFixedSlopeEnabled: Bool?) {
|
||||
init(address:String?, name: String?, bluetoothTransmitterDelegate: BluetoothTransmitterDelegate, cGMMiaoMiaoTransmitterDelegate : CGMMiaoMiaoTransmitterDelegate, cGMTransmitterDelegate:CGMTransmitterDelegate, sensorSerialNumber:String?, webOOPEnabled: Bool?, nonFixedSlopeEnabled: Bool?) {
|
||||
|
||||
// assign addressname and name or expected devicename
|
||||
var newAddressAndName:BluetoothTransmitter.DeviceAddressAndName = BluetoothTransmitter.DeviceAddressAndName.notYetConnected(expectedName: expectedDeviceNameMiaoMiao)
|
||||
|
@ -98,10 +90,6 @@ class CGMMiaoMiaoTransmitter:BluetoothTransmitter, CGMTransmitter {
|
|||
// initialize webOOPEnabled
|
||||
self.webOOPEnabled = webOOPEnabled ?? false
|
||||
|
||||
// initialize oopWebToken and oopWebSite
|
||||
self.oopWebToken = oopWebToken ?? ConstantsLibre.token
|
||||
self.oopWebSite = oopWebSite ?? ConstantsLibre.site
|
||||
|
||||
// initialize nonFixedSlopeEnabled
|
||||
self.nonFixedSlopeEnabled = nonFixedSlopeEnabled ?? false
|
||||
|
||||
|
@ -240,7 +228,7 @@ class CGMMiaoMiaoTransmitter:BluetoothTransmitter, CGMTransmitter {
|
|||
|
||||
}
|
||||
|
||||
libreDataParser.libreDataProcessor(libreSensorSerialNumber: LibreSensorSerialNumber(withUID: Data(rxBuffer.subdata(in: 5..<13))), patchInfo: patchInfo, webOOPEnabled: webOOPEnabled, oopWebSite: oopWebSite, oopWebToken: oopWebToken, libreData: (rxBuffer.subdata(in: miaoMiaoHeaderLength..<(344 + miaoMiaoHeaderLength))), cgmTransmitterDelegate: cgmTransmitterDelegate, dataIsDecryptedToLibre1Format: dataIsDecryptedToLibre1Format, testTimeStamp: nil, completionHandler: { (sensorState: LibreSensorState?, xDripError: XdripError?) in
|
||||
libreDataParser.libreDataProcessor(libreSensorSerialNumber: LibreSensorSerialNumber(withUID: Data(rxBuffer.subdata(in: 5..<13))), patchInfo: patchInfo, webOOPEnabled: webOOPEnabled, libreData: (rxBuffer.subdata(in: miaoMiaoHeaderLength..<(344 + miaoMiaoHeaderLength))), cgmTransmitterDelegate: cgmTransmitterDelegate, dataIsDecryptedToLibre1Format: dataIsDecryptedToLibre1Format, testTimeStamp: nil, completionHandler: { (sensorState: LibreSensorState?, xDripError: XdripError?) in
|
||||
|
||||
if let sensorState = sensorState {
|
||||
self.cGMMiaoMiaoTransmitterDelegate?.received(sensorStatus: sensorState, from: self)
|
||||
|
@ -326,14 +314,6 @@ class CGMMiaoMiaoTransmitter:BluetoothTransmitter, CGMTransmitter {
|
|||
return nonFixedSlopeEnabled
|
||||
}
|
||||
|
||||
func setWebOOPSite(oopWebSite: String) {
|
||||
self.oopWebSite = oopWebSite
|
||||
}
|
||||
|
||||
func setWebOOPToken(oopWebToken: String) {
|
||||
self.oopWebToken = oopWebToken
|
||||
}
|
||||
|
||||
func requestNewReading() {
|
||||
_ = sendStartReadingCommand()
|
||||
}
|
||||
|
@ -513,7 +493,7 @@ class CGMMiaoMiaoTransmitter:BluetoothTransmitter, CGMTransmitter {
|
|||
|
||||
}
|
||||
|
||||
libreDataParser.libreDataProcessor(libreSensorSerialNumber: LibreSensorSerialNumber(withUID: Data(rxBuffer.subdata(in: 5..<13))), patchInfo: patchInfo, webOOPEnabled: true, oopWebSite: ConstantsLibre.site, oopWebToken: ConstantsLibre.token, libreData: (rxBuffer.subdata(in: miaoMiaoHeaderLength..<(344 + miaoMiaoHeaderLength))), cgmTransmitterDelegate: cGMTransmitterDelegate, dataIsDecryptedToLibre1Format: dataIsDecryptedToLibre1Format, testTimeStamp: testTimeStamp, completionHandler: { (sensorState: LibreSensorState?, xDripError: XdripError?) in
|
||||
libreDataParser.libreDataProcessor(libreSensorSerialNumber: LibreSensorSerialNumber(withUID: Data(rxBuffer.subdata(in: 5..<13))), patchInfo: patchInfo, webOOPEnabled: true, libreData: (rxBuffer.subdata(in: miaoMiaoHeaderLength..<(344 + miaoMiaoHeaderLength))), cgmTransmitterDelegate: cGMTransmitterDelegate, dataIsDecryptedToLibre1Format: dataIsDecryptedToLibre1Format, testTimeStamp: testTimeStamp, completionHandler: { (sensorState: LibreSensorState?, xDripError: XdripError?) in
|
||||
|
||||
})
|
||||
|
||||
|
|
|
@ -179,13 +179,11 @@ class LibreDataParser {
|
|||
/// - patchInfo : will be used by server to out the glucose data, corresponds to type of sensor. Nil if not known which is used for Bubble or MM older firmware versions and also Watlaa
|
||||
/// - libreData : the 344 bytes from Libre sensor
|
||||
/// - webOOPEnabled : is webOOP enabled or not, if not enabled, local parsing is used. This can only be the case for Libre1
|
||||
/// - oopWebSite : the site url to use if oop web would be enabled
|
||||
/// - oopWebToken : the token to use if oop web would be enabled
|
||||
/// - cgmTransmitterDelegate : the cgmTransmitterDelegate, will be used to send the resultin glucose data and sensorTime (function cgmTransmitterInfoReceived)
|
||||
/// - testTimeStamp : if set, then the most recent reading will get this timestamp
|
||||
/// - dataIsDecryptedToLibre1Format : example if transmitter is Libre 2, data is already decrypted to Libre 1 format
|
||||
/// - completionHandler : called with sensorState and xDripError
|
||||
public func libreDataProcessor(libreSensorSerialNumber: LibreSensorSerialNumber?, patchInfo: String?, webOOPEnabled: Bool, oopWebSite: String?, oopWebToken: String?, libreData: Data, cgmTransmitterDelegate : CGMTransmitterDelegate?, dataIsDecryptedToLibre1Format: Bool, testTimeStamp: Date?, completionHandler:@escaping ((_ sensorState: LibreSensorState?, _ xDripError: XdripError?) -> ())) {
|
||||
public func libreDataProcessor(libreSensorSerialNumber: LibreSensorSerialNumber?, patchInfo: String?, webOOPEnabled: Bool, libreData: Data, cgmTransmitterDelegate : CGMTransmitterDelegate?, dataIsDecryptedToLibre1Format: Bool, testTimeStamp: Date?, completionHandler:@escaping ((_ sensorState: LibreSensorState?, _ xDripError: XdripError?) -> ())) {
|
||||
|
||||
// get libreSensorType, if this fails then it must be an unknown Libre sensor type in which case we don't proceed
|
||||
guard let libreSensorType = LibreSensorType.type(patchInfo: patchInfo) else {
|
||||
|
@ -203,13 +201,13 @@ class LibreDataParser {
|
|||
|
||||
trace("in libreDataProcessor, sensortype = %{public}@", log: log, category: ConstantsLog.categoryLibreDataParser, type: .info, libreSensorType.description)
|
||||
|
||||
// let's see if we must use webOOP (if webOOPEnabled is true) and if so if we have all required info (libreSensorSerialNumber, oopWebSite and oopWebToken)
|
||||
if let libreSensorSerialNumber = libreSensorSerialNumber, let oopWebSite = oopWebSite, let oopWebToken = oopWebToken, webOOPEnabled {
|
||||
// let's see if we must use webOOP (if webOOPEnabled is true) and if so if we have all required info (libreSensorSerialNumber)
|
||||
if let libreSensorSerialNumber = libreSensorSerialNumber, webOOPEnabled {
|
||||
|
||||
// if data is already decrypted then process the data as if it were a libre1 sensor type
|
||||
if dataIsDecryptedToLibre1Format {
|
||||
|
||||
libre1DataProcessor(libreSensorSerialNumber: libreSensorSerialNumber, libreSensorType: libreSensorType, libreData: libreData, cgmTransmitterDelegate: cgmTransmitterDelegate, oopWebSite: oopWebSite, oopWebToken: oopWebToken, testTimeStamp: testTimeStamp, completionHandler: completionHandler)
|
||||
libre1DataProcessor(libreSensorSerialNumber: libreSensorSerialNumber, libreSensorType: libreSensorType, libreData: libreData, cgmTransmitterDelegate: cgmTransmitterDelegate, testTimeStamp: testTimeStamp, completionHandler: completionHandler)
|
||||
|
||||
return
|
||||
|
||||
|
@ -219,68 +217,20 @@ class LibreDataParser {
|
|||
|
||||
case .libre1A2, .libre1, .libreProH:// these types are all Libre 1
|
||||
|
||||
libre1DataProcessor(libreSensorSerialNumber: libreSensorSerialNumber, libreSensorType: libreSensorType, libreData: libreData, cgmTransmitterDelegate: cgmTransmitterDelegate, oopWebSite: oopWebSite, oopWebToken: oopWebToken, testTimeStamp: testTimeStamp, completionHandler: completionHandler)
|
||||
libre1DataProcessor(libreSensorSerialNumber: libreSensorSerialNumber, libreSensorType: libreSensorType, libreData: libreData, cgmTransmitterDelegate: cgmTransmitterDelegate, testTimeStamp: testTimeStamp, completionHandler: completionHandler)
|
||||
|
||||
case .libreUS:// not sure if this works for libreUS
|
||||
|
||||
// libreUS isn't working yet, create an error and send to delegate
|
||||
cgmTransmitterDelegate?.errorOccurred(xDripError: LibreOOPWebError.libreUSNotSupported)
|
||||
|
||||
// continue anyway, although this will not work
|
||||
LibreOOPClient.getLibreRawGlucoseOOPOA2Data(libreData: libreData, oopWebSite: oopWebSite) { [self] (libreRawGlucoseOOPA2Data, xDripError) in
|
||||
|
||||
if let libreRawGlucoseOOPA2Data = libreRawGlucoseOOPA2Data as? LibreRawGlucoseOOPA2Data {
|
||||
|
||||
// if debug level logging enabled, than add full dump of libreRawGlucoseOOPA2Data in the trace (checking here to save some processing time if it's not needed
|
||||
if UserDefaults.standard.addDebugLevelLogsInTraceFileAndNSLog {
|
||||
trace("in libreDataProcessor, received libreRawGlucoseOOPA2Data = %{public}@", log: log, category: ConstantsLog.categoryLibreDataParser, type: .debug, libreRawGlucoseOOPA2Data.description)
|
||||
|
||||
}
|
||||
|
||||
// convert libreRawGlucoseOOPA2Data to (libreRawGlucoseData:[GlucoseData], sensorState:LibreSensorState, sensorTimeInMinutes:Int?)
|
||||
let parsedResult = libreRawGlucoseOOPA2Data.glucoseData()
|
||||
|
||||
self.handleGlucoseData(result: (parsedResult.libreRawGlucoseData.map { $0 as GlucoseData }, parsedResult.sensorTimeInMinutes, parsedResult.sensorState, xDripError), cgmTransmitterDelegate: cgmTransmitterDelegate, libreSensorSerialNumber: libreSensorSerialNumber, completionHandler: completionHandler)
|
||||
|
||||
} else {
|
||||
|
||||
// libreRawGlucoseOOPA2Data is nil, but possibly xDripError is not nil, so need to call handleGlucoseData which will process xDripError
|
||||
self.handleGlucoseData(result: ([GlucoseData](), nil, nil, xDripError), cgmTransmitterDelegate: cgmTransmitterDelegate, libreSensorSerialNumber: libreSensorSerialNumber, completionHandler: completionHandler)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// should never come here ?
|
||||
trace("in libreDataProcessor, is libreUS but data is not decrypted - no further processing", log: log, category: ConstantsLog.categoryLibreDataParser, type: .info)
|
||||
|
||||
case .libre2:
|
||||
|
||||
// patchInfo must be non nil to handle libre 2
|
||||
guard let patchInfo = patchInfo else {
|
||||
trace("in libreDataProcessor, handling libre 2 but patchInfo is nil", log: log, category: ConstantsLog.categoryLibreDataParser, type: .info)
|
||||
return
|
||||
}
|
||||
|
||||
LibreOOPClient.getLibreRawGlucoseOOPData(libreData: libreData, libreSensorSerialNumber: libreSensorSerialNumber, patchInfo: patchInfo, oopWebSite: oopWebSite, oopWebToken: oopWebToken) { (libreRawGlucoseOOPData, xDripError) in
|
||||
|
||||
if let libreRawGlucoseOOPData = libreRawGlucoseOOPData as? LibreRawGlucoseOOPData {
|
||||
|
||||
// if debug level logging enabled, than add full dump of libreRawGlucoseOOPA2Data in the trace (checking here to save some processing time if it's not needed
|
||||
if UserDefaults.standard.addDebugLevelLogsInTraceFileAndNSLog {
|
||||
trace("in libreDataProcessor, received libreRawGlucoseOOPData = %{public}@", log: log, category: ConstantsLog.categoryLibreDataParser, type: .debug, libreRawGlucoseOOPData.description)
|
||||
}
|
||||
|
||||
// convert libreRawGlucoseOOPData to (libreRawGlucoseData:[GlucoseData], sensorState:LibreSensorState, sensorTimeInMinutes:Int?)
|
||||
let parsedResult = libreRawGlucoseOOPData.glucoseData()
|
||||
|
||||
self.handleGlucoseData(result: (parsedResult.libreRawGlucoseData.map { $0 as GlucoseData }, parsedResult.sensorTimeInMinutes, parsedResult.sensorState, xDripError), cgmTransmitterDelegate: cgmTransmitterDelegate, libreSensorSerialNumber: libreSensorSerialNumber, completionHandler: completionHandler)
|
||||
|
||||
} else {
|
||||
|
||||
// libreRawGlucoseOOPData is nil, but possibly xDripError is not nil, so need to call handleGlucoseData which will process xDripError
|
||||
self.handleGlucoseData(result: ([GlucoseData](), nil, nil, xDripError), cgmTransmitterDelegate: cgmTransmitterDelegate, libreSensorSerialNumber: libreSensorSerialNumber, completionHandler: completionHandler)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// should never come here ?
|
||||
trace("in libreDataProcessor, is libre2 but data is not decrypted - no further processing", log: log, category: ConstantsLog.categoryLibreDataParser, type: .info)
|
||||
|
||||
}
|
||||
|
||||
|
@ -310,7 +260,7 @@ class LibreDataParser {
|
|||
/// - parameters:
|
||||
/// - libreData : either Libre 1 data or decrypted Libre 2 data
|
||||
/// - testTimeStamp : if set, then the most recent reading will get this timestamp
|
||||
private func libre1DataProcessor(libreSensorSerialNumber: LibreSensorSerialNumber, libreSensorType: LibreSensorType, libreData: Data, cgmTransmitterDelegate: CGMTransmitterDelegate?, oopWebSite: String, oopWebToken: String, testTimeStamp: Date?, completionHandler:@escaping ((_ sensorState: LibreSensorState?, _ xDripError: XdripError?) -> ())) {
|
||||
private func libre1DataProcessor(libreSensorSerialNumber: LibreSensorSerialNumber, libreSensorType: LibreSensorType, libreData: Data, cgmTransmitterDelegate: CGMTransmitterDelegate?, testTimeStamp: Date?, completionHandler:@escaping ((_ sensorState: LibreSensorState?, _ xDripError: XdripError?) -> ())) {
|
||||
|
||||
// if libre1DerivedAlgorithmParameters not nil, but not matching serial number, then assign to nil
|
||||
if let libre1DerivedAlgorithmParameters = UserDefaults.standard.libre1DerivedAlgorithmParameters, libre1DerivedAlgorithmParameters.serialNumber != libreSensorSerialNumber.serialNumber {
|
||||
|
@ -326,66 +276,24 @@ class LibreDataParser {
|
|||
|
||||
}
|
||||
|
||||
// If the values are already available in userdefaults , then use those values
|
||||
if let libre1DerivedAlgorithmParameters = UserDefaults.standard.libre1DerivedAlgorithmParameters, libre1DerivedAlgorithmParameters.serialNumber == libreSensorSerialNumber.serialNumber {
|
||||
|
||||
// only for libre1 en libre1A2 : in some cases libre1DerivedAlgorithmParameters is stored wiht slope_slope = 0, this doesn't work, reset the userdefaults to nil. The parameters will be fetched again from OOP Web
|
||||
// for libre1A2 : this check on slope_slope = 0 has been removed some time ago, with commit b8d5b0dea77b098a1c9d88e410f485b7b17b8fd7, so solve issues with libre1A2, so it looks as if b8d5b0dea77b098a1c9d88e410f485b7b17b8fd7 should be undone
|
||||
// checking on slope_slope should have the same result, ie it's an invalid libre1DerivedAlgorithmParameters
|
||||
if (libreSensorType == .libre1 || libreSensorType == .libre1A2) && libre1DerivedAlgorithmParameters.slope_slope == 0 {
|
||||
|
||||
UserDefaults.standard.libre1DerivedAlgorithmParameters = nil
|
||||
|
||||
} else {
|
||||
|
||||
trace("in libreDataProcessor, found libre1DerivedAlgorithmParameters in UserDefaults", log: log, category: ConstantsLog.categoryLibreDataParser, type: .info)
|
||||
|
||||
// if debug level logging enabled, than add full dump of libre1DerivedAlgorithmParameters in the trace (checking here to save some processing time if it's not needed
|
||||
if UserDefaults.standard.addDebugLevelLogsInTraceFileAndNSLog {
|
||||
trace("in libreDataProcessor, libre1DerivedAlgorithmParameters = %{public}@", log: log, category: ConstantsLog.categoryLibreDataParser, type: .debug, libre1DerivedAlgorithmParameters.description)
|
||||
}
|
||||
|
||||
let parsedLibre1Data = parseLibre1Data(libreData: libreData, libre1DerivedAlgorithmParameters: libre1DerivedAlgorithmParameters, testTimeStamp: testTimeStamp)
|
||||
|
||||
// handle the result
|
||||
handleGlucoseData(result: (parsedLibre1Data.glucoseData, parsedLibre1Data.sensorTimeInMinutes, parsedLibre1Data.sensorState, nil), cgmTransmitterDelegate: cgmTransmitterDelegate, libreSensorSerialNumber: libreSensorSerialNumber, completionHandler: completionHandler)
|
||||
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
// unwrap libre1DerivedAlgorithmParameters, should be non nil because they've just been calculated
|
||||
guard let libre1DerivedAlgorithmParameters = UserDefaults.standard.libre1DerivedAlgorithmParameters else {return}
|
||||
|
||||
|
||||
trace("in libreDataProcessor, found libre1DerivedAlgorithmParameters in UserDefaults", log: log, category: ConstantsLog.categoryLibreDataParser, type: .info)
|
||||
|
||||
// if debug level logging enabled, than add full dump of libre1DerivedAlgorithmParameters in the trace (checking here to save some processing time if it's not needed
|
||||
if UserDefaults.standard.addDebugLevelLogsInTraceFileAndNSLog {
|
||||
trace("in libreDataProcessor, libre1DerivedAlgorithmParameters = %{public}@", log: log, category: ConstantsLog.categoryLibreDataParser, type: .debug, libre1DerivedAlgorithmParameters.description)
|
||||
}
|
||||
|
||||
// get LibreDerivedAlgorithmParameters and parse using the libre1DerivedAlgorithmParameters
|
||||
LibreOOPClient.getOopWebCalibrationStatus(bytes: libreData, libreSensorSerialNumber: libreSensorSerialNumber, oopWebSite: oopWebSite, oopWebToken: oopWebToken) { (oopWebCalibrationStatus, xDripError) in
|
||||
|
||||
if let oopWebCalibrationStatus = oopWebCalibrationStatus as? OopWebCalibrationStatus,
|
||||
let slope = oopWebCalibrationStatus.slope {
|
||||
|
||||
let libre1DerivedAlgorithmParameters = Libre1DerivedAlgorithmParameters(slope_slope: slope.slopeSlope ?? 0, slope_offset: slope.slopeOffset ?? 0, offset_slope: slope.offsetSlope ?? 0, offset_offset: slope.offsetOffset ?? 0, isValidForFooterWithReverseCRCs: Int(slope.isValidForFooterWithReverseCRCs ?? 1), extraSlope: 1.0, extraOffset: 0.0, sensorSerialNumber: libreSensorSerialNumber.serialNumber)
|
||||
|
||||
// store result in UserDefaults, next time, server will not be used anymore, we will use the stored value
|
||||
UserDefaults.standard.libre1DerivedAlgorithmParameters = libre1DerivedAlgorithmParameters
|
||||
|
||||
// if debug level logging enabled, than add full dump of libre1DerivedAlgorithmParameters in the trace (checking here to save some processing time if it's not needed
|
||||
if UserDefaults.standard.addDebugLevelLogsInTraceFileAndNSLog {
|
||||
trace("in libreDataProcessor, received libre1DerivedAlgorithmParameters = %{public}@", log: log, category: ConstantsLog.categoryLibreDataParser, type: .debug, libre1DerivedAlgorithmParameters.description)
|
||||
}
|
||||
|
||||
let parsedLibre1Data = self.parseLibre1Data(libreData: libreData, libre1DerivedAlgorithmParameters: UserDefaults.standard.libre1DerivedAlgorithmParameters, testTimeStamp: testTimeStamp)
|
||||
|
||||
// handle the result
|
||||
self.handleGlucoseData(result: (parsedLibre1Data.glucoseData, parsedLibre1Data.sensorTimeInMinutes, parsedLibre1Data.sensorState, nil), cgmTransmitterDelegate: cgmTransmitterDelegate, libreSensorSerialNumber: libreSensorSerialNumber, completionHandler: completionHandler)
|
||||
|
||||
} else {
|
||||
|
||||
// libre1DerivedAlgorithmParameters not created, but possibly xDripError is not nil, so we need to call handleGlucoseData which will process xDripError
|
||||
self.handleGlucoseData(result: ([GlucoseData](), nil, nil, xDripError), cgmTransmitterDelegate: cgmTransmitterDelegate, libreSensorSerialNumber: libreSensorSerialNumber, completionHandler: completionHandler)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
let parsedLibre1Data = parseLibre1Data(libreData: libreData, libre1DerivedAlgorithmParameters: libre1DerivedAlgorithmParameters, testTimeStamp: testTimeStamp)
|
||||
|
||||
// handle the result
|
||||
handleGlucoseData(result: (parsedLibre1Data.glucoseData, parsedLibre1Data.sensorTimeInMinutes, parsedLibre1Data.sensorState, nil), cgmTransmitterDelegate: cgmTransmitterDelegate, libreSensorSerialNumber: libreSensorSerialNumber, completionHandler: completionHandler)
|
||||
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
import Foundation
|
||||
|
||||
class LibreHistoricGlucoseA2: NSObject, Codable {
|
||||
|
||||
/// if quality != 0, it means the value is error
|
||||
let quality : Int?
|
||||
|
||||
/// the value's sensor time
|
||||
let time: Int?
|
||||
|
||||
/// glucose value
|
||||
let bg : Double?
|
||||
|
||||
/// description
|
||||
override var description: String {
|
||||
|
||||
return "LibreHistoricGlucoseA2 = \nquality = " + (quality != nil ? quality!.description : "nil") + ", time = " + (time != nil ? time!.description : "nil") + ", bg = " + (bg != nil ? bg!.description : "nil")
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,210 +0,0 @@
|
|||
////
|
||||
//// RemoteBG.swift
|
||||
//// SwitftOOPWeb
|
||||
////
|
||||
//// Created by Bjørn Inge Berg on 08.04.2018.
|
||||
//// Copyright © 2018 Bjørn Inge Berg. All rights reserved.
|
||||
////
|
||||
//
|
||||
//
|
||||
// LibreOOPClient.swift
|
||||
// SwitftOOPWeb
|
||||
//
|
||||
// Created by Bjørn Inge Berg on 08.04.2018.
|
||||
// Copyright © 2018 Bjørn Inge Berg. All rights reserved.
|
||||
//
|
||||
//
|
||||
// adapted by Johan Degraeve for xdrip ios
|
||||
import Foundation
|
||||
import os
|
||||
|
||||
class LibreOOPClient {
|
||||
|
||||
// MARK: - properties
|
||||
|
||||
/// for trace
|
||||
private static let log = OSLog(subsystem: ConstantsLog.subSystem, category: ConstantsLog.categoryLibreOOPClient)
|
||||
|
||||
// MARK: - public functions
|
||||
|
||||
/// get the libre glucose data by server
|
||||
/// - Parameters:
|
||||
/// - libreData: the 344 bytes from Libre sensor
|
||||
/// - libreSensorSerialNumber : sensor sn
|
||||
/// - patchInfo : will be used by server to out the glucose data
|
||||
/// - oopWebSite: the site url to use if oop web would be enabled
|
||||
/// - oopWebToken: the token to use if oop web would be enabled
|
||||
/// - callback: LibreRawGlucoseOOPData and/or error
|
||||
static func getLibreRawGlucoseOOPData(libreData: Data, libreSensorSerialNumber: LibreSensorSerialNumber, patchInfo: String, oopWebSite: String, oopWebToken: String, callback:@escaping (LibreOOPWebServerResponseData?, _ xDripError: XdripError?) -> Void) {
|
||||
|
||||
let item = URLQueryItem(name: "accesstoken", value: oopWebToken)
|
||||
let item1 = URLQueryItem(name: "patchUid", value: libreSensorSerialNumber.uidString.uppercased())
|
||||
let item2 = URLQueryItem(name: "patchInfo", value: patchInfo)
|
||||
let item3 = URLQueryItem(name: "content", value: libreData.hexEncodedString())
|
||||
|
||||
var urlComponents = URLComponents(string: "\(oopWebSite)/libreoop2")!
|
||||
|
||||
urlComponents.queryItems = [item, item1, item2, item3]
|
||||
|
||||
if let uploadURL = URL(string: urlComponents.url?.absoluteString.removingPercentEncoding ?? "") {
|
||||
|
||||
let request = NSMutableURLRequest(url: uploadURL)
|
||||
request.httpMethod = "POST"
|
||||
request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
|
||||
|
||||
createDataTaskAndHandleResponse(LibreRawGlucoseOOPData.self, request: request as URLRequest, callback: callback)
|
||||
|
||||
} else {
|
||||
|
||||
return
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// if `patchInfo.hasPrefix("A2") 'Libre 1 A2', server uses another arithmetic to handle the 344 bytes
|
||||
/// - Parameters:
|
||||
/// - libreData: the 344 bytes from Libre sensor
|
||||
/// - oopWebSite: the site url to use if oop web would be enabled
|
||||
/// - callback: LibreRawGlucoseOOPA2Data and/or error
|
||||
static func getLibreRawGlucoseOOPOA2Data (libreData: Data, oopWebSite: String, callback:@escaping (LibreOOPWebServerResponseData?, _ xDripError: XdripError?) -> Void) {
|
||||
|
||||
if let uploadURL = URL(string: "\(oopWebSite)/callnox") {
|
||||
do {
|
||||
var request = URLRequest(url: uploadURL)
|
||||
request.httpMethod = "POST"
|
||||
let data = try JSONSerialization.data(withJSONObject: [["timestamp": "\(Int(Date().timeIntervalSince1970 * 1000))",
|
||||
"content": libreData.hexEncodedString()]], options: [])
|
||||
let string = String.init(data: data, encoding: .utf8)
|
||||
let json: [String: String] = ["userId": "1",
|
||||
"list": string!]
|
||||
request.setBodyContent(contentMap: json)
|
||||
|
||||
createDataTaskAndHandleResponse(LibreRawGlucoseOOPA2Data.self, request: request, callback: callback)
|
||||
|
||||
} catch let error {
|
||||
|
||||
trace(" failed to upload, error = %{public}@", log: log, category: ConstantsLog.categoryDexcomShareUploadManager, type: .info, error.localizedDescription)
|
||||
return
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// get the `Libre1DerivedAlgorithmParameters for Libre1 Sensor, from oopWeb
|
||||
/// - Parameters:
|
||||
/// - bytes: the 344 bytes from Libre sensor
|
||||
/// - libreSensorSerialNumber: LibreSensorSerialNumber is a structure that hold the serial number
|
||||
/// - oopWebSite: the site url to use if oop web would be enabled
|
||||
/// - oopWebToken: the token to use if oop web would be enabled
|
||||
/// - callback: takes OopWebCalibrationStatus`as parameter, and/or error
|
||||
static func getOopWebCalibrationStatus(bytes: Data, libreSensorSerialNumber: LibreSensorSerialNumber, oopWebSite: String, oopWebToken: String, callback: @escaping (_ oopWebCalibrationStatus: LibreOOPWebServerResponseData?, _ xDripError: XdripError?) -> Void) {
|
||||
|
||||
// calibration parameters not available yet, get them from oopWebSite
|
||||
let json: [String: String] = [
|
||||
"token": oopWebToken,
|
||||
"content": "\(bytes.hexEncodedString())",
|
||||
"timestamp": "\(Date().toMillisecondsAsInt64())",
|
||||
]
|
||||
|
||||
if let uploadURL = URL(string: "\(oopWebSite)/calibrateSensor") {
|
||||
var request = URLRequest(url: uploadURL)
|
||||
request.httpMethod = "POST"
|
||||
request.setBodyContent(contentMap: json)
|
||||
request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
|
||||
|
||||
createDataTaskAndHandleResponse(OopWebCalibrationStatus.self, request: request, callback: callback)
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
trace("in getOopWebCalibrationStatus, failed to create uploadURL", log: log, category: ConstantsLog.categoryLibreOOPClient, type: .info)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// checks the error, response and data, makes json decoding to type, calls callback with result
|
||||
///
|
||||
/// grouping common functionality in functions that make a post to the oop web server and need to analyse the respone. This analyses is done by this function here. It also calls the callback.
|
||||
/// LibreOOPWebServerResponseData is just a do nothing protocol to which a few specific classes conform. The calling function will use one of those classes as type parameter.
|
||||
private static func createDataTaskAndHandleResponse<T:LibreOOPWebServerResponseData>(_ type: T.Type, request: URLRequest, callback:@escaping ((_ libreOOPWebServerResponseData: LibreOOPWebServerResponseData?, _ xDripError: XdripError?) -> Void)) {
|
||||
|
||||
let task = URLSession.shared.dataTask(with: request) { data, response, error in
|
||||
|
||||
DispatchQueue.main.async {
|
||||
|
||||
trace("in createDataTaskAndHandleResponse, finished task", log: log, category: ConstantsLog.categoryLibreOOPClient, type: .info)
|
||||
|
||||
if let error = error {
|
||||
|
||||
trace("in createDataTaskAndHandleResponse, received error : %{public}@", log: log, category: ConstantsLog.categoryLibreOOPClient, type: .error, error.localizedDescription)
|
||||
|
||||
callback(nil, LibreOOPWebError.genericError(error.localizedDescription))
|
||||
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
guard let data = data else {
|
||||
|
||||
trace("in createDataTaskAndHandleResponse, data is nil", log: log, category: ConstantsLog.categoryLibreOOPClient, type: .error)
|
||||
|
||||
callback(nil, LibreOOPWebError.receivedDataIsNil)
|
||||
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
// log the data as String
|
||||
if let dataAsString = String(bytes: data, encoding: .utf8) {
|
||||
trace("in createDataTaskAndHandleResponse, data as string = %{public}@", log: log, category: ConstantsLog.categoryLibreOOPClient, type: .info, dataAsString)
|
||||
}
|
||||
|
||||
// data is not nil, let's try to do json decoding
|
||||
let decoder = JSONDecoder()
|
||||
|
||||
do {
|
||||
|
||||
let response = try decoder.decode(type.self, from: data)
|
||||
|
||||
if response.isError {
|
||||
|
||||
// if response isError is true, then still send the response, but also the msg, which should contain the error description
|
||||
callback(response, LibreOOPWebError.jsonResponseHasError(msg: response.msg, errcode: response.errcode))
|
||||
|
||||
} else {
|
||||
|
||||
callback(response, nil)
|
||||
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
} catch {
|
||||
|
||||
// json parsing failed
|
||||
trace("in createDataTaskAndHandleResponse, could not do json parsing", log: log, category: ConstantsLog.categoryLibreOOPClient, type: .error)
|
||||
|
||||
// if response is not nil then trace
|
||||
if let response = String(data: data, encoding: String.Encoding.utf8) {
|
||||
|
||||
trace(" data as string = %{public}@", log: log, category: ConstantsLog.categoryLibreOOPClient, type: .error, response)
|
||||
|
||||
}
|
||||
|
||||
callback(nil, LibreOOPWebError.jsonParsingFailed)
|
||||
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
trace("in createDataTaskAndHandleResponse, calling task.resume", log: log, category: ConstantsLog.categoryLibreOOPClient, type: .info)
|
||||
task.resume()
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
////
|
||||
//// CreateRequestResponse.swift
|
||||
//// SwitftOOPWeb
|
||||
////
|
||||
//// Created by Bjørn Inge Berg on 08.04.2018.
|
||||
//// Copyright © 2018 Bjørn Inge Berg. All rights reserved.
|
||||
////
|
||||
//// adapted by Johan Degraeve for xdrip ios
|
||||
import Foundation
|
||||
|
||||
// MARK: Encode/decode helpers
|
||||
|
||||
|
||||
/// the parameters from server
|
||||
struct OopWebCalibrationStatus: Codable, CustomStringConvertible, LibreOOPWebServerResponseData {
|
||||
|
||||
// if received from server, probably always nil ?
|
||||
var msg: String?
|
||||
|
||||
// if received from server, probably always nil ?
|
||||
var errcode: Int?
|
||||
|
||||
var command: String?
|
||||
var slope: OopWebCalibrationStatusResult?
|
||||
|
||||
var description: String {
|
||||
return """
|
||||
slope_slope = \(slope?.slopeSlope ?? 0)
|
||||
slope_offset = \(slope?.slopeOffset ?? 0)
|
||||
offset_slope = \(slope?.offsetSlope ?? 0)
|
||||
offset_offset = \(slope?.offsetOffset ?? 0)
|
||||
"""
|
||||
}
|
||||
|
||||
// protocol LibreOOPWebServerResponseData
|
||||
var isError: Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct OopWebCalibrationStatusResult: Codable {
|
||||
var status: String?
|
||||
var slopeSlope: Double?
|
||||
var slopeOffset: Double?
|
||||
var offsetOffset: Double?
|
||||
var offsetSlope: Double?
|
||||
var uuid: String?
|
||||
var isValidForFooterWithReverseCRCs: Double?
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case status
|
||||
case slopeSlope = "slope_slope"
|
||||
case slopeOffset = "slope_offset"
|
||||
case offsetOffset = "offset_offset"
|
||||
case offsetSlope = "offset_slope"
|
||||
case uuid
|
||||
case isValidForFooterWithReverseCRCs = "isValidForFooterWithReverseCRCs"
|
||||
}
|
||||
|
||||
var description: String {
|
||||
return "calibrationparams:: slopeslope: \(String(describing: slopeSlope)), slopeoffset: \(String(describing: slopeOffset)), offsetoffset: \(String(describing: offsetOffset)), offsetSlope: \(String(describing: offsetSlope)), isValidForFooterWithReverseCRCs: \(String(describing: isValidForFooterWithReverseCRCs))"
|
||||
}
|
||||
}
|
|
@ -3,18 +3,6 @@ import Foundation
|
|||
/// errors encountered whil processing libre data, complies to XdripError
|
||||
enum LibreOOPWebError {
|
||||
|
||||
/// didn't receive data from oop web server
|
||||
case receivedDataIsNil
|
||||
|
||||
/// in case error is received after calling RLSession.shared.dataTask.resume
|
||||
case genericError(String)
|
||||
|
||||
/// in case json parsing of oopweb server response failed
|
||||
case jsonParsingFailed
|
||||
|
||||
/// in case web server returns err
|
||||
case jsonResponseHasError(msg: String?, errcode: Int?)
|
||||
|
||||
/// user tries Libre US which is not suppored
|
||||
case libreUSNotSupported
|
||||
|
||||
|
@ -26,26 +14,6 @@ extension LibreOOPWebError: XdripError {
|
|||
|
||||
switch self {
|
||||
|
||||
case .receivedDataIsNil:
|
||||
return .HIGH
|
||||
|
||||
case .genericError:
|
||||
return .HIGH
|
||||
|
||||
case .jsonParsingFailed:
|
||||
return .LOW
|
||||
|
||||
case .jsonResponseHasError( _, let errcode):
|
||||
|
||||
// seems to during starting phase, errcode = 0, return .LOW in that case
|
||||
if let errcode = errcode, errcode == 0 {
|
||||
return .LOW
|
||||
}
|
||||
|
||||
// for now always return HIGH
|
||||
// maybe letter we change change to MEDIUM or LOW depending on errcode value
|
||||
return .HIGH
|
||||
|
||||
case .libreUSNotSupported:
|
||||
return .HIGH
|
||||
|
||||
|
@ -58,29 +26,6 @@ extension LibreOOPWebError: XdripError {
|
|||
|
||||
switch self {
|
||||
|
||||
case .receivedDataIsNil:
|
||||
return TextsLibreErrors.oOPWebServerError + TextsLibreErrors.receivedDataIsNil
|
||||
|
||||
case .genericError(let description):
|
||||
return TextsLibreErrors.oOPWebServerError + description
|
||||
|
||||
case .jsonParsingFailed:
|
||||
return TextsLibreErrors.oOPWebServerError + "json parsing failed"
|
||||
|
||||
case .jsonResponseHasError(let msg, let errcode):
|
||||
|
||||
var message:String = ""
|
||||
if let msg = msg {
|
||||
message = msg
|
||||
}
|
||||
|
||||
var errcodeAsInt:Int = 0
|
||||
if let errcode = errcode {
|
||||
errcodeAsInt = errcode
|
||||
}
|
||||
|
||||
return TextsLibreErrors.oOPWebServerError + " code = " + errcodeAsInt.description + ", message = " + message
|
||||
|
||||
case .libreUSNotSupported:
|
||||
return TextsLibreErrors.oOPWebServerError + " " + TextsLibreErrors.libreUSNotSupported
|
||||
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
import Foundation
|
||||
|
||||
/// empty protocol used as generic response type for data received from web server
|
||||
protocol LibreOOPWebServerResponseData: Decodable {
|
||||
|
||||
/// if the server value is error return true - this is implemented by objects that conform to LibreRawGlucoseWeb, classes that do not conform to LibreRawGlucoseWeb still need to implement this (eg OopWebCalibrationStatus)
|
||||
var isError: Bool { get }
|
||||
|
||||
/// if the server returns an error, then msg describes the error - this is implemented by objects that conform to LibreRawGlucoseWeb, classes that do not conform to LibreRawGlucoseWeb still need to implement this (eg OopWebCalibrationStatus)
|
||||
var msg: String? { get }
|
||||
|
||||
// if the server returns an error, then this is the error code received from the server - this is implemented by objects that conform to LibreRawGlucoseWeb, classes that do not conform to LibreRawGlucoseWeb still need to implement this (eg OopWebCalibrationStatus)
|
||||
var errcode: Int? { get }
|
||||
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
import Foundation
|
||||
|
||||
class LibreRawGlucoseOOPA2Cotent: NSObject, Codable {
|
||||
|
||||
/// current sensor time
|
||||
var currentTime: Int?
|
||||
|
||||
/// histories
|
||||
var historicBg: [LibreHistoricGlucoseA2]?
|
||||
|
||||
/// current glucose value
|
||||
var currentBg: Double?
|
||||
|
||||
/// description
|
||||
override var description: String {
|
||||
|
||||
var returnValue = "LibreRawGlucoseOOPA2Cotent = \ncurrentTime = " + (currentTime != nil ? currentTime!.description : "nil") + "\n"
|
||||
|
||||
if let historicBg = historicBg {
|
||||
|
||||
for bg in historicBg {
|
||||
|
||||
returnValue = returnValue + bg.description + "\n"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if let currentBg = currentBg {returnValue = returnValue + currentBg.description}
|
||||
|
||||
return returnValue
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,133 +0,0 @@
|
|||
//
|
||||
// LibreRawGlucoseOOPA2Data.swift
|
||||
// xdrip
|
||||
//
|
||||
// Created by Johan Degraeve on 08/06/2020.
|
||||
// Copyright © 2020 Johan Degraeve. All rights reserved.
|
||||
//
|
||||
|
||||
// source https://github.com/JohanDegraeve/xdripswift/blob/bd5b3060f3a7d4c68dce767b5c86306239d06d14/xdrip/BluetoothTransmitter/CGM/Libre/Utilities/GlucoseData.swift#L208
|
||||
|
||||
import Foundation
|
||||
|
||||
public class LibreRawGlucoseOOPA2Data: NSObject, LibreRawGlucoseWeb, LibreOOPWebServerResponseData {
|
||||
|
||||
// if received from server, probably always nil ?
|
||||
var msg: String?
|
||||
|
||||
var errcode: Int?
|
||||
|
||||
var list: [LibreRawGlucoseOOPA2List]?
|
||||
|
||||
/// - time when instance of LibreRawGlucoseOOPData was created
|
||||
/// - this can be created to calculate the timestamp of realtimeGlucoseData
|
||||
var creationTimeStamp = Date()
|
||||
|
||||
/// server parse value
|
||||
var content: LibreRawGlucoseOOPA2Cotent? {
|
||||
return list?.first?.content
|
||||
}
|
||||
|
||||
/// if the server value is error return true
|
||||
var isError: Bool {
|
||||
if content?.currentBg ?? 0 <= 10 {
|
||||
return true
|
||||
}
|
||||
return list?.first?.content?.historicBg?.isEmpty ?? true
|
||||
}
|
||||
|
||||
/// sensor state
|
||||
var sensorState: LibreSensorState {
|
||||
if let id = content?.currentTime {
|
||||
if id < 60 { // if sensor time < 60, the sensor is starting
|
||||
return LibreSensorState.starting
|
||||
} else if id >= 20880 { // if sensor time >= 20880, the sensor expired
|
||||
return LibreSensorState.expired
|
||||
}
|
||||
}
|
||||
|
||||
let state = LibreSensorState.ready
|
||||
return state
|
||||
}
|
||||
|
||||
func glucoseData() -> (libreRawGlucoseData:[GlucoseData], sensorState:LibreSensorState, sensorTimeInMinutes:Int?) {
|
||||
|
||||
// initialize returnvalue, empty glucoseData array, sensorState, and nil as sensorTimeInMinutes
|
||||
var returnValue: ([GlucoseData], LibreSensorState, Int?) = ([GlucoseData](), sensorState, nil)
|
||||
|
||||
// if isError function returns true, then return empty array
|
||||
guard !isError else { return returnValue }
|
||||
|
||||
// if sensorState is not .ready, then return empty array
|
||||
if sensorState != .ready { return returnValue }
|
||||
|
||||
// content should be non nil, content.currentBg not nil and currentBg != 0, content.currentTime (sensorTimeInMinutes) not nil
|
||||
guard let content = content, let currentBg = content.currentBg, currentBg != 0, let sensorTimeInMinutes = content.currentTime else { return returnValue }
|
||||
|
||||
// set senorTimeInMinutes in returnValue
|
||||
returnValue.2 = sensorTimeInMinutes
|
||||
|
||||
// create realtimeGlucoseData, which is the current glucose data
|
||||
let realtimeGlucoseData = GlucoseData(timeStamp: creationTimeStamp, glucoseLevelRaw: currentBg)
|
||||
|
||||
// add first element
|
||||
returnValue.0.append(realtimeGlucoseData)
|
||||
|
||||
// history should be non nil, otherwise return only the first value
|
||||
guard var history = content.historicBg else { return returnValue }
|
||||
|
||||
// check the order, first should be the highest value, time is sensor time in minutes, means first should be the most recent or the highest sensor time
|
||||
// if not, reverse it
|
||||
if (history.first?.time ?? 0) < (history.last?.time ?? 0) {
|
||||
history = history.reversed()
|
||||
}
|
||||
|
||||
// iterate through history
|
||||
for libreHistoricGlucoseA2 in history {
|
||||
|
||||
// if quality != 0, the value is error, don't add it
|
||||
if libreHistoricGlucoseA2.quality != 0 {continue}
|
||||
|
||||
// if time is nil, (which is sensorTimeInMinutes at the moment this reading was created), then we can't calculate the timestamp, don't add it
|
||||
if libreHistoricGlucoseA2.time == nil {continue}
|
||||
|
||||
// create timestamp of the reading
|
||||
let readingTimeStamp = creationTimeStamp.addingTimeInterval(-60 * Double(sensorTimeInMinutes - libreHistoricGlucoseA2.time!))
|
||||
|
||||
// only add readings that are at least 5 minutes away from each other, same approach as in LibreDataParser.parse
|
||||
if let lastElement = returnValue.0.last {
|
||||
|
||||
if lastElement.timeStamp.toMillisecondsAsDouble() - readingTimeStamp.toMillisecondsAsDouble() < (5 * 60 * 1000 - 10000) {continue}
|
||||
|
||||
}
|
||||
|
||||
// bg value should be non nil and > 0.0
|
||||
if libreHistoricGlucoseA2.bg == nil {continue}
|
||||
if libreHistoricGlucoseA2.bg! == 0.0 {continue}
|
||||
|
||||
let libreRawGlucoseData = GlucoseData(timeStamp: readingTimeStamp, glucoseLevelRaw: libreHistoricGlucoseA2.bg!)
|
||||
|
||||
returnValue.0.append(libreRawGlucoseData)
|
||||
|
||||
}
|
||||
|
||||
return (returnValue)
|
||||
|
||||
}
|
||||
|
||||
override public var description: String {
|
||||
|
||||
var returnValue = "LibreRawGlucoseOOPA2Data =\n"
|
||||
|
||||
// a description created by LibreRawGlucoseWeb
|
||||
returnValue = returnValue + (self as LibreRawGlucoseWeb).description
|
||||
|
||||
if let errcode = errcode {
|
||||
returnValue = returnValue + " errcode = " + errcode.description + "\n"
|
||||
}
|
||||
|
||||
return returnValue
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
import Foundation
|
||||
|
||||
class LibreRawGlucoseOOPA2List: NSObject, Codable {
|
||||
|
||||
var content: LibreRawGlucoseOOPA2Cotent?
|
||||
|
||||
/// description
|
||||
override var description: String {
|
||||
|
||||
guard let content = content else {return "LibreRawGlucoseOOPA2List = \ncontent = nil (type LibreRawGlucoseOOPA2List)"}
|
||||
|
||||
return "LibreRawGlucoseOOPA2List = \ncontent = " + content.description
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,192 +0,0 @@
|
|||
// https://github.com/JohanDegraeve/xdripswift/blob/bd5b3060f3a7d4c68dce767b5c86306239d06d14/xdrip/BluetoothTransmitter/CGM/Libre/Utilities/GlucoseData.swift#L208
|
||||
|
||||
import Foundation
|
||||
|
||||
public class LibreRawGlucoseOOPData: NSObject, LibreRawGlucoseWeb, LibreOOPWebServerResponseData {
|
||||
|
||||
/// histories by server
|
||||
var historicGlucose : [LibreRawGlucoseOOPGlucose]?
|
||||
|
||||
/// current glucose
|
||||
var realTimeGlucose : LibreRawGlucoseOOPGlucose?
|
||||
|
||||
/// trend arrow by server
|
||||
var trendArrow : String?
|
||||
|
||||
/// sensor message
|
||||
var msg: String?
|
||||
|
||||
var errcode: Int?
|
||||
|
||||
/// if endTime != 0, the sensor expired
|
||||
var endTime: Int?
|
||||
|
||||
/// - time when instance of LibreRawGlucoseOOPData was created
|
||||
/// - this can be created to calculate the timestamp of realTimeGlucose
|
||||
var creationTimeStamp = Date()
|
||||
|
||||
enum Error: String {
|
||||
typealias RawValue = String
|
||||
case RESCAN_SENSOR_BAD_CRC // crc failed
|
||||
// sensor terminate
|
||||
case TERMINATE_SENSOR_NORMAL_TERMINATED_STATE
|
||||
case TERMINATE_SENSOR_ERROR_TERMINATED_STATE
|
||||
case TERMINATE_SENSOR_CORRUPT_PAYLOAD
|
||||
// http request bad arguments
|
||||
case FATAL_ERROR_BAD_ARGUMENTS
|
||||
// the follow messages is sensor state
|
||||
case TYPE_SENSOR_NOT_STARTED
|
||||
case TYPE_SENSOR_STARTING
|
||||
case TYPE_SENSOR_Expired
|
||||
case TYPE_SENSOR_END
|
||||
case TYPE_SENSOR_ERROR
|
||||
case TYPE_SENSOR_OK
|
||||
case TYPE_SENSOR_DETERMINED
|
||||
}
|
||||
/// if the server value is error return true
|
||||
var isError: Bool {
|
||||
if let msg = msg {
|
||||
switch Error(rawValue: msg) { // sensor terminate
|
||||
case .TERMINATE_SENSOR_CORRUPT_PAYLOAD,
|
||||
.TERMINATE_SENSOR_NORMAL_TERMINATED_STATE,
|
||||
.TERMINATE_SENSOR_ERROR_TERMINATED_STATE:
|
||||
return false
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
// if parse the 344 failed, historicGlucose will be nil, return is error
|
||||
return historicGlucose?.isEmpty ?? true
|
||||
}
|
||||
|
||||
var sensorState: LibreSensorState {
|
||||
|
||||
/// if sensor time < 60, sensor state is starting
|
||||
if let dataQuality = realTimeGlucose?.dataQuality, let id = realTimeGlucose?.id {
|
||||
if dataQuality != 0 && id < 60 {
|
||||
return LibreSensorState.starting
|
||||
}
|
||||
}
|
||||
|
||||
var state = LibreSensorState.ready
|
||||
// parse the sensor state from msg
|
||||
if let msg = msg {
|
||||
switch Error(rawValue: msg) {
|
||||
case .TYPE_SENSOR_NOT_STARTED:
|
||||
state = .notYetStarted
|
||||
break;
|
||||
case .TYPE_SENSOR_STARTING:
|
||||
state = .starting
|
||||
break;
|
||||
case .TYPE_SENSOR_Expired,
|
||||
.TERMINATE_SENSOR_CORRUPT_PAYLOAD,
|
||||
.TERMINATE_SENSOR_NORMAL_TERMINATED_STATE,
|
||||
.TERMINATE_SENSOR_ERROR_TERMINATED_STATE:
|
||||
state = .expired
|
||||
break;
|
||||
case .TYPE_SENSOR_END:
|
||||
state = .expired
|
||||
break;
|
||||
case .TYPE_SENSOR_ERROR:
|
||||
state = .failure
|
||||
break;
|
||||
case .TYPE_SENSOR_OK:
|
||||
state = .ready
|
||||
case .TYPE_SENSOR_DETERMINED:
|
||||
state = .unknown
|
||||
break
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if endTime != 0, the sensor expired
|
||||
if let endTime = endTime, endTime != 0 {
|
||||
state = .expired
|
||||
}
|
||||
|
||||
return state
|
||||
|
||||
}
|
||||
|
||||
func glucoseData() -> (libreRawGlucoseData:[GlucoseData], sensorState:LibreSensorState, sensorTimeInMinutes:Int?) {
|
||||
|
||||
// initialize returnvalue, empty glucoseData array, sensorState, and nil as sensorTimeInMinutes
|
||||
var returnValue: ([GlucoseData], LibreSensorState, Int?) = ([GlucoseData](), sensorState, nil)
|
||||
|
||||
// if isError function returns true, then return empty array
|
||||
guard !isError else { return returnValue }
|
||||
|
||||
// if sensorState is not .ready, then return empty array
|
||||
if sensorState != .ready { return returnValue }
|
||||
|
||||
// realTimeGlucose must be non-nil and realTimeGlucose.dataQuality must be 0, id (sensor time) must be non nil, otherwise return empty array
|
||||
guard let realTimeGlucose = realTimeGlucose, realTimeGlucose.dataQuality == 0, let value = realTimeGlucose.value, let sensorTimeInMinutes = realTimeGlucose.id else { return returnValue }
|
||||
|
||||
// set senorTimeInMinutes in returnValue
|
||||
returnValue.2 = sensorTimeInMinutes
|
||||
|
||||
// get realtimeGlucoseData which is the first element to add, with timestamp the time this instance of LibreRawGlucoseOOPData was created
|
||||
let realtimeGlucoseData = GlucoseData(timeStamp: creationTimeStamp, glucoseLevelRaw: value)
|
||||
|
||||
// add first element to returnValue
|
||||
returnValue.0.append(realtimeGlucoseData)
|
||||
|
||||
// if historicGlucose is nil then return currentGlucoseData and an empty array
|
||||
guard var history = historicGlucose else {return returnValue}
|
||||
|
||||
// check the order, first should be the highest value, time is sensor time in minutes, means first should be the most recent or the highest sensor time
|
||||
// if not, reverse it
|
||||
if (history.first?.id ?? 0) < (history.last?.id ?? 0) {
|
||||
history = history.reversed()
|
||||
}
|
||||
|
||||
// go through history
|
||||
for realTimeGlucose in history {
|
||||
|
||||
// if dataQuality != 0, the value is error, don't add it
|
||||
if realTimeGlucose.dataQuality != 0 { continue }
|
||||
|
||||
// if id is nil, (which is sensorTimeInMinutes at the moment this reading was created), then we can't calculate the timestamp, don't add it
|
||||
if realTimeGlucose.id == nil {continue}
|
||||
|
||||
|
||||
// create timestamp of the reading
|
||||
let readingTimeStamp = creationTimeStamp.addingTimeInterval(-60 * Double(sensorTimeInMinutes - realTimeGlucose.id!))
|
||||
|
||||
// only add readings that are at least 5 minutes away from each other, same approach as in LibreDataParser.parse
|
||||
if let lastElement = returnValue.0.last {
|
||||
if lastElement.timeStamp.toMillisecondsAsDouble() - readingTimeStamp.toMillisecondsAsDouble() < (5 * 60 * 1000 - 10000) {continue}
|
||||
}
|
||||
|
||||
// realTimeGlucose.value should be non nil and not 0
|
||||
if realTimeGlucose.value == nil {continue}
|
||||
if realTimeGlucose.value! == 0.0 {continue}
|
||||
|
||||
let libreRawGlucoseData = GlucoseData(timeStamp: readingTimeStamp, glucoseLevelRaw: realTimeGlucose.value!)
|
||||
|
||||
returnValue.0.append(libreRawGlucoseData)
|
||||
|
||||
}
|
||||
|
||||
return (returnValue)
|
||||
|
||||
}
|
||||
|
||||
public override var description: String {
|
||||
|
||||
var returnValue = "LibreRawGlucoseWeb =\n"
|
||||
|
||||
// a description created by LibreRawGlucoseWeb
|
||||
returnValue = returnValue + (self as LibreRawGlucoseWeb).description
|
||||
|
||||
if let errcode = errcode {
|
||||
returnValue = returnValue + " errcode = " + errcode.description + "\n"
|
||||
}
|
||||
|
||||
return returnValue
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
import Foundation
|
||||
|
||||
/// a readings value, id (time in minutes since sensor start) and dataQuality
|
||||
class LibreRawGlucoseOOPGlucose: NSObject, Codable {
|
||||
|
||||
/// if dataQuality != 0, it means the value is error
|
||||
let dataQuality : Int?
|
||||
|
||||
/// the time of this reading, in minutes, since sensor start
|
||||
let id: Int?
|
||||
|
||||
/// glucose value
|
||||
let value : Double?
|
||||
|
||||
/// description
|
||||
override var description: String {
|
||||
|
||||
return "LibreRawGlucoseOOPGlucose = \ndataQuality = " + (dataQuality != nil ? dataQuality!.description : "nil") + ", id = " + (id != nil ? id!.description : "nil") + ", value = " + (value != nil ? value!.description : "nil")
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
import Foundation
|
||||
|
||||
protocol LibreRawGlucoseWeb {
|
||||
|
||||
/// if the server value is error return true
|
||||
var isError: Bool { get }
|
||||
|
||||
/// sensor state
|
||||
var sensorState: LibreSensorState { get }
|
||||
|
||||
/// - returns:
|
||||
/// - array of libreRawGlucoseData, first is the most recent.
|
||||
/// - sensorState: status of the sensor
|
||||
/// - sensorTimeInMinutes: age of sensor in minutes, optional
|
||||
func glucoseData() -> (libreRawGlucoseData:[GlucoseData], sensorState:LibreSensorState, sensorTimeInMinutes:Int?)
|
||||
|
||||
}
|
||||
|
||||
// to implement a var description
|
||||
extension LibreRawGlucoseWeb {
|
||||
|
||||
var description: String {
|
||||
|
||||
var returnValue = " isError = " + isError.description + "\n"
|
||||
|
||||
returnValue = returnValue + " sensorState = " + sensorState.description + "\n"
|
||||
|
||||
let libreGlucoseData = glucoseData()
|
||||
|
||||
returnValue = returnValue + "\nSize of [LibreRawGlucoseData] = " + libreGlucoseData.libreRawGlucoseData.count.description + "\n"
|
||||
|
||||
if libreGlucoseData.libreRawGlucoseData.count > 0 {
|
||||
returnValue = returnValue + "latest reading = \n"
|
||||
|
||||
returnValue = returnValue + libreGlucoseData.libreRawGlucoseData[0].description + "\n"
|
||||
|
||||
}
|
||||
|
||||
if let sensorTimeInMinutes = libreGlucoseData.sensorTimeInMinutes {
|
||||
|
||||
returnValue = returnValue + "sensor time in minutes = " + sensorTimeInMinutes.description + "\n"
|
||||
|
||||
} else {
|
||||
|
||||
returnValue = returnValue + "sensor time in minutes is unknown\n"
|
||||
|
||||
}
|
||||
|
||||
return returnValue
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -39,23 +39,6 @@ public enum LibreSensorType: String {
|
|||
|
||||
}
|
||||
|
||||
/// some of the Libre types can not work without webOOP. In case returnvalue is true, then user can not change the value
|
||||
///
|
||||
/// note that this value can be overriden by BluetoothPeripheral function overrideNeedsWebOOP, for transmitters that support decryption
|
||||
func needsWebOOP() -> Bool {
|
||||
|
||||
switch self {
|
||||
|
||||
case .libre1A2, .libre1, .libreProH:
|
||||
return false
|
||||
|
||||
case .libre2, .libreUS:
|
||||
return true
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// decrypts for libre2 and libreUs,
|
||||
func decryptIfPossibleAndNeeded(rxBuffer:inout Data, headerLength: Int, log: OSLog?, patchInfo: String?, uid: [UInt8]) -> Bool {
|
||||
|
||||
|
|
|
@ -81,12 +81,6 @@ final class WatlaaBluetoothTransmitter: BluetoothTransmitter {
|
|||
/// is nonFixed enabled for the transmitter or not
|
||||
public var nonFixedSlopeEnabled: Bool
|
||||
|
||||
/// oop website url to use in case oop web would be enabled
|
||||
public var oopWebSite: String
|
||||
|
||||
/// oop token to use in case oop web would be enabled
|
||||
public var oopWebToken: String
|
||||
|
||||
// MARK: Other private properties
|
||||
|
||||
/// for trace
|
||||
|
@ -133,7 +127,7 @@ final class WatlaaBluetoothTransmitter: BluetoothTransmitter {
|
|||
/// - cgmTransmitterDelegate : CGMTransmitterDelegate
|
||||
/// - watlaaBluetoothTransmitterDelegate : the WatlaaBluetoothTransmitterDelegate
|
||||
/// - bluetoothTransmitterDelegate : BluetoothTransmitterDelegate
|
||||
init(address:String?, name: String?, cgmTransmitterDelegate:CGMTransmitterDelegate?, bluetoothTransmitterDelegate: BluetoothTransmitterDelegate, watlaaBluetoothTransmitterDelegate: WatlaaBluetoothTransmitterDelegate, sensorSerialNumber:String?, webOOPEnabled: Bool?, oopWebSite: String?, oopWebToken: String?, nonFixedSlopeEnabled: Bool?) {
|
||||
init(address:String?, name: String?, cgmTransmitterDelegate:CGMTransmitterDelegate?, bluetoothTransmitterDelegate: BluetoothTransmitterDelegate, watlaaBluetoothTransmitterDelegate: WatlaaBluetoothTransmitterDelegate, sensorSerialNumber:String?, webOOPEnabled: Bool?, nonFixedSlopeEnabled: Bool?) {
|
||||
|
||||
// assign addressname and name or expected devicename
|
||||
var newAddressAndName:BluetoothTransmitter.DeviceAddressAndName = BluetoothTransmitter.DeviceAddressAndName.notYetConnected(expectedName: "watlaa")
|
||||
|
@ -157,10 +151,6 @@ final class WatlaaBluetoothTransmitter: BluetoothTransmitter {
|
|||
// initialize nonFixedSlopeEnabled
|
||||
self.nonFixedSlopeEnabled = nonFixedSlopeEnabled ?? false
|
||||
|
||||
// initialize oopWebToken and oopWebSite
|
||||
self.oopWebToken = oopWebToken ?? ConstantsLibre.token
|
||||
self.oopWebSite = oopWebSite ?? ConstantsLibre.site
|
||||
|
||||
// assign sensorSerialNumber
|
||||
self.sensorSerialNumber = sensorSerialNumber
|
||||
|
||||
|
@ -327,7 +317,7 @@ final class WatlaaBluetoothTransmitter: BluetoothTransmitter {
|
|||
// send batteryPercentage to delegate
|
||||
cgmTransmitterDelegate?.cgmTransmitterInfoReceived(glucoseData: &emptyArray, transmitterBatteryInfo: TransmitterBatteryInfo.percentage(percentage: batteryPercentage), sensorTimeInMinutes: nil)
|
||||
|
||||
libreDataParser.libreDataProcessor(libreSensorSerialNumber: LibreSensorSerialNumber(withUID: Data(rxBuffer.subdata(in: 5..<13))), patchInfo: nil, webOOPEnabled: webOOPEnabled, oopWebSite: oopWebSite, oopWebToken: oopWebToken, libreData: (rxBuffer.subdata(in: miaoMiaoHeaderLength..<(344 + miaoMiaoHeaderLength))), cgmTransmitterDelegate: cgmTransmitterDelegate, dataIsDecryptedToLibre1Format: false, testTimeStamp: nil, completionHandler: { (sensorState: LibreSensorState?, xDripError: XdripError?) in
|
||||
libreDataParser.libreDataProcessor(libreSensorSerialNumber: LibreSensorSerialNumber(withUID: Data(rxBuffer.subdata(in: 5..<13))), patchInfo: nil, webOOPEnabled: webOOPEnabled, libreData: (rxBuffer.subdata(in: miaoMiaoHeaderLength..<(344 + miaoMiaoHeaderLength))), cgmTransmitterDelegate: cgmTransmitterDelegate, dataIsDecryptedToLibre1Format: false, testTimeStamp: nil, completionHandler: { (sensorState: LibreSensorState?, xDripError: XdripError?) in
|
||||
|
||||
// TODO : use sensorState as in MiaoMiao and Bubble : show the status on bluetoothPeripheralView
|
||||
|
||||
|
|
|
@ -2,18 +2,6 @@ import Foundation
|
|||
|
||||
extension WatlaaBluetoothTransmitter: CGMTransmitter {
|
||||
|
||||
func setWebOOPSite(oopWebSite: String) {
|
||||
|
||||
self.oopWebSite = oopWebSite
|
||||
|
||||
}
|
||||
|
||||
func setWebOOPToken(oopWebToken: String) {
|
||||
|
||||
self.oopWebToken = oopWebToken
|
||||
|
||||
}
|
||||
|
||||
func setWebOOPEnabled(enabled: Bool) {
|
||||
|
||||
webOOPEnabled = enabled
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
import Foundation
|
||||
|
||||
/// for use with Libre in combination web oop, goal is to recalibrate values received from oop webserver
|
||||
class LibreReCalibrator: Calibrator {
|
||||
|
||||
// as the values are already calibrated, there's no need to divide, so value 1
|
||||
var rawValueDivider: Double = 1.0
|
||||
|
||||
// using non-fixed slope parameters
|
||||
let sParams: SlopeParameters = SlopeParameters(LOW_SLOPE_1: 0.55, LOW_SLOPE_2: 0.50, HIGH_SLOPE_1: 1.5, HIGH_SLOPE_2: 1.6, DEFAULT_LOW_SLOPE_LOW: 0.55, DEFAULT_LOW_SLOPE_HIGH: 0.50, DEFAULT_SLOPE: 1, DEFAULT_HIGH_SLOPE_HIGH: 1.5, DEFAUL_HIGH_SLOPE_LOW: 1.4)
|
||||
|
||||
let ageAdjustMentNeeded: Bool = false
|
||||
|
||||
func description() -> String {
|
||||
return "LibreReCalibrator"
|
||||
}
|
||||
|
||||
}
|
|
@ -7,12 +7,6 @@ enum ConstantsLibre {
|
|||
/// is web oop enabled by default yes or no
|
||||
static let defaultWebOOPEnabled = false
|
||||
|
||||
/// site for libreOOP client
|
||||
static let site = "https://www.glucose.space"
|
||||
|
||||
/// token to use to access site
|
||||
static let token = "bubble-201907"
|
||||
|
||||
/// calibration parameters will be stored locally on disk, this is the path
|
||||
static let filePathForParameterStorage = "/Documents/LibreSensorParameters"
|
||||
|
||||
|
|
|
@ -227,11 +227,6 @@ extension UserDefaults {
|
|||
/// OSLogEnabled enabled or not
|
||||
case OSLogEnabled = "OSLogEnabled"
|
||||
|
||||
/// if webOOP enabled, what site to use
|
||||
case webOOPsite = "webOOPsite"
|
||||
/// if webOOP enabled, value of the token
|
||||
case webOOPtoken = "webOOPtoken"
|
||||
|
||||
/// case smooth libre values
|
||||
case smoothLibreValues = "smoothLibreValues"
|
||||
|
||||
|
@ -247,9 +242,6 @@ extension UserDefaults {
|
|||
/// used for storing data read with Libre 2 direct
|
||||
case previousTemperatureAdjustmentValues = "previousTemperatureAdjustmentValues"
|
||||
|
||||
/// in case Libre 2 users want to use the local calibration algorithm
|
||||
case overrideWebOOPCalibration = "overrideWebOOPCalibration"
|
||||
|
||||
/// to merge from 3.x to 4.x, can be deleted once 3.x is not used anymore
|
||||
case cgmTransmitterDeviceAddress = "cgmTransmitterDeviceAddress"
|
||||
|
||||
|
@ -1232,42 +1224,6 @@ extension UserDefaults {
|
|||
}
|
||||
}
|
||||
|
||||
/// web oop site
|
||||
@objc dynamic var webOOPSite:String? {
|
||||
get {
|
||||
return string(forKey: Key.webOOPsite.rawValue)
|
||||
}
|
||||
set {
|
||||
var value = newValue
|
||||
if let newValue = newValue {
|
||||
if !newValue.startsWith("http") {
|
||||
value = "https://" + newValue
|
||||
}
|
||||
}
|
||||
set(value, forKey: Key.webOOPsite.rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
/// web oop token
|
||||
@objc dynamic var webOOPtoken:String? {
|
||||
get {
|
||||
return string(forKey: Key.webOOPtoken.rawValue)
|
||||
}
|
||||
set {
|
||||
set(newValue, forKey: Key.webOOPtoken.rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
/// in case Libre 2 users want to use the local calibration algorithm
|
||||
@objc dynamic var overrideWebOOPCalibration: Bool {
|
||||
get {
|
||||
return bool(forKey: Key.overrideWebOOPCalibration.rawValue)
|
||||
}
|
||||
set {
|
||||
set(newValue, forKey: Key.overrideWebOOPCalibration.rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
/// to merge from 3.x to 4.x, can be deleted once 3.x is not used anymore
|
||||
var cgmTransmitterDeviceAddress: String? {
|
||||
get {
|
||||
|
|
|
@ -28,20 +28,9 @@ extension BluetoothPeripheralManager: CGMBubbleTransmitterDelegate {
|
|||
|
||||
guard let bubble = findTransmitter(cGMBubbleTransmitter: cGMBubbleTransmitter) else {return}
|
||||
|
||||
// store serial number in bubble.blePeripheral object
|
||||
// store libreSensorType in bubble.blePeripheral object
|
||||
bubble.blePeripheral.libreSensorType = libreSensorType
|
||||
|
||||
// if the libreSensorType needs oopweb, then enable oopweb. (User may have set it to false, but if it's one that requires oopweb, then we force to true)
|
||||
// also disable non-fixed slopes, as calibration is not used, it makes no sense to show this as enabled
|
||||
// and only if overrideNeedsOOPWeb is false
|
||||
if libreSensorType.needsWebOOP() && !bubble.overrideNeedsOOPWeb() {
|
||||
|
||||
bubble.blePeripheral.webOOPEnabled = true
|
||||
|
||||
bubble.blePeripheral.nonFixedSlopeEnabled = false
|
||||
|
||||
}
|
||||
|
||||
// coredatamanager savechanges needed because webOOPEnabled is stored in coredata
|
||||
coreDataManager.saveChanges()
|
||||
|
||||
|
|
|
@ -17,20 +17,9 @@ extension BluetoothPeripheralManager: CGMMiaoMiaoTransmitterDelegate {
|
|||
|
||||
guard let miaoMiao = findTransmitter(cGMMiaoMiaoTransmitter: cGMMiaoMiaoTransmitter) else {return}
|
||||
|
||||
// store serial number in miaoMiao.blePeripheral object
|
||||
// store libreSensorType in miaoMiao.blePeripheral object
|
||||
miaoMiao.blePeripheral.libreSensorType = libreSensorType
|
||||
|
||||
// if the libreSensorType needs oopweb, then enable oopweb. (User may have set it to false, but if it's one that requires oopweb, then we force to true)
|
||||
// also disable non-fixed slopes, as calibration is not used, it makes no sense to show this as enabled
|
||||
// and only if overrideNeedsOOPWeb is false
|
||||
if libreSensorType.needsWebOOP() && !miaoMiao.overrideNeedsOOPWeb() {
|
||||
|
||||
miaoMiao.blePeripheral.webOOPEnabled = true
|
||||
|
||||
miaoMiao.blePeripheral.nonFixedSlopeEnabled = false
|
||||
|
||||
}
|
||||
|
||||
// coredatamanager savechanges needed because webOOPEnabled is stored in coredata
|
||||
coreDataManager.saveChanges()
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ class BluetoothPeripheralManager: NSObject {
|
|||
|
||||
// create an instance of WatlaaBluetoothTransmitter, WatlaaBluetoothTransmitter will automatically try to connect to the watlaa with the address that is stored in watlaa
|
||||
// add it to the array of bluetoothTransmitters
|
||||
bluetoothTransmitters.insert(WatlaaBluetoothTransmitter(address: watlaa.blePeripheral.address, name: watlaa.blePeripheral.name, cgmTransmitterDelegate: cgmTransmitterDelegate, bluetoothTransmitterDelegate: self, watlaaBluetoothTransmitterDelegate: self, sensorSerialNumber: watlaa.blePeripheral.sensorSerialNumber, webOOPEnabled: watlaa.blePeripheral.webOOPEnabled, oopWebSite: UserDefaults.standard.webOOPSite, oopWebToken: UserDefaults.standard.webOOPtoken, nonFixedSlopeEnabled: watlaa.blePeripheral.nonFixedSlopeEnabled), at: index)
|
||||
bluetoothTransmitters.insert(WatlaaBluetoothTransmitter(address: watlaa.blePeripheral.address, name: watlaa.blePeripheral.name, cgmTransmitterDelegate: cgmTransmitterDelegate, bluetoothTransmitterDelegate: self, watlaaBluetoothTransmitterDelegate: self, sensorSerialNumber: watlaa.blePeripheral.sensorSerialNumber, webOOPEnabled: watlaa.blePeripheral.webOOPEnabled, nonFixedSlopeEnabled: watlaa.blePeripheral.nonFixedSlopeEnabled), at: index)
|
||||
|
||||
// if watlaa is of type CGM, then assign the address to currentCgmTransmitterAddress, there shouldn't be any other bluetoothPeripherals of type .CGM with shouldconnect = true
|
||||
if bluetoothPeripheralType.category() == .CGM {
|
||||
|
@ -204,7 +204,7 @@ class BluetoothPeripheralManager: NSObject {
|
|||
|
||||
// create an instance of BubbleBluetoothTransmitter, BubbleBluetoothTransmitter will automatically try to connect to the Bubble with the address that is stored in bubble
|
||||
// add it to the array of bluetoothTransmitters
|
||||
bluetoothTransmitters.insert(CGMBubbleTransmitter(address: bubble.blePeripheral.address, name: bubble.blePeripheral.name, bluetoothTransmitterDelegate: self, cGMBubbleTransmitterDelegate: self, cGMTransmitterDelegate: cgmTransmitterDelegate, sensorSerialNumber: bubble.blePeripheral.sensorSerialNumber, webOOPEnabled: bubble.blePeripheral.webOOPEnabled, oopWebSite: UserDefaults.standard.webOOPSite, oopWebToken: UserDefaults.standard.webOOPtoken, nonFixedSlopeEnabled: bubble.blePeripheral.nonFixedSlopeEnabled), at: index)
|
||||
bluetoothTransmitters.insert(CGMBubbleTransmitter(address: bubble.blePeripheral.address, name: bubble.blePeripheral.name, bluetoothTransmitterDelegate: self, cGMBubbleTransmitterDelegate: self, cGMTransmitterDelegate: cgmTransmitterDelegate, sensorSerialNumber: bubble.blePeripheral.sensorSerialNumber, webOOPEnabled: bubble.blePeripheral.webOOPEnabled, nonFixedSlopeEnabled: bubble.blePeripheral.nonFixedSlopeEnabled), at: index)
|
||||
|
||||
// if BubbleType is of type CGM, then assign the address to currentCgmTransmitterAddress, there shouldn't be any other bluetoothPeripherals of type .CGM with shouldconnect = true
|
||||
if bluetoothPeripheralType.category() == .CGM {
|
||||
|
@ -231,7 +231,7 @@ class BluetoothPeripheralManager: NSObject {
|
|||
|
||||
// create an instance of CGMMiaoMiaoTransmitter, CGMMiaoMiaoTransmitter will automatically try to connect to the Bubble with the address that is stored in bubble
|
||||
// add it to the array of bluetoothTransmitters
|
||||
bluetoothTransmitters.insert(CGMMiaoMiaoTransmitter(address: miaoMiao.blePeripheral.address, name: miaoMiao.blePeripheral.name, bluetoothTransmitterDelegate: self, cGMMiaoMiaoTransmitterDelegate: self, cGMTransmitterDelegate: cgmTransmitterDelegate, sensorSerialNumber: miaoMiao.blePeripheral.sensorSerialNumber, webOOPEnabled: miaoMiao.blePeripheral.webOOPEnabled, oopWebSite: UserDefaults.standard.webOOPSite, oopWebToken: UserDefaults.standard.webOOPtoken, nonFixedSlopeEnabled: miaoMiao.blePeripheral.nonFixedSlopeEnabled), at: index)
|
||||
bluetoothTransmitters.insert(CGMMiaoMiaoTransmitter(address: miaoMiao.blePeripheral.address, name: miaoMiao.blePeripheral.name, bluetoothTransmitterDelegate: self, cGMMiaoMiaoTransmitterDelegate: self, cGMTransmitterDelegate: cgmTransmitterDelegate, sensorSerialNumber: miaoMiao.blePeripheral.sensorSerialNumber, webOOPEnabled: miaoMiao.blePeripheral.webOOPEnabled, nonFixedSlopeEnabled: miaoMiao.blePeripheral.nonFixedSlopeEnabled), at: index)
|
||||
|
||||
// if MiaoMiaoType is of type CGM, then assign the address to currentCgmTransmitterAddress, there shouldn't be any other bluetoothPeripherals of type .CGM with shouldconnect = true
|
||||
if bluetoothPeripheralType.category() == .CGM {
|
||||
|
@ -549,7 +549,7 @@ class BluetoothPeripheralManager: NSObject {
|
|||
|
||||
if let watlaa = bluetoothPeripheral as? Watlaa {
|
||||
|
||||
newTransmitter = WatlaaBluetoothTransmitter(address: watlaa.blePeripheral.address, name: watlaa.blePeripheral.name, cgmTransmitterDelegate: cgmTransmitterDelegate, bluetoothTransmitterDelegate: self, watlaaBluetoothTransmitterDelegate: self, sensorSerialNumber: watlaa.blePeripheral.sensorSerialNumber, webOOPEnabled: watlaa.blePeripheral.webOOPEnabled, oopWebSite: UserDefaults.standard.webOOPSite, oopWebToken: UserDefaults.standard.webOOPtoken, nonFixedSlopeEnabled: watlaa.blePeripheral.nonFixedSlopeEnabled)
|
||||
newTransmitter = WatlaaBluetoothTransmitter(address: watlaa.blePeripheral.address, name: watlaa.blePeripheral.name, cgmTransmitterDelegate: cgmTransmitterDelegate, bluetoothTransmitterDelegate: self, watlaaBluetoothTransmitterDelegate: self, sensorSerialNumber: watlaa.blePeripheral.sensorSerialNumber, webOOPEnabled: watlaa.blePeripheral.webOOPEnabled, nonFixedSlopeEnabled: watlaa.blePeripheral.nonFixedSlopeEnabled)
|
||||
|
||||
}
|
||||
|
||||
|
@ -598,7 +598,7 @@ class BluetoothPeripheralManager: NSObject {
|
|||
|
||||
if let cgmTransmitterDelegate = cgmTransmitterDelegate {
|
||||
|
||||
newTransmitter = CGMBubbleTransmitter(address: bubble.blePeripheral.address, name: bubble.blePeripheral.name, bluetoothTransmitterDelegate: self, cGMBubbleTransmitterDelegate: self, cGMTransmitterDelegate: cgmTransmitterDelegate, sensorSerialNumber: bubble.blePeripheral.sensorSerialNumber, webOOPEnabled: bubble.blePeripheral.webOOPEnabled, oopWebSite: UserDefaults.standard.webOOPSite, oopWebToken: UserDefaults.standard.webOOPtoken, nonFixedSlopeEnabled: bubble.blePeripheral.nonFixedSlopeEnabled)
|
||||
newTransmitter = CGMBubbleTransmitter(address: bubble.blePeripheral.address, name: bubble.blePeripheral.name, bluetoothTransmitterDelegate: self, cGMBubbleTransmitterDelegate: self, cGMTransmitterDelegate: cgmTransmitterDelegate, sensorSerialNumber: bubble.blePeripheral.sensorSerialNumber, webOOPEnabled: bubble.blePeripheral.webOOPEnabled, nonFixedSlopeEnabled: bubble.blePeripheral.nonFixedSlopeEnabled)
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -613,7 +613,7 @@ class BluetoothPeripheralManager: NSObject {
|
|||
|
||||
if let cgmTransmitterDelegate = cgmTransmitterDelegate {
|
||||
|
||||
newTransmitter = CGMMiaoMiaoTransmitter(address: miaoMiao.blePeripheral.address, name: miaoMiao.blePeripheral.name, bluetoothTransmitterDelegate: self, cGMMiaoMiaoTransmitterDelegate: self, cGMTransmitterDelegate: cgmTransmitterDelegate, sensorSerialNumber: miaoMiao.blePeripheral.sensorSerialNumber, webOOPEnabled: miaoMiao.blePeripheral.webOOPEnabled, oopWebSite: UserDefaults.standard.webOOPSite, oopWebToken: UserDefaults.standard.webOOPtoken, nonFixedSlopeEnabled: miaoMiao.blePeripheral.nonFixedSlopeEnabled)
|
||||
newTransmitter = CGMMiaoMiaoTransmitter(address: miaoMiao.blePeripheral.address, name: miaoMiao.blePeripheral.name, bluetoothTransmitterDelegate: self, cGMMiaoMiaoTransmitterDelegate: self, cGMTransmitterDelegate: cgmTransmitterDelegate, sensorSerialNumber: miaoMiao.blePeripheral.sensorSerialNumber, webOOPEnabled: miaoMiao.blePeripheral.webOOPEnabled, nonFixedSlopeEnabled: miaoMiao.blePeripheral.nonFixedSlopeEnabled)
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -804,7 +804,7 @@ class BluetoothPeripheralManager: NSObject {
|
|||
|
||||
case .WatlaaType:
|
||||
|
||||
return WatlaaBluetoothTransmitter(address: nil, name: nil, cgmTransmitterDelegate: cgmTransmitterDelegate, bluetoothTransmitterDelegate: bluetoothTransmitterDelegate ?? self, watlaaBluetoothTransmitterDelegate: self, sensorSerialNumber: nil, webOOPEnabled: nil, oopWebSite: nil, oopWebToken: nil, nonFixedSlopeEnabled: nil)
|
||||
return WatlaaBluetoothTransmitter(address: nil, name: nil, cgmTransmitterDelegate: cgmTransmitterDelegate, bluetoothTransmitterDelegate: bluetoothTransmitterDelegate ?? self, watlaaBluetoothTransmitterDelegate: self, sensorSerialNumber: nil, webOOPEnabled: nil, nonFixedSlopeEnabled: nil)
|
||||
|
||||
case .DexcomG5Type:
|
||||
|
||||
|
@ -828,7 +828,7 @@ class BluetoothPeripheralManager: NSObject {
|
|||
fatalError("in createNewTransmitter, type DexcomG5Type, cgmTransmitterDelegate is nil")
|
||||
}
|
||||
|
||||
return CGMBubbleTransmitter(address: nil, name: nil, bluetoothTransmitterDelegate: bluetoothTransmitterDelegate ?? self, cGMBubbleTransmitterDelegate: self, cGMTransmitterDelegate: cgmTransmitterDelegate, sensorSerialNumber: nil, webOOPEnabled: nil, oopWebSite: nil, oopWebToken: nil, nonFixedSlopeEnabled: nil)
|
||||
return CGMBubbleTransmitter(address: nil, name: nil, bluetoothTransmitterDelegate: bluetoothTransmitterDelegate ?? self, cGMBubbleTransmitterDelegate: self, cGMTransmitterDelegate: cgmTransmitterDelegate, sensorSerialNumber: nil, webOOPEnabled: nil, nonFixedSlopeEnabled: nil)
|
||||
|
||||
case .MiaoMiaoType:
|
||||
|
||||
|
@ -836,7 +836,7 @@ class BluetoothPeripheralManager: NSObject {
|
|||
fatalError("in createNewTransmitter, MiaoMiaoType, cgmTransmitterDelegate is nil")
|
||||
}
|
||||
|
||||
return CGMMiaoMiaoTransmitter(address: nil, name: nil, bluetoothTransmitterDelegate: bluetoothTransmitterDelegate ?? self, cGMMiaoMiaoTransmitterDelegate: self, cGMTransmitterDelegate: cgmTransmitterDelegate, sensorSerialNumber: nil, webOOPEnabled: nil, oopWebSite: nil, oopWebToken: nil, nonFixedSlopeEnabled: nil)
|
||||
return CGMMiaoMiaoTransmitter(address: nil, name: nil, bluetoothTransmitterDelegate: bluetoothTransmitterDelegate ?? self, cGMMiaoMiaoTransmitterDelegate: self, cGMTransmitterDelegate: cgmTransmitterDelegate, sensorSerialNumber: nil, webOOPEnabled: nil, nonFixedSlopeEnabled: nil)
|
||||
|
||||
case .DropletType:
|
||||
|
||||
|
@ -937,8 +937,6 @@ class BluetoothPeripheralManager: NSObject {
|
|||
UserDefaults.standard.addObserver(self, forKeyPath: UserDefaults.Key.nightScoutUrl.rawValue, options: .new, context: nil)
|
||||
UserDefaults.standard.addObserver(self, forKeyPath: UserDefaults.Key.nightScoutAPIKey.rawValue, options: .new, context: nil)
|
||||
UserDefaults.standard.addObserver(self, forKeyPath: UserDefaults.Key.isMaster.rawValue, options: .new, context: nil)
|
||||
UserDefaults.standard.addObserver(self, forKeyPath: UserDefaults.Key.webOOPsite.rawValue, options: .new, context: nil)
|
||||
UserDefaults.standard.addObserver(self, forKeyPath: UserDefaults.Key.webOOPtoken.rawValue, options: .new, context: nil)
|
||||
|
||||
}
|
||||
|
||||
|
@ -1005,7 +1003,7 @@ class BluetoothPeripheralManager: NSObject {
|
|||
// first check keyValueObserverTimeKeeper
|
||||
switch keyPathEnum {
|
||||
|
||||
case UserDefaults.Key.m5StackWiFiName1, UserDefaults.Key.m5StackWiFiName2, UserDefaults.Key.m5StackWiFiName3, UserDefaults.Key.m5StackWiFiPassword1, UserDefaults.Key.m5StackWiFiPassword2, UserDefaults.Key.m5StackWiFiPassword3, UserDefaults.Key.nightScoutAPIKey, UserDefaults.Key.nightScoutUrl, UserDefaults.Key.bloodGlucoseUnitIsMgDl, UserDefaults.Key.m5StackBlePassword, UserDefaults.Key.webOOPsite, UserDefaults.Key.webOOPtoken :
|
||||
case UserDefaults.Key.m5StackWiFiName1, UserDefaults.Key.m5StackWiFiName2, UserDefaults.Key.m5StackWiFiName3, UserDefaults.Key.m5StackWiFiPassword1, UserDefaults.Key.m5StackWiFiPassword2, UserDefaults.Key.m5StackWiFiPassword3, UserDefaults.Key.nightScoutAPIKey, UserDefaults.Key.nightScoutUrl, UserDefaults.Key.bloodGlucoseUnitIsMgDl, UserDefaults.Key.m5StackBlePassword :
|
||||
|
||||
// transmittertype change triggered by user, should not be done within 200 ms
|
||||
if !keyValueObserverTimeKeeper.verifyKey(forKey: keyPathEnum.rawValue, withMinimumDelayMilliSeconds: 200) {
|
||||
|
@ -1120,27 +1118,10 @@ class BluetoothPeripheralManager: NSObject {
|
|||
}
|
||||
|
||||
case .WatlaaType, .DexcomG5Type, .BubbleType, .MiaoMiaoType, .BluconType, .GNSentryType, .BlueReaderType, .DropletType, .DexcomG4Type, .DexcomG6Type, .Libre2Type:
|
||||
|
||||
// nothing to check
|
||||
break
|
||||
|
||||
// oop website and oop web token need to be checked
|
||||
switch keyPathEnum {
|
||||
|
||||
case UserDefaults.Key.webOOPtoken, UserDefaults.Key.webOOPsite :
|
||||
|
||||
guard let cGMTransmitter = bluetoothTransmitter as? CGMTransmitter else {
|
||||
trace("in observeValue, bluetoothPeripheral is not of type CGMTransmitter", log: log, category: ConstantsLog.categoryBluetoothPeripheralManager, type: .error)
|
||||
return
|
||||
}
|
||||
|
||||
// set both oopWebToken and oopWebSite even if only one changed
|
||||
cGMTransmitter.setWebOOPToken(oopWebToken: UserDefaults.standard.webOOPtoken ?? ConstantsLibre.token)
|
||||
cGMTransmitter.setWebOOPSite(oopWebSite: UserDefaults.standard.webOOPSite ?? ConstantsLibre.site)
|
||||
// changing token and or url, so request new reading
|
||||
cGMTransmitter.requestNewReading()
|
||||
|
||||
default:
|
||||
break
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ class BluetoothPeripheralViewController: UIViewController {
|
|||
bluetoothPeripheralManager.setBluetoothTransmitterToNil(forBluetoothPeripheral: bluetoothPeripheral)
|
||||
|
||||
// as transmitter is now set to nil, call again configure. Maybe not necessary, but it can't hurt
|
||||
bluetoothPeripheralViewModel?.configure(bluetoothPeripheral: bluetoothPeripheral, bluetoothPeripheralManager: bluetoothPeripheralManager, tableView: tableView, bluetoothPeripheralViewController: self, onLibreSensorTypeReceived: libreSensorTypeReceived)
|
||||
bluetoothPeripheralViewModel?.configure(bluetoothPeripheral: bluetoothPeripheral, bluetoothPeripheralManager: bluetoothPeripheralManager, tableView: tableView, bluetoothPeripheralViewController: self)
|
||||
|
||||
// delegate doesn't work here anymore, because the delegate is set to zero, so reset the row with the connection status by calling reloadRows
|
||||
tableView.reloadRows(at: [IndexPath(row: Setting.connectionStatus.rawValue, section: 0)], with: .none)
|
||||
|
@ -239,46 +239,33 @@ class BluetoothPeripheralViewController: UIViewController {
|
|||
public func numberOfGeneralSections() -> Int {
|
||||
|
||||
// first check if bluetoothPeripheral already known
|
||||
if let bluetoothPeripheral = bluetoothPeripheral {
|
||||
if bluetoothPeripheral != nil {
|
||||
|
||||
// bluetoothPeripheral already known
|
||||
|
||||
// if sensor type is known and it requires oop web, then there's no need to show the oop web settings and the non-fixed slope settings
|
||||
if let sensorType = bluetoothPeripheral.blePeripheral.libreSensorType, sensorType.needsWebOOP(), !bluetoothPeripheral.overrideNeedsOOPWeb() {
|
||||
// if it's a cgm transmitter type that supports web oop and non fixed slopes
|
||||
// then show the webOOP section and nonFixed section
|
||||
if let expectedBluetoothPeripheralType = expectedBluetoothPeripheralType, expectedBluetoothPeripheralType.canWebOOP(), expectedBluetoothPeripheralType.canUseNonFixedSlope() {
|
||||
|
||||
// mark web oop and non fixed slope settings sections as shown
|
||||
webOOPSettingsSectionIsShown = true
|
||||
nonFixedSettingsSectionIsShown = true
|
||||
|
||||
return 3
|
||||
|
||||
// if bluetoothPeripheral already known,
|
||||
// and it's a cgm transmitter type that supports non fixed slopes but doesn't support weboop
|
||||
// then show only the nonFixed section
|
||||
} else if let expectedBluetoothPeripheralType = expectedBluetoothPeripheralType, expectedBluetoothPeripheralType.canUseNonFixedSlope() {
|
||||
|
||||
// mark web oop and non fixed slope settings sections as not shown
|
||||
webOOPSettingsSectionIsShown = false
|
||||
nonFixedSettingsSectionIsShown = false
|
||||
nonFixedSettingsSectionIsShown = true
|
||||
|
||||
return 1
|
||||
return 2
|
||||
|
||||
} else {
|
||||
|
||||
// if it's a cgm transmitter type that supports web oop and non fixed slopes
|
||||
// then show the webOOP section and nonFixed section
|
||||
if let expectedBluetoothPeripheralType = expectedBluetoothPeripheralType, expectedBluetoothPeripheralType.canWebOOP(), expectedBluetoothPeripheralType.canUseNonFixedSlope() {
|
||||
|
||||
// mark web oop and non fixed slope settings sections as shown
|
||||
webOOPSettingsSectionIsShown = true
|
||||
nonFixedSettingsSectionIsShown = true
|
||||
|
||||
return 3
|
||||
|
||||
// if bluetoothPeripheral already known,
|
||||
// and it's a cgm transmitter type that supports non fixed slopes but doesn't support weboop
|
||||
// then show only the nonFixed section
|
||||
} else if let expectedBluetoothPeripheralType = expectedBluetoothPeripheralType, expectedBluetoothPeripheralType.canUseNonFixedSlope() {
|
||||
|
||||
// mark web oop and non fixed slope settings sections as not shown
|
||||
webOOPSettingsSectionIsShown = false
|
||||
nonFixedSettingsSectionIsShown = true
|
||||
|
||||
return 2
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// bluetoothPeripheral not yet known, only show first section with name alias, ...
|
||||
|
@ -302,7 +289,7 @@ class BluetoothPeripheralViewController: UIViewController {
|
|||
bluetoothPeripheralViewModel = expectedBluetoothPeripheralType?.viewModel()
|
||||
|
||||
// configure the bluetoothPeripheralViewModel
|
||||
bluetoothPeripheralViewModel?.configure(bluetoothPeripheral: bluetoothPeripheral, bluetoothPeripheralManager: bluetoothPeripheralManager, tableView: tableView, bluetoothPeripheralViewController: self, onLibreSensorTypeReceived: libreSensorTypeReceived)
|
||||
bluetoothPeripheralViewModel?.configure(bluetoothPeripheral: bluetoothPeripheral, bluetoothPeripheralManager: bluetoothPeripheralManager, tableView: tableView, bluetoothPeripheralViewController: self)
|
||||
|
||||
// assign the self delegate in the transmitter object
|
||||
if let bluetoothPeripheral = bluetoothPeripheral, let bluetoothTransmitter = bluetoothPeripheralManager.getBluetoothTransmitter(for: bluetoothPeripheral, createANewOneIfNecesssary: false) {
|
||||
|
@ -430,7 +417,7 @@ class BluetoothPeripheralViewController: UIViewController {
|
|||
bluetoothPeripheral.blePeripheral.transmitterId = self.transmitterIdTempValue
|
||||
|
||||
// recall configure in bluetoothPeripheralViewModel
|
||||
self.bluetoothPeripheralViewModel?.configure(bluetoothPeripheral: self.bluetoothPeripheral, bluetoothPeripheralManager: bluetoothPeripheralManager, tableView: self.tableView, bluetoothPeripheralViewController: self, onLibreSensorTypeReceived: self.libreSensorTypeReceived)
|
||||
self.bluetoothPeripheralViewModel?.configure(bluetoothPeripheral: self.bluetoothPeripheral, bluetoothPeripheralManager: bluetoothPeripheralManager, tableView: self.tableView, bluetoothPeripheralViewController: self)
|
||||
|
||||
// enable the connect button
|
||||
self.connectButtonOutlet.enable()
|
||||
|
@ -614,7 +601,7 @@ class BluetoothPeripheralViewController: UIViewController {
|
|||
bluetoothTransmitter.bluetoothTransmitterDelegate = self
|
||||
|
||||
// call configure in the model, as we have a new transmitter here
|
||||
bluetoothPeripheralViewModel?.configure(bluetoothPeripheral: bluetoothPeripheral, bluetoothPeripheralManager: bluetoothPeripheralManager, tableView: tableView, bluetoothPeripheralViewController: self, onLibreSensorTypeReceived: libreSensorTypeReceived)
|
||||
bluetoothPeripheralViewModel?.configure(bluetoothPeripheral: bluetoothPeripheral, bluetoothPeripheralManager: bluetoothPeripheralManager, tableView: tableView, bluetoothPeripheralViewController: self)
|
||||
|
||||
// connect (probably connection is already done because transmitter has just been created by bluetoothPeripheralManager, this is a transmitter for which mac address is known, so it will by default try to connect
|
||||
bluetoothTransmitter.connect()
|
||||
|
@ -709,89 +696,6 @@ class BluetoothPeripheralViewController: UIViewController {
|
|||
|
||||
}
|
||||
|
||||
/// function called by model, if it receives a libre sensor type
|
||||
/// - parameters:
|
||||
/// - libreSensorType : will be ued to determine if oop web needs to be enabled or not
|
||||
/// - oopWebAllowed : if set to true then it overrules the libreSensorType determined vallue, if false then the libreSensorType determined value is used
|
||||
private func libreSensorTypeReceived(libreSensorType: LibreSensorType) {
|
||||
|
||||
// if the sensortype needs web oop, and if web oop or non fixed slope settings sections are shown then delete those sections
|
||||
// also check oopWebAllowed, if this is true, it overrules needsWebOOP
|
||||
// and if not, then the other way around
|
||||
|
||||
// check if overrideNeedsWebOOP needs to be set to true
|
||||
var overrideNeedsWebOOP = false
|
||||
if let bluetoothPeripheral = bluetoothPeripheral, bluetoothPeripheral.overrideNeedsOOPWeb() {
|
||||
overrideNeedsWebOOP = true
|
||||
}
|
||||
|
||||
if libreSensorType.needsWebOOP() && !overrideNeedsWebOOP {
|
||||
|
||||
var indexSet = IndexSet()
|
||||
|
||||
if webOOPSettingsSectionIsShown {
|
||||
|
||||
indexSet.insert(webOOPSettingsSectionNumber)
|
||||
|
||||
webOOPSettingsSectionIsShown = false
|
||||
|
||||
}
|
||||
|
||||
if nonFixedSettingsSectionIsShown {
|
||||
|
||||
indexSet.insert(nonFixedSettingsSectionNumber)
|
||||
|
||||
nonFixedSettingsSectionIsShown = false
|
||||
|
||||
}
|
||||
|
||||
if indexSet.count > 0 {
|
||||
|
||||
tableView.deleteSections(indexSet, with: .none)
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
var indexSet = IndexSet()
|
||||
|
||||
// unwrap expectedBluetoothPeripheralType, should be non nil here
|
||||
guard let expectedBluetoothPeripheralType = expectedBluetoothPeripheralType else {return}
|
||||
|
||||
if expectedBluetoothPeripheralType.canWebOOP() {
|
||||
|
||||
if !webOOPSettingsSectionIsShown {
|
||||
|
||||
indexSet.insert(webOOPSettingsSectionNumber)
|
||||
|
||||
webOOPSettingsSectionIsShown = true
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if expectedBluetoothPeripheralType.canUseNonFixedSlope() {
|
||||
|
||||
if !nonFixedSettingsSectionIsShown {
|
||||
|
||||
indexSet.insert(nonFixedSettingsSectionNumber)
|
||||
|
||||
nonFixedSettingsSectionIsShown = true
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if indexSet.count > 0 {
|
||||
|
||||
tableView.insertSections(indexSet, with: .none)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1087,21 +991,6 @@ extension BluetoothPeripheralViewController: UITableViewDataSource, UITableViewD
|
|||
|
||||
})
|
||||
|
||||
// check if overrideNeedsWebOOP needs to be set to true
|
||||
var overrideNeedsWebOOP = false
|
||||
if let bluetoothPeripheral = bluetoothPeripheral, bluetoothPeripheral.overrideNeedsOOPWeb() {
|
||||
overrideNeedsWebOOP = true
|
||||
}
|
||||
|
||||
// if it's a bluetoothPeripheral that supports libre and if it's a libre sensor type that needs oopWeb, then value can not be changed,
|
||||
if let bluetoothPeripheral = self.bluetoothPeripheral, let libreSensorType = bluetoothPeripheral.blePeripheral.libreSensorType {
|
||||
if libreSensorType.needsWebOOP() && !overrideNeedsWebOOP {
|
||||
|
||||
cell.accessoryView?.isUserInteractionEnabled = false
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
cell.accessoryType = .none
|
||||
|
||||
}
|
||||
|
|
|
@ -9,8 +9,7 @@ protocol BluetoothPeripheralViewModel {
|
|||
/// - bluetoothPeripheralManager : reference to bluetoothPeripheralManaging object
|
||||
/// - tableView : needed to intiate refresh of row
|
||||
/// - bluetoothPeripheralViewController : BluetoothPeripheralViewController
|
||||
/// - onLibreSensorTypeReceived : closure that the viewmodel should call when it receives a libre sensor type - doesn't need to be necessarily a new sensor type. This will allow the BluetoothPeripheralViewController to delete or add sections, namely oop web related settings
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController, onLibreSensorTypeReceived: ((LibreSensorType) -> ())?)
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController)
|
||||
|
||||
/// - for example M5StackBluetoothTransmitter has a delegate of type M5StackBluetoothTransmitterDelegate.
|
||||
/// - in the configure function, this varaible will be assigned to the viewmodel itself (if there is a M5StackBluetoothTransmitter)
|
||||
|
|
|
@ -58,9 +58,7 @@ class DexcomG4BluetoothPeripheralViewModel {
|
|||
|
||||
extension DexcomG4BluetoothPeripheralViewModel: BluetoothPeripheralViewModel {
|
||||
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController, onLibreSensorTypeReceived: ((LibreSensorType) -> ())?) {
|
||||
|
||||
// this type of transmitter does not receive libre sensor types, so the closure onLibreSensorTypeReceived does not need to be stored
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController) {
|
||||
|
||||
self.bluetoothPeripheralManager = bluetoothPeripheralManager
|
||||
|
||||
|
|
|
@ -126,9 +126,7 @@ class DexcomG5BluetoothPeripheralViewModel {
|
|||
|
||||
extension DexcomG5BluetoothPeripheralViewModel: BluetoothPeripheralViewModel {
|
||||
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController, onLibreSensorTypeReceived: ((LibreSensorType) -> ())?) {
|
||||
|
||||
// this type of transmitter does not receive libre sensor types, so the closure onLibreSensorTypeReceived does not need to be stored
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController) {
|
||||
|
||||
self.bluetoothPeripheralManager = bluetoothPeripheralManager
|
||||
|
||||
|
|
|
@ -61,9 +61,7 @@ class BluconBluetoothPeripheralViewModel {
|
|||
|
||||
extension BluconBluetoothPeripheralViewModel: BluetoothPeripheralViewModel {
|
||||
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController, onLibreSensorTypeReceived: ((LibreSensorType) -> ())?) {
|
||||
|
||||
// this type of transmitter does not receive libre sensor types, so the closure onLibreSensorTypeReceived does not need to be stored
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController) {
|
||||
|
||||
self.bluetoothPeripheralManager = bluetoothPeripheralManager
|
||||
|
||||
|
|
|
@ -49,9 +49,6 @@ class BubbleBluetoothPeripheralViewModel {
|
|||
}
|
||||
}
|
||||
|
||||
/// closure that the viewmodel should call when it receives a libre sensor type - doesn't need to be necessarily a new sensor type. This will allow the BluetoothPeripheralViewController to delete or add sections, namely oop web related settings.
|
||||
private var onLibreSensorTypeReceived: ((LibreSensorType) -> ())?
|
||||
|
||||
// MARK: - deinit
|
||||
|
||||
deinit {
|
||||
|
@ -76,9 +73,7 @@ class BubbleBluetoothPeripheralViewModel {
|
|||
|
||||
extension BubbleBluetoothPeripheralViewModel: BluetoothPeripheralViewModel {
|
||||
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController, onLibreSensorTypeReceived: ((LibreSensorType) -> ())?) {
|
||||
|
||||
self.onLibreSensorTypeReceived = onLibreSensorTypeReceived
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController) {
|
||||
|
||||
self.bluetoothPeripheralManager = bluetoothPeripheralManager
|
||||
|
||||
|
@ -304,9 +299,6 @@ extension BubbleBluetoothPeripheralViewModel: CGMBubbleTransmitterDelegate {
|
|||
// inform bluetoothPeripheralManager, bluetoothPeripheralManager will store the libreSensorType in the bubble object
|
||||
(bluetoothPeripheralManager as? CGMBubbleTransmitterDelegate)?.received(libreSensorType: libreSensorType, from: cGMBubbleTransmitter)
|
||||
|
||||
// inform bluetoothPeripheralViewController that sensor type was received
|
||||
onLibreSensorTypeReceived?(libreSensorType)
|
||||
|
||||
// here's the trigger to update the table row for sensorType
|
||||
reloadRow(row: Settings.sensorType.rawValue)
|
||||
|
||||
|
|
|
@ -58,9 +58,7 @@ class DropletBluetoothPeripheralViewModel {
|
|||
|
||||
extension DropletBluetoothPeripheralViewModel: BluetoothPeripheralViewModel {
|
||||
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController, onLibreSensorTypeReceived: ((LibreSensorType) -> ())?) {
|
||||
|
||||
// this type of transmitter does not receive libre sensor types, so the closure onLibreSensorTypeReceived does not need to be stored
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController) {
|
||||
|
||||
self.bluetoothPeripheralManager = bluetoothPeripheralManager
|
||||
|
||||
|
|
|
@ -64,9 +64,7 @@ class GNSEntryBluetoothPeripheralViewModel {
|
|||
|
||||
extension GNSEntryBluetoothPeripheralViewModel: BluetoothPeripheralViewModel {
|
||||
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController, onLibreSensorTypeReceived: ((LibreSensorType) -> ())?) {
|
||||
|
||||
// this type of transmitter does not receive libre sensor types, so the closure onLibreSensorTypeReceived does not need to be stored
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController) {
|
||||
|
||||
self.bluetoothPeripheralManager = bluetoothPeripheralManager
|
||||
|
||||
|
|
|
@ -65,9 +65,7 @@ class Libre2BluetoothPeripheralViewModel {
|
|||
|
||||
extension Libre2BluetoothPeripheralViewModel: BluetoothPeripheralViewModel {
|
||||
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController, onLibreSensorTypeReceived: ((LibreSensorType) -> ())?) {
|
||||
|
||||
// this type of transmitter does not receive libre sensor types, so the closure onLibreSensorTypeReceived does not need to be stored
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController) {
|
||||
|
||||
self.bluetoothPeripheralManager = bluetoothPeripheralManager
|
||||
|
||||
|
|
|
@ -49,9 +49,6 @@ class MiaoMiaoBluetoothPeripheralViewModel {
|
|||
}
|
||||
}
|
||||
|
||||
/// closure that the viewmodel should call when it receives a libre sensor type - doesn't need to be necessarily a new sensor type. This is to conform to protocol BluetoothPeripheralViewModel
|
||||
private var onLibreSensorTypeReceived: ((LibreSensorType) -> ())?
|
||||
|
||||
// MARK: - deinit
|
||||
|
||||
deinit {
|
||||
|
@ -76,9 +73,7 @@ class MiaoMiaoBluetoothPeripheralViewModel {
|
|||
|
||||
extension MiaoMiaoBluetoothPeripheralViewModel: BluetoothPeripheralViewModel {
|
||||
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController, onLibreSensorTypeReceived: ((LibreSensorType) -> ())?) {
|
||||
|
||||
self.onLibreSensorTypeReceived = onLibreSensorTypeReceived
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController) {
|
||||
|
||||
self.bluetoothPeripheralManager = bluetoothPeripheralManager
|
||||
|
||||
|
@ -244,9 +239,6 @@ extension MiaoMiaoBluetoothPeripheralViewModel: CGMMiaoMiaoTransmitterDelegate {
|
|||
// inform bluetoothPeripheralManager, bluetoothPeripheralManager will store the libreSensorType in the miaomiao object
|
||||
(bluetoothPeripheralManager as? CGMMiaoMiaoTransmitterDelegate)?.received(libreSensorType: libreSensorType, from: cGMMiaoMiaoTransmitter)
|
||||
|
||||
// inform bluetoothPeripheralViewController that sensor type was received
|
||||
onLibreSensorTypeReceived?(libreSensorType)
|
||||
|
||||
// here's the trigger to update the table row for sensorType
|
||||
reloadRow(row: Settings.sensorType.rawValue)
|
||||
|
||||
|
|
|
@ -596,15 +596,7 @@ extension M5StackBluetoothPeripheralViewModel: BluetoothPeripheralViewModel {
|
|||
return M5StackSections(rawValue: section)?.sectionTitle() ?? ""
|
||||
}
|
||||
|
||||
/// - parameters :
|
||||
/// - bluetoothTransmitterDelegate : usually the uiViewController
|
||||
/// - bluetoothPeripheral : if nil then the viewcontroller is opened to scan for a new peripheral
|
||||
/// - bluetoothPeripheralManager : reference to bluetoothPeripheralManaging object
|
||||
/// - tableView : needed to initiate refresh of row
|
||||
/// - bluetoothPeripheralViewController : BluetoothPeripheralViewController
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController, onLibreSensorTypeReceived: ((LibreSensorType) -> ())?) {
|
||||
|
||||
// this type of transmitter does not receive libre sensor types, so the closure onLibreSensorTypeReceived does not need to be stored
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController) {
|
||||
|
||||
self.bluetoothPeripheralManager = bluetoothPeripheralManager
|
||||
|
||||
|
|
|
@ -61,9 +61,7 @@ class WatlaaBluetoothPeripheralViewModel {
|
|||
|
||||
extension WatlaaBluetoothPeripheralViewModel: BluetoothPeripheralViewModel {
|
||||
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController, onLibreSensorTypeReceived: ((LibreSensorType) -> ())?) {
|
||||
|
||||
// this type of transmitter does not receive libre sensor types, so the closure onLibreSensorTypeReceived does not need to be stored
|
||||
func configure(bluetoothPeripheral: BluetoothPeripheral?, bluetoothPeripheralManager: BluetoothPeripheralManaging, tableView: UITableView, bluetoothPeripheralViewController: BluetoothPeripheralViewController) {
|
||||
|
||||
self.bluetoothPeripheralManager = bluetoothPeripheralManager
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ final class RootViewController: UIViewController {
|
|||
|
||||
@IBAction func calibrateButtonAction(_ sender: UIButton) {
|
||||
|
||||
if let cgmTransmitter = self.bluetoothPeripheralManager?.getCGMTransmitter(), cgmTransmitter.isWebOOPEnabled(), !UserDefaults.standard.overrideWebOOPCalibration {
|
||||
if let cgmTransmitter = self.bluetoothPeripheralManager?.getCGMTransmitter(), cgmTransmitter.isWebOOPEnabled() {
|
||||
|
||||
let alert = UIAlertController(title: Texts_Common.warning, message: Texts_HomeView.calibrationNotNecessary, actionHandler: nil)
|
||||
|
||||
|
@ -327,9 +327,6 @@ final class RootViewController: UIViewController {
|
|||
// also update of unit requires update of badge
|
||||
UserDefaults.standard.addObserver(self, forKeyPath: UserDefaults.Key.bloodGlucoseUnitIsMgDl.rawValue, options: .new, context: nil)
|
||||
|
||||
// when overrideWebOOPCalibration changes, sensor needs to be restarted
|
||||
UserDefaults.standard.addObserver(self, forKeyPath: UserDefaults.Key.overrideWebOOPCalibration.rawValue, options: .new, context: nil)
|
||||
|
||||
// setup delegate for UNUserNotificationCenter
|
||||
UNUserNotificationCenter.current().delegate = self
|
||||
|
||||
|
@ -755,8 +752,7 @@ final class RootViewController: UIViewController {
|
|||
if newReadingCreated {
|
||||
|
||||
// only if no webOOPEnabled : if no two calibration exist yet then create calibration request notification, otherwise a bgreading notification and update labels
|
||||
// if overrideWebOOPCalibration true, then override value of isWebOOPEnabled
|
||||
if firstCalibrationForActiveSensor == nil && lastCalibrationForActiveSensor == nil && (!cgmTransmitter.isWebOOPEnabled() || UserDefaults.standard.overrideWebOOPCalibration) {
|
||||
if firstCalibrationForActiveSensor == nil && lastCalibrationForActiveSensor == nil && !cgmTransmitter.isWebOOPEnabled() {
|
||||
|
||||
// there must be at least 2 readings
|
||||
let latestReadings = bgReadingsAccessor.getLatestBgReadings(limit: 36, howOld: nil, forSensor: activeSensor, ignoreRawData: false, ignoreCalculatedValue: true)
|
||||
|
@ -818,7 +814,7 @@ final class RootViewController: UIViewController {
|
|||
// first check keyValueObserverTimeKeeper
|
||||
switch keyPathEnum {
|
||||
|
||||
case UserDefaults.Key.isMaster, UserDefaults.Key.overrideWebOOPCalibration, UserDefaults.Key.multipleAppBadgeValueWith10, UserDefaults.Key.showReadingInAppBadge, UserDefaults.Key.bloodGlucoseUnitIsMgDl :
|
||||
case UserDefaults.Key.isMaster, UserDefaults.Key.multipleAppBadgeValueWith10, UserDefaults.Key.showReadingInAppBadge, UserDefaults.Key.bloodGlucoseUnitIsMgDl :
|
||||
|
||||
// transmittertype change triggered by user, should not be done within 200 ms
|
||||
if !keyValueObserverTimeKeeper.verifyKey(forKey: keyPathEnum.rawValue, withMinimumDelayMilliSeconds: 200) {
|
||||
|
@ -855,25 +851,6 @@ final class RootViewController: UIViewController {
|
|||
// this will trigger update of app badge, will also create notification, but as app is most likely in foreground, this won't show up
|
||||
createBgReadingNotificationAndSetAppBadge(overrideShowReadingInNotification: true)
|
||||
|
||||
case UserDefaults.Key.overrideWebOOPCalibration:
|
||||
|
||||
// user changes file of override web oop
|
||||
// apply logic only if web oop is enabled
|
||||
if let cgmTransmitter = self.bluetoothPeripheralManager?.getCGMTransmitter(), cgmTransmitter.isWebOOPEnabled() {
|
||||
|
||||
trace("in observeValue, overrideWebOOPCalibration value changed to %{public}@, will stop the sensor", log: self.log, category: ConstantsLog.categoryRootView, type: .info, UserDefaults.standard.overrideWebOOPCalibration.description)
|
||||
|
||||
// stop the sensor
|
||||
stopSensor()
|
||||
|
||||
// assign new calibrator
|
||||
calibrator = getCalibrator(cgmTransmitter: cgmTransmitter)
|
||||
|
||||
// request a new reading
|
||||
cgmTransmitter.requestNewReading()
|
||||
|
||||
}
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
@ -1118,7 +1095,7 @@ final class RootViewController: UIViewController {
|
|||
|
||||
case .miaomiao, .GNSentry, .Blucon, .Bubble, .Droplet1, .blueReader, .watlaa, .Libre2:
|
||||
|
||||
if cgmTransmitter.isWebOOPEnabled() && !UserDefaults.standard.overrideWebOOPCalibration {
|
||||
if cgmTransmitter.isWebOOPEnabled() {
|
||||
|
||||
// received values are already calibrated
|
||||
|
||||
|
@ -1126,15 +1103,6 @@ final class RootViewController: UIViewController {
|
|||
|
||||
return NoCalibrator()
|
||||
|
||||
} else if cgmTransmitter.isWebOOPEnabled() && UserDefaults.standard.overrideWebOOPCalibration {
|
||||
|
||||
// oop web enabled, means readings received are calibrated values
|
||||
// overrideWebOOPCalibration enabled, means recalibration to be done
|
||||
|
||||
trace("in getCalibrator, calibrator = LibreReCalibrator", log: log, category: ConstantsLog.categoryRootView, type: .info)
|
||||
|
||||
return LibreReCalibrator()
|
||||
|
||||
} else if cgmTransmitter.isNonFixedSlopeEnabled() {
|
||||
|
||||
// no oop web, non-fixed slope
|
||||
|
|
Loading…
Reference in New Issue