11 #include "../includes/alarm_controller.h"
12 #include "../includes/config.h"
13 #include "../includes/cycle.h"
15 #include "../includes/end_of_line_test.h"
19 #define PROTOCOL_VERSION 2u
29 uint8_t plateauCommand,
32 uint8_t expiratoryTerm,
34 uint8_t triggerOffset,
38 uint8_t inspiratoryTriggerFlow,
39 uint8_t expiratoryTriggerFlow,
42 uint8_t lowInspiratoryMinuteVolumeAlarmThreshold,
43 uint8_t highInspiratoryMinuteVolumeAlarmThreshold,
44 uint8_t lowExpiratoryMinuteVolumeAlarmThreshold,
45 uint8_t highExpiratoryMinuteVolumeAlarmThreshold,
46 uint8_t lowRespiratoryRateAlarmThreshold,
47 uint8_t highRespiratoryRateAlarmThreshold,
48 uint16_t targetTidalVolumeValue,
49 uint16_t lowTidalVolumeAlarmThresholdValue,
50 uint16_t highTidalVolumeAlarmThresholdValue,
51 uint16_t plateauDurationValue,
52 uint16_t leakAlarmThresholdValue,
53 uint8_t targetInspiratoryFlow,
54 uint16_t inspiratoryDurationCommandValue,
55 uint16_t batteryLevelValue,
58 uint8_t patientHeight,
59 uint8_t patientGender,
60 uint16_t peakPressureAlarmThresholdValue);
66 uint8_t blowerValvePosition,
67 uint8_t patientValvePosition,
70 int16_t inspiratoryFlowValue,
71 int16_t expiratoryFlowValue);
77 uint8_t plateauCommand,
80 uint16_t previousPeakPressureValue,
81 uint16_t previousPlateauPressureValue,
82 uint16_t previousPeepPressureValue,
85 uint8_t expiratoryTerm,
87 uint8_t triggerOffset,
88 uint8_t previouscpmValue,
92 uint8_t inspiratoryTriggerFlow,
93 uint8_t expiratoryTriggerFlow,
96 uint8_t lowInspiratoryMinuteVolumeAlarmThreshold,
97 uint8_t highInspiratoryMinuteVolumeAlarmThreshold,
98 uint8_t lowExpiratoryMinuteVolumeAlarmThreshold,
99 uint8_t highExpiratoryMinuteVolumeAlarmThreshold,
100 uint8_t lowRespiratoryRateAlarmThreshold,
101 uint8_t highRespiratoryRateAlarmThreshold,
102 uint16_t targetTidalVolumeValue,
103 uint16_t lowTidalVolumeAlarmThresholdValue,
104 uint16_t highTidalVolumeAlarmThresholdValue,
105 uint16_t plateauDurationValue,
106 uint16_t leakAlarmThresholdValue,
107 uint8_t targetInspiratoryFlow,
108 uint16_t inspiratoryDurationCommandValue,
109 uint16_t previousInspiratoryDurationValue,
110 uint16_t batteryLevelValue,
111 uint16_t localeValue,
112 uint8_t patientHeight,
113 uint8_t patientGender,
114 uint16_t peakPressureAlarmThresholdValue);
124 uint32_t expectedValue,
125 uint32_t measuredValue,
126 uint32_t cyclesSinceTriggerValue);
138 int16_t flowAtStartingValue,
139 int16_t flowWithBlowerOnValue);
152 void sendEolTestSnapshot(TestStep step, TestState state, char message[]);
AlarmPriority
Priority levels of an alarm.
VentilationModes
Supported ventilation modes.
CyclePhases
Defines the 2 main phases of the respiratory cycle.
void sendMassFlowMeterFatalError(void)
Send a "mass flow meter" fatal error.
void sendCalibrationFatalError(int16_t pressureOffsetValue, int16_t minPressureValue, int16_t maxPressureValue, int16_t flowAtStartingValue, int16_t flowWithBlowerOnValue)
void sendWatchdogRestartFatalError(void)
Send a "watchdog restart" fatal error.
void sendControlAck(uint8_t setting, uint16_t value)
Send a "control ack" message.
void sendInconsistentPressureFatalError(uint16_t pressureValue)
void sendBatteryDeeplyDischargedFatalError(uint16_t batteryLevelValue)
Send a "battery deeply discharged" fatal error.
uint8_t mmH2OtoCmH2O(uint16_t pressure)
Convert and round a pressure in mmH2O to a pressure in cmH2O.
void initTelemetry(void)
Prepare Serial6 to send telemetry data.
void sendAlarmTrap(uint16_t centileValue, int16_t pressureValue, CyclePhases phase, uint32_t cycleValue, uint8_t alarmCode, AlarmPriority alarmPriority, bool triggered, uint32_t expectedValue, uint32_t measuredValue, uint32_t cyclesSinceTriggerValue)
Send a "alarm trap" message.
void sendStoppedMessage(uint8_t peakCommand, uint8_t plateauCommand, uint8_t peepCommand, uint8_t cpmCommand, uint8_t expiratoryTerm, bool triggerEnabled, uint8_t triggerOffset, bool alarmSnoozed, uint8_t cpuLoad, VentilationModes ventilationMode, uint8_t inspiratoryTriggerFlow, uint8_t expiratoryTriggerFlow, uint16_t tiMinValue, uint16_t tiMaxValue, uint8_t lowInspiratoryMinuteVolumeAlarmThreshold, uint8_t highInspiratoryMinuteVolumeAlarmThreshold, uint8_t lowExpiratoryMinuteVolumeAlarmThreshold, uint8_t highExpiratoryMinuteVolumeAlarmThreshold, uint8_t lowRespiratoryRateAlarmThreshold, uint8_t highRespiratoryRateAlarmThreshold, uint16_t targetTidalVolumeValue, uint16_t lowTidalVolumeAlarmThresholdValue, uint16_t highTidalVolumeAlarmThresholdValue, uint16_t plateauDurationValue, uint16_t leakAlarmThresholdValue, uint8_t targetInspiratoryFlow, uint16_t inspiratoryDurationCommandValue, uint16_t batteryLevelValue, uint8_t currentAlarmCodes[ALARMS_SIZE], uint16_t localeValue, uint8_t patientHeight, uint8_t patientGender, uint16_t peakPressureAlarmThresholdValue)
Send a "stopped" message.
void sendBootMessage(void)
Send a "boot" message.
void sendDataSnapshot(uint16_t centileValue, int16_t pressureValue, CyclePhases phase, uint8_t blowerValvePosition, uint8_t patientValvePosition, uint8_t blowerRpm, uint8_t batteryLevel, int16_t inspiratoryFlowValue, int16_t expiratoryFlowValue)
Send a "data snapshot" message.
void sendMachineStateSnapshot(uint32_t cycleValue, uint8_t peakCommand, uint8_t plateauCommand, uint8_t peepCommand, uint8_t cpmCommand, uint16_t previousPeakPressureValue, uint16_t previousPlateauPressureValue, uint16_t previousPeepPressureValue, uint8_t currentAlarmCodes[ALARMS_SIZE], uint16_t volumeValue, uint8_t expiratoryTerm, bool triggerEnabled, uint8_t triggerOffset, uint8_t previouscpmValue, bool alarmSnoozed, uint8_t cpuLoad, VentilationModes ventilationMode, uint8_t inspiratoryTriggerFlow, uint8_t expiratoryTriggerFlow, uint16_t tiMinValue, uint16_t tiMaxValue, uint8_t lowInspiratoryMinuteVolumeAlarmThreshold, uint8_t highInspiratoryMinuteVolumeAlarmThreshold, uint8_t lowExpiratoryMinuteVolumeAlarmThreshold, uint8_t highExpiratoryMinuteVolumeAlarmThreshold, uint8_t lowRespiratoryRateAlarmThreshold, uint8_t highRespiratoryRateAlarmThreshold, uint16_t targetTidalVolumeValue, uint16_t lowTidalVolumeAlarmThresholdValue, uint16_t highTidalVolumeAlarmThresholdValue, uint16_t plateauDurationValue, uint16_t leakAlarmThresholdValue, uint8_t targetInspiratoryFlow, uint16_t inspiratoryDurationCommandValue, uint16_t previousInspiratoryDurationValue, uint16_t batteryLevelValue, uint16_t localeValue, uint8_t patientHeight, uint8_t patientGender, uint16_t peakPressureAlarmThresholdValue)
Send a "machine state snapshot" message.