Skip to content

Calibration

Johan Degraeve edited this page Feb 10, 2019 · 6 revisions

Summary

The algorithms folder has protocols and classes which define the Calibration. Only algorithms, no data storage.
Also no read of access to data defined in other classes, the necessary data is passed when calling the functions.

For a new type of Sensor (only Libre and Dexcom at the moment), a new class needs to be created that conforms to the protocol CalibratorProtocol and then defines only the variables sParams and ageAdjustMentNeeded.

To use the CalibratorProtocol, the functions are initialCalibration, createNewBgReading, createNewCalibration

protocol CalibratorProtocol

Defines variables en functions.
The variables need to be adopted by class that conform to the protocol.
The variables are typical sensor type depenent :

  • var sParams:SlopeParameters{get}
    //this variable defines sParams for type of sensor
  • var ageAdjustMentNeeded:Bool{get}
    //age adjustment needed or not, which is not the case for Libre

extension CalibratorProtocol

Following functions in protocol CalibratorProtocol are implemented in the extension CalibratorProtocol:

  • initialCalibration
  • createNewBgReading
  • createNewCalibration

Available CalibratorProtocol

Dexcom

class DexcomCalibrator

Libre1

class Libre1Calibrator