Libre US - using web oop and getLibreRawGlucoseOOPOA2Data, to test

This commit is contained in:
Johan Degraeve 2020-07-04 21:41:32 +02:00
parent 75bbaf7d4a
commit f2c73e425f
4 changed files with 8 additions and 16 deletions

View File

@ -212,10 +212,10 @@ class CGMBubbleTransmitter:BluetoothTransmitter, CGMTransmitter {
}
// do this for tracing only, not processing will continue if crc check fails
if libreSensorType == .libreProH || libreSensorType == .libreUS {
if libreSensorType == .libreProH {
if !Crc.LibreCrc(data: &self.rxBuffer, headerOffset: self.bubbleHeaderLength) {
trace(" libreProH or libreUS sensor, CRC check failed - will continue processing anyway", log: self.log, category: ConstantsLog.categoryCGMBubble, type: .info)
trace(" libreProH sensor, CRC check failed - will continue processing anyway", log: self.log, category: ConstantsLog.categoryCGMBubble, type: .info)
}
}

View File

@ -171,7 +171,7 @@ class CGMMiaoMiaoTransmitter:BluetoothTransmitter, CGMTransmitter {
cGMMiaoMiaoTransmitterDelegate?.received(libreSensorType: libreSensorType, from: self)
// do CRC Check only for libre1
// TODO : check if this also required for other types of libre sensor
// TODO : check if this also required for other LibreH
if libreSensorType == .libre1 {
guard Crc.LibreCrc(data: &rxBuffer, headerOffset: miaoMiaoHeaderLength) else {

View File

@ -124,7 +124,7 @@ class LibreDataParser {
switch libreSensorType {
case .libre1, .libreUS, .libreProH:// these types are all Libre 1
case .libre1, .libreProH:// these types are all Libre 1
// get LibreDerivedAlgorithmParameters and parse using the libre1DerivedAlgorithmParameters
LibreOOPClient.getLibre1DerivedAlgorithmParameters(bytes: libreData, libreSensorSerialNumber: libreSensorSerialNumber, oopWebSite: oopWebSite, oopWebToken: oopWebToken) { (libre1DerivedAlgorithmParameters) in
@ -135,20 +135,14 @@ class LibreDataParser {
}
// can be deleted once all libre types work well
trace("in libreDataProcessor, received libre1DerivedAlgorithmParameters", log: log, category: ConstantsLog.categoryLibreDataParser, type: .debug)
// parse the data using oop web algorithm
let parsedResult = parseLibre1DataWithOOPWebCalibration(libreData: libreData, libre1DerivedAlgorithmParameters: libre1DerivedAlgorithmParameters, timeStampLastBgReading: timeStampLastBgReading)
// can be deleted once all libre types work well
trace("in libreDataProcessor, processed libre1DerivedAlgorithmParameters", log: log, category: ConstantsLog.categoryLibreDataParser, type: .debug)
handleGlucoseData(result: (parsedResult.libreRawGlucoseData.map { $0 as GlucoseData }, parsedResult.sensorTimeInMinutes, parsedResult.sensorState, nil), cgmTransmitterDelegate: cgmTransmitterDelegate, libreSensorSerialNumber: libreSensorSerialNumber, completionHandler: completionHandler)
}
case .libre1A2:
case .libre1A2, .libreUS:
LibreOOPClient.getLibreRawGlucoseOOPOA2Data(libreData: libreData, oopWebSite: oopWebSite) { (libreRawGlucoseOOPA2Data) in
@ -182,8 +176,6 @@ class LibreDataParser {
// convert libreRawGlucoseOOPData to (libreRawGlucoseData:[LibreRawGlucoseData], sensorState:LibreSensorState, sensorTimeInMinutes:Int?)
let parsedResult = libreRawGlucoseOOPData.glucoseData(timeStampLastBgReading: timeStampLastBgReading)
debuglogging("in libreDataProcessor, parsedResult.gluosedata size = " + parsedResult.libreRawGlucoseData.count.description)
handleGlucoseData(result: (parsedResult.libreRawGlucoseData.map { $0 as GlucoseData }, parsedResult.sensorTimeInMinutes, parsedResult.sensorState, nil), cgmTransmitterDelegate: cgmTransmitterDelegate, libreSensorSerialNumber: libreSensorSerialNumber, completionHandler: completionHandler)
}
@ -198,11 +190,11 @@ class LibreDataParser {
// handle the result
handleGlucoseData(result: (parsedLibre1Data.glucoseData, parsedLibre1Data.sensorTimeInMinutes, parsedLibre1Data.sensorState, nil), cgmTransmitterDelegate: cgmTransmitterDelegate, libreSensorSerialNumber: libreSensorSerialNumber, completionHandler: completionHandler)
} else {
// it's not a libre 1 and oop web is enabled, so there's nothing we can do
trace("in libreDataProcessor, can not continue - web oop is enabled, but there's missing info in the request", log: log, category: ConstantsLog.categoryLibreDataParser, type: .info)
}
}

View File

@ -43,10 +43,10 @@ public enum LibreSensorType: String {
switch self {
case .libre1, .libreUS, .libreProH:
case .libre1, .libreProH:
return false
case .libre1A2, .libre2 :
case .libre1A2, .libre2, .libreUS:
return true
}