From 5eec790038974e9f0ad484679e458c5c088c856d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=B3nal=20Murray?= <donal.murray@cern.ch> Date: Thu, 16 Apr 2020 14:51:58 +0100 Subject: [PATCH] Add alarm codes to enum in both C++ and python commsConstants files --- .../common/lib/commsControl/commsConstants.h | 29 +++++++++++++++++- raspberry-dataserver/commsConstants.py | 30 +++++++++++++++++-- 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/arduino/common/lib/commsControl/commsConstants.h b/arduino/common/lib/commsControl/commsConstants.h index 1d658631..9db5fced 100644 --- a/arduino/common/lib/commsControl/commsConstants.h +++ b/arduino/common/lib/commsControl/commsConstants.h @@ -31,11 +31,38 @@ #define PACKET_DATA 0x40 #define PACKET_SET 0x20 //set vs get ? -#define HEV_FORMAT_VERSION 0xA0 +#define HEV_FORMAT_VERSION 0xA1 enum command_codes {CMD_START = 1, CMD_STOP = 2}; +// Taken from safety doc. Correct as of 1400 on 20200416 +enum alarm_codes {APNEA = 1, // HP + CHECK_VALVE_EXHALE = 2, // HP + CHECK_P_PATIENT = 3, // HP + EXPIRATION_SENSE_FAULT_OR_LEAK = 4, // MP + EXPIRATION_VALVE_Leak = 5, // MP + HIGH_FIO2 = 6, // MP + HIGH_PRESSURE = 7, // HP + HIGH_RR = 8, // MP + HIGH_VTE = 9, // MP + LOW_VTE = 10, // MP + HIGH_VTI = 11, // MP + LOW_VTI = 12, // MP + INTENTIONAL_STOP = 13, // HP + LOW_BATTERY = 14, // HP (LP) if AC power isn't (is) connected + LOW_FIO2 = 15, // HP + OCCLUSION = 16, // HP + HIGH_PEEP = 17, // HP + LOW_PEEP = 18, // HP + AC_POWER_DISCONNECTION = 19, // MP + BATTERY_FAULT_SRVC = 20, // MP + BATTERY_CHARGE = 21, // MP + AIR_FAIL = 22, // HP + O2_FAIL = 23, // HP + PRESSURE_SENSOR_FAULT = 24, // HP + ARDUINO_FAIL = 25}; // HP + // struct for all data sent struct dataFormat { uint8_t version = HEV_FORMAT_VERSION; // diff --git a/raspberry-dataserver/commsConstants.py b/raspberry-dataserver/commsConstants.py index cb4ca007..e75a7577 100644 --- a/raspberry-dataserver/commsConstants.py +++ b/raspberry-dataserver/commsConstants.py @@ -17,7 +17,7 @@ class payloadType(Enum): class BaseFormat(): def __init__(self): - self._RPI_VERSION = 0xA0 + self._RPI_VERSION = 0xA1 self._byteArray = None self._type = payloadType.payloadUnset self._version = 0 @@ -289,5 +289,29 @@ class alarmFormat(BaseFormat): @unique class alarm_codes(Enum): - ALARM_START = 1 - ALARM_STOP = 2 \ No newline at end of file + # Taken from safety doc. Correct as of 1400 on 20200416 + APNEA = 1 # HP + CHECK_VALVE_EXHALE = 2 # HP + CHECK_P_PATIENT = 3 # HP + EXPIRATION_SENSE_FAULT_OR_LEAK = 4 # MP + EXPIRATION_VALVE_Leak = 5 # MP + HIGH_FIO2 = 6 # MP + HIGH_PRESSURE = 7 # HP + HIGH_RR = 8 # MP + HIGH_VTE = 9 # MP + LOW_VTE = 10 # MP + HIGH_VTI = 11 # MP + LOW_VTI = 12 # MP + INTENTIONAL_STOP = 13 # HP + LOW_BATTERY = 14 # HP (LP) if AC power isn't (is) connected + LOW_FIO2 = 15 # HP + OCCLUSION = 16 # HP + HIGH_PEEP = 17 # HP + LOW_PEEP = 18 # HP + AC_POWER_DISCONNECTION = 19 # MP + BATTERY_FAULT_SRVC = 20 # MP + BATTERY_CHARGE = 21 # MP + AIR_FAIL = 22 # HP + O2_FAIL = 23 # HP + PRESSURE_SENSOR_FAULT = 24 # HP + ARDUINO_FAIL = 25 # HP -- GitLab