Add string representations for vehicle statuses

This commit is contained in:
XANTRONIX Development 2024-01-04 16:04:17 -05:00
parent be21fb4be7
commit 4c7f997deb

View file

@ -11,19 +11,39 @@ class VehicleStatus(enum.Enum):
BEAMS_PARKING = 1 << 6
BELT = 1 << 7
CAUTION = 1 << 8
COLLISION = 1 << 9
COOLANT_LOW = 1 << 10
COOLANT_OVERHEAT = 1 << 11
CRUISE = 1 << 12
FUEL_LOW = 1 << 13
LANEKEEP_OFF = 1 << 14
ENGINE_FAULT = 1 << 15
OIL_LOW = 1 << 16
OIL_OVERHEAT = 1 << 17
STABILITY_OFF = 1 << 18
TPMS_WARNING = 1 << 19
TPMS_FAULT = 1 << 20
TRACTION_OFF = 1 << 21
TRACTION_FAULT = 1 << 22
WARNING = 1 << 23
WIPER_WASHER_LOW = 1 << 24
COLD = 1 << 9
COLLISION = 1 << 10
COOLANT_LOW = 1 << 11
COOLANT_OVERHEAT = 1 << 12
CRUISE = 1 << 13
FUEL_LOW = 1 << 14
LANEKEEP_OFF = 1 << 15
ENGINE_FAULT = 1 << 16
OIL_LOW = 1 << 17
OIL_OVERHEAT = 1 << 18
STABILITY_OFF = 1 << 19
TPMS_WARNING = 1 << 20
TPMS_FAULT = 1 << 21
TRACTION_OFF = 1 << 22
TRACTION_FAULT = 1 << 23
WARNING = 1 << 24
WIPER_WASHER_LOW = 1 << 25
__strings__ = {
OK: 'OK', ABS_FAULT: "ABS fault", AIRBAG_FAULT: "airbag fault",
BATTERY_FAULT: "low battery voltage", BEAMS_FOG: "foglights on",
BEAMS_HIGH: "highbeams on", BEAMS_LOW: "lowbeams on",
BEAMS_PARKING: "parking beams on", BELT: "warning: fasten seatbelt",
CAUTION: "caution", COLLISION: "collision detected",
COOLANT_LOW: "coolant low", COOLANT_OVERHEAT: "engine overheating",
CRUISE: "cruise control on", FUEL_LOW: "fuel low",
LANEKEEP_OFF: "lane assist deactivated", ENGINE_FAULT: "check engine",
OIL_LOW: "oil level low", OIL_OVERHEAT: "oil overheating",
STABILITY_OFF: "stability control off", TPMS_WARNING: "check tire pressures",
TPMS_FAULT: "tire pressure monitoring system fault",
TRACTION_OFF: "traction control off", WARNING: "warning, drive with caution",
WIPER_WASHER_LOW: "wiper washer fluid low"
}
def __str__(self):
return self.__strings__.get(self.value, "unknown")