eive-tmtc/eive_tmtc/config/events.py

23 lines
662 B
Python
Raw Normal View History

2023-02-01 11:17:04 +01:00
import logging
2022-12-01 11:14:28 +01:00
import os
2022-12-01 14:16:06 +01:00
from eive_tmtc import EIVE_TMTC_ROOT
2022-12-01 11:14:28 +01:00
from tmtccmd.fsfw import parse_fsfw_events_csv
2023-01-18 11:12:07 +01:00
from tmtccmd.pus.s5_event import EventDictT
2022-12-01 11:14:28 +01:00
2022-12-01 16:21:05 +01:00
DEFAULT_EVENTS_CSV_PATH = EIVE_TMTC_ROOT / "config/events.csv"
2022-12-01 11:14:28 +01:00
__EVENT_DICT = None
def get_event_dict() -> EventDictT:
global __EVENT_DICT
if __EVENT_DICT is None:
if os.path.exists(DEFAULT_EVENTS_CSV_PATH):
__EVENT_DICT = parse_fsfw_events_csv(DEFAULT_EVENTS_CSV_PATH)
else:
2023-02-01 15:58:34 +01:00
logging.getLogger(__name__).warning(
f"No Event CSV file found at {DEFAULT_EVENTS_CSV_PATH}"
)
2022-12-01 11:14:28 +01:00
__EVENT_DICT = dict()
return __EVENT_DICT