public interface SafetySystem
Modifier and Type | Method and Description |
---|---|
void |
acceptCarbRecommendation(java.util.Date date)
Notifies the safety system that a carbohydrate recommendation has been accepted.
|
void |
addCarbs(java.util.Date date,
double carbs)
Registers a manual carbohydrate intake with the safety system.
|
void |
addInsulin(java.util.Date date,
double insulin)
Registers a manual insulin administration with the safety system.
|
void |
addRecommendation(org.json.JSONObject caseJson)
Registers a finalised case with the safety system.
|
void |
clearDatabase()
Clears the database, this should be called after a successful JSON export.
|
double |
constrainBolus(org.json.JSONObject caseJson)
Returns the bolus and manipulates the case JSON.
|
org.json.JSONObject |
createJsonExport()
Creates and returns the Safety System JSON Object.
|
void |
declineCarbRecommendation(java.util.Date date)
Registers with the safety system that a carbohydrate recommendation has been declined.
|
SafetyAlarmProfile |
getAlarmProfile()
Returns the current alarm profile.
|
double |
getCarbRecommendation()
Returns the carbohydrate recommendation.
|
java.lang.String |
getCarbRecommendationAsString()
Returns the carbohydrate recommendation as a String.
|
double |
getCarbsOnBoard()
Returns the carbohydrates on board for the latest reading.
|
java.lang.String |
getCarbsOnBoardAsString()
Returns the carbohydrates on board for the latest reading as a String.
|
SafetyCarerAlarm |
getCarerAlarm()
Returns the carer alarm value for the latest reading.
|
double |
getCurrentICR()
Returns the users current ICR value for the current system time.
|
double |
getCurrentISF()
Returns the users current ISF value for the current system time.
|
SafetyFault |
getFault()
Determines whether there is a fault associated with the latest reading.
|
SafetyGlucoseAlarm |
getGlucoseAlarm()
Returns the glucose alarm value for the latest reading.
|
SafetyGlucoseAlert |
getGlucoseAlert()
Returns the glucose alert value for the latest reading.
|
double |
getGlucoseDerivative()
Returns the glucose derivative
|
double |
getGlucoseForecast()
Returns the glucose forecast value for the latest reading.
|
java.lang.String |
getGlucoseForecastAsString()
Returns the glucose forecast value for the latest reading as a String.
|
SafetyGlucoseTrend |
getGlucoseTrend()
Returns the glucose trend.
|
double |
getHyperThreshold()
Gets the hyper threshold of the safety system.
|
double |
getHypoThreshold()
Gets the hypo threshold of the safety system.
|
double |
getInsulinOnBoard()
Returns the insulin on board for the latest reading.
|
java.lang.String |
getInsulinOnBoardAsString()
Returns the insulin on board for the latest reading as a String.
|
SafetyLowGlucoseSuspend |
getLowGlucoseSuspend()
Returns the glucose derivative value for the latest reading.
|
java.lang.String |
getPatientId()
Returns the patient id.
|
boolean |
hasCarbRecommendation()
Returns true if there is a carbohydrate recommendation.
|
boolean |
hasCarerAlarm()
Returns true if there is a carer alarm.
|
boolean |
hasFault()
Returns true if there is a fault.
|
boolean |
hasGlucoseAlarm()
Returns true if there is a glucose alarm.
|
boolean |
hasGlucoseAlert()
Returns true if there is a glucose alert.
|
boolean |
initSafetySystem(org.json.JSONObject json)
Initialising the Safety System through a JSON object, the Safety System must be initialised
prior to using the Safety System otherwise operations that effect.
|
boolean |
isActive()
Returns true if the safety system is active.
|
boolean |
isCarerHyperAlarmEnabled()
Returns true if carer hyper alarms are enabled.
|
boolean |
isInitialised()
Returns true if the Safety System has been initialised, otherwise false.
|
void |
recalculateInsulin(double insulinAdministered)
Removes insulin from the Safety System Model for IoB correction when
the pump is stopped
|
void |
resumePumpOverride()
Forces the pump to fully resume for 60 minutes.
|
void |
setActive(boolean active)
Set whether the safety system is active or not.
|
void |
setAlarmProfile(SafetyAlarmProfile profile)
Sets or updates the safety system alarm profile.
|
void |
setCarerHyperAlarmEnabled(boolean enabled)
Enables or disables carer hyper alarms.
|
void |
setHyperThreshold(double hyperThreshold)
Updates the hyper threshold of the safety system.
|
void |
setHypoThreshold(double hypoThreshold)
Updates the hypo threshold of the safety system.
|
void |
snoozeAlarm(java.util.Date date)
Snoozes the safety system alarms.
|
void |
update(java.util.Date date,
double glucose)
Runs the main algorithms of the Safety System, returning a Reading with the computed values.
|
boolean initSafetySystem(org.json.JSONObject json)
json
- the JSON to initialise the main Patient Objectboolean isInitialised()
boolean isActive()
void setActive(boolean active)
void update(java.util.Date date, double glucose)
date
- the datetime at which the update occurredglucose
- the latest CGM glucose readingIllegalSafetySystemStateException
- if the Safety System has not yet been initialisedvoid addRecommendation(org.json.JSONObject caseJson) throws org.json.JSONException, java.text.ParseException
caseJson
- the CBR JSON object after a case is completeIllegalSafetySystemStateException
- if the Safety System has not yet been initialisedorg.json.JSONException
- if the JSON is malformedjava.text.ParseException
- if there is an error parsing the JSONvoid addCarbs(java.util.Date date, double carbs)
date
- the datetime at which the update occurredcarbs
- the carbohydrate intake in gramsIllegalSafetySystemStateException
- if the Safety System has not yet been initialisedvoid addInsulin(java.util.Date date, double insulin)
date
- the datetime at which the update occurredinsulin
- the insulin doseIllegalSafetySystemStateException
- if the Safety System has not yet been initialisedvoid snoozeAlarm(java.util.Date date)
date
- the datetime at which the update occurredIllegalSafetySystemStateException
- if the Safety System has not yet been initialisedvoid acceptCarbRecommendation(java.util.Date date)
date
- the datetime at which the update occurredIllegalSafetySystemStateException
- if the Safety System has not yet been initialisedvoid declineCarbRecommendation(java.util.Date date)
date
- the datetime at which the update occurredIllegalSafetySystemStateException
- if the Safety System has not yet been initialiseddouble constrainBolus(org.json.JSONObject caseJson) throws org.json.JSONException, java.text.ParseException
caseJson
- A JSON object containing a CBR case.org.json.JSONException
- if the JSON is malformedjava.text.ParseException
- if there is an error parsing the JSONorg.json.JSONObject createJsonExport() throws org.json.JSONException
org.json.JSONException
- if there is an error generating the JSON Object.IllegalSafetySystemStateException
- if the Safety System has not yet been initialiseddouble getCarbsOnBoard()
IllegalSafetySystemStateException
- if the Safety System has not yet been initialisedjava.lang.String getCarbsOnBoardAsString()
IllegalSafetySystemStateException
- if the Safety System has not yet been initialiseddouble getInsulinOnBoard()
IllegalSafetySystemStateException
- if the Safety System has not yet been initialisedjava.lang.String getInsulinOnBoardAsString()
IllegalSafetySystemStateException
- if the Safety System has not yet been initialiseddouble getGlucoseForecast()
IllegalSafetySystemStateException
- if the Safety System has not yet been initialisedjava.lang.String getGlucoseForecastAsString()
IllegalSafetySystemStateException
- if the Safety System has not yet been initialisedSafetyGlucoseTrend getGlucoseTrend()
IllegalSafetySystemStateException
- if the Safety System has not yet been initialisedSafetyLowGlucoseSuspend getLowGlucoseSuspend()
IllegalSafetySystemStateException
- if the Safety System has not yet been initialisedboolean hasCarbRecommendation()
double getCarbRecommendation()
IllegalSafetySystemStateException
- if the Safety System has not yet been initialisedjava.lang.String getCarbRecommendationAsString()
IllegalSafetySystemStateException
- if the Safety System has not yet been initialisedSafetyGlucoseAlert getGlucoseAlert()
IllegalSafetySystemStateException
- if the Safety System has not yet been initialisedboolean hasGlucoseAlert()
IllegalSafetySystemStateException
- if the Safety System has not yet been initialisedSafetyGlucoseAlarm getGlucoseAlarm()
IllegalSafetySystemStateException
- if the Safety System has not yet been initialisedboolean hasGlucoseAlarm()
IllegalSafetySystemStateException
- if the Safety System has not yet been initialisedboolean hasFault()
IllegalSafetySystemStateException
- if the Safety System has not yet been initalisedSafetyFault getFault()
IllegalSafetySystemStateException
- if the Safety System has not yet been initialisedSafetyCarerAlarm getCarerAlarm()
IllegalSafetySystemStateException
- if the Safety System has not yet been initialisedboolean hasCarerAlarm()
IllegalSafetySystemStateException
- if the Safety System has not yet been initialisedSafetyAlarmProfile getAlarmProfile()
void setAlarmProfile(SafetyAlarmProfile profile)
profile
- the alarm profile to be usedjava.lang.String getPatientId()
IllegalSafetySystemStateException
- if the Safety System has not yet been initialiseddouble getGlucoseDerivative()
double getHypoThreshold()
IllegalSafetySystemStateException
- if the Safety System has not yet been initalisedvoid setHypoThreshold(double hypoThreshold)
hypoThreshold
- the hypo thresholdIllegalSafetySystemStateException
- if the Safety System has not yet been initaliseddouble getHyperThreshold()
IllegalSafetySystemStateException
- if the Safety System has not yet been initalisedvoid setHyperThreshold(double hyperThreshold)
hyperThreshold
- the hypo thresholdIllegalSafetySystemStateException
- if the Safety System has not yet been initalisedvoid clearDatabase()
IllegalSafetySystemStateException
- if the Safety System has not yet been initaliseddouble getCurrentISF()
IllegalSafetySystemStateException
- if the Safety System has not yet been initalised or
if the users ISF values are invaliddouble getCurrentICR()
IllegalSafetySystemStateException
- if the Safety System has not yet been initalised or
if the users ISF values are invalidvoid resumePumpOverride()
void recalculateInsulin(double insulinAdministered)
insulinAdministered
- insulin actually administeredboolean isCarerHyperAlarmEnabled()
void setCarerHyperAlarmEnabled(boolean enabled)
enabled
- if true Hyper alarms for carers will be triggered.