diff --git a/scripts/eventgen/EventFunctions.cpp.template b/scripts/eventgen/EventFunctions.cpp.template new file mode 100644 index 0000000000000000000000000000000000000000..1611abafb11180cdadeafae5294f45acc4f85f78 --- /dev/null +++ b/scripts/eventgen/EventFunctions.cpp.template @@ -0,0 +1,53 @@ +/* Copyright (c) 2018-2020 Skyward Experimental Rocketry + * Authors: Luca Erbetta, Alvise de' Faveri Tron + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/* + ****************************************************************************** + * THIS FILE IS AUTOGENERATED. DO NOT EDIT. * + ****************************************************************************** + */ + +// Autogen date: {date} + + +#include "Events.h" +#include "Topics.h" + +#include <map> + +string getEventString(uint8_t event) +{{ + static const map<uint8_t, string> event_string_map {{ +{event_map_data} + }}; + auto it = event_string_map.find(event); + return it == event_string_map.end() ? "EV_UNKNOWN" : it->second; +}} + +string getTopicString(uint8_t topic) +{{ + static const map<uint8_t, string> topic_string_map{{ +{topic_map_data} + }}; + auto it = topic_string_map.find(topic); + return it == topic_string_map.end() ? "TOPIC_UNKNOWN" : it->second; +}} \ No newline at end of file diff --git a/scripts/eventgen/Events.h.template b/scripts/eventgen/Events.h.template new file mode 100644 index 0000000000000000000000000000000000000000..bd9cc25367ec63690cfc588a877778f110f09791 --- /dev/null +++ b/scripts/eventgen/Events.h.template @@ -0,0 +1,57 @@ +/* Copyright (c) 2018-2020 Skyward Experimental Rocketry + * Authors: Luca Erbetta, Alvise de' Faveri Tron + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/* + ****************************************************************************** + * THIS FILE IS AUTOGENERATED. DO NOT EDIT. * + ****************************************************************************** + */ + +// Autogen date: {date} + +#pragma once + +#include <cstdint> +#include <string> + +#include "events/Event.h" +#include "events/EventBroker.h" +#include "EventClasses.h" +#include "Topics.h" + +using std::string; +using std::map; + +/** + * Definition of all events signals. +enum Events : uint8_t +{{ +{enum_data} +}}; + +/** + * @brief Returns the name of the provided event + * + * @param event + * @return string + */ +string getEventString(uint8_t event); \ No newline at end of file diff --git a/scripts/eventgen/README.md b/scripts/eventgen/README.md new file mode 100644 index 0000000000000000000000000000000000000000..7bfb1c9b0625ffdfc86794475246b92e6251e586 --- /dev/null +++ b/scripts/eventgen/README.md @@ -0,0 +1,10 @@ +# Events Generator Script + +This script generates Events.h, Topics.h and EventFunctions.cpp from a list of +SCXML files representing the state machines of a project. + +To execute the script: + +`./eventgen.py <LIST_OF_SCXML_FILES>` + +The files will be generated in the generated/ folder. \ No newline at end of file diff --git a/scripts/eventgen/Topics.h.template b/scripts/eventgen/Topics.h.template new file mode 100644 index 0000000000000000000000000000000000000000..2ce2c2c536a6ba099b7c72ab2df987ccf9449fd3 --- /dev/null +++ b/scripts/eventgen/Topics.h.template @@ -0,0 +1,54 @@ +/* Copyright (c) 2018-2020 Skyward Experimental Rocketry + * Authors: Luca Erbetta, Alvise de' Faveri Tron + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/* + ****************************************************************************** + * THIS FILE IS AUTOGENERATED. DO NOT EDIT. * + ****************************************************************************** + */ + +// Autogen date: {date} + +#pragma once + +#include <stdint.h> +#include <string> + +using std::map; +using std::string; + +/** + * Definition of various event topics to use in the EventBroker + */ +enum Topics : uint8_t +{{ +{enum_data} +}}; + +/** + * @brief Returns the name of the provided event + * + * @param event + * @return string + */ +string getTopicString(uint8_t topic); + diff --git a/scripts/eventgen/eventgen.py b/scripts/eventgen/eventgen.py new file mode 100755 index 0000000000000000000000000000000000000000..9c36223a3266a22a65961776074efcfc0bd14656 --- /dev/null +++ b/scripts/eventgen/eventgen.py @@ -0,0 +1,200 @@ +#!/usr/bin/python3 + +# Copyright (c) 2018-2020 Skyward Experimental Rocketry +# Authors: Luca Erbetta, Alvise de' Faveri Tron +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +import re +import datetime +from os.path import join +import os + +import xml.etree.ElementTree as ET +import sys +from collections import OrderedDict + +OUTPUT_FOLDER = "generated" + +# +# ASCII art banner +# +def printBanner(): + print("+--------------------------------------------------------+") + print("| ____ _ _ |") + print("| / ___|| | ___ ___ ____ _ _ __ __| | |") + print("| \\___ \\| |/ / | | \\ \\ /\\ / / _` | '__/ _` | |") + print("| ___) | <| |_| |\\ V V / (_| | | | (_| | |") + print("| |____/|_|\\_\\\\__, | \\_/\\_/ \\__,_|_| \\__,_| |") + print("| _____|___/ _ |") + print("| | ____|_ _____ _ __ | |_ __ _ ___ _ __ |") + print("| | _| \\ \\ / / _ \\ '_ \\| __/ _` |/ _ \\ '_ \\ |") + print("| | |___ \\ V / __/ | | | || (_| | __/ | | | |") + print("| |_____| \\_/ \\___|_| |_|\\__\\__, |\\___|_| |_| |") + print("| |___/ |") + print("+--------------------------------------------------------+") + +# +# Parse SCXML file(s) +# +def parse_scxml(files): + events = [] + topics = [] + + for file in files: + print("parsing " + str(file)) + tree = ET.parse(str(file)) + root = tree.getroot() + + # find all transitions and related events + first = 0 + for child in root: + for tran in child.iter('{http://www.w3.org/2005/07/scxml}transition'): + if(tran.attrib['target'] != 'final'): + ev = tran.attrib['event'] + + try: + topics.append("TOPIC_" + ev.split('.')[0]) + events.append(ev.split('.')[1]) + + except: + print("Cannot parse the event name... Forgot the topic?") + print(tran.tag, tran.attrib) + + # remove duplicates + events = list(OrderedDict.fromkeys(events)) + topics = list(OrderedDict.fromkeys(topics)) + events.sort() + topics.sort() + + print("{} events loaded.".format(len(events))) + print("{} topics loaded.".format(len(topics))) + + return events, topics + +# +# Generate Events.h +# +def generate_events(events, date): + enum_str = "" + event_map_str = "" + + # generate string + for e in events: + endl = ",\n" if e != events[-1] else "" + enum_str += " " + e + \ + (" = EV_FIRST_SIGNAL" if e == events[0] else "") + endl + event_map_str += " {{ {event}, {string} }}{endl}".format( + event=e, string='"' + e + '"', endl=endl) + + # read template + with open('Events.h.template', 'r') as template_file: + template = template_file.read() + + # write template + template = template.format(date=date, enum_data=enum_str) + + with open(join(OUTPUT_FOLDER, 'Events.h'), 'w') as header_file: + header_file.write(template) + + return event_map_str + +# +# Generate Topics.h +# +def generate_topics(topics, date): + enum_str = "" + topic_map_str = "" + + for t in topics: + endl = ",\n" if t != topics[-1] else "" + enum_str += " " + t + endl + topic_map_str += " {{ {topics}, {string} }}{endl}".format( + topics=t, string='"' + t + '"', endl=endl) + + with open('Topics.h.template', 'r') as template_file: + template = template_file.read() + + template = template.format(date=date, enum_data=enum_str) + + with open(join(OUTPUT_FOLDER, 'Topics.h'), 'w') as header_file: + header_file.write(template) + + return topic_map_str + +# +# Generate EventFunctions.cpp +# +def generate_functions(event_map_str, topic_map_str, date): + with open('EventFunctions.cpp.template', 'r') as cpp_template_file: + cpp = cpp_template_file.read() + + cpp = cpp.format(date=date, event_map_data=event_map_str, topic_map_data=topic_map_str) + + with open(join(OUTPUT_FOLDER, 'EventFunctions.cpp'), 'w') as cpp_file: + cpp_file.write(cpp) + +# +# Main +# +printBanner() +print() +print("Skyward SCXML event generator") +print() + +if(len(sys.argv) < 2): + print("Error: no SCXML files provided.\nUsage: eventgen.py <SCXML_FILES>") + sys.exit(-1) + +if not os.path.exists(OUTPUT_FOLDER): + os.mkdir(OUTPUT_FOLDER) + +date = datetime.datetime.now() + +print("-"*30) +print("Parsing SCXML files...") +events, topics = parse_scxml(sys.argv[1:]) + +print("-"*30) +print("Generating Events.h...") +event_map_str = generate_events(events, date) +print("OK\n") + +print("-"*30) +print("Generating Topics.h...") +topic_map_str = generate_topics(topics, date) +print("OK\n") + +print("-"*30) +print("Generating EventFunctions.cpp...") +generate_functions(event_map_str, topic_map_str, date) +print("OK\n") + + +# print +print("-"*30) +print("Events:\n") +for e in events: + print(e) +print("\n\nTopics:\n") +for t in topics: + print(t) + +print("-"*30) +print("... Done.") diff --git a/scripts/eventgen/generated/EventFunctions.cpp b/scripts/eventgen/generated/EventFunctions.cpp new file mode 100644 index 0000000000000000000000000000000000000000..02d008a49c6ce8d7e107f62ec2b9604004dcf216 --- /dev/null +++ b/scripts/eventgen/generated/EventFunctions.cpp @@ -0,0 +1,97 @@ +/* Copyright (c) 2018-2020 Skyward Experimental Rocketry + * Authors: Luca Erbetta, Alvise de' Faveri Tron + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/* + ****************************************************************************** + * THIS FILE IS AUTOGENERATED. DO NOT EDIT. * + ****************************************************************************** + */ + +// Autogen date: 2020-03-10 02:43:07.380770 + + +#include "Events.h" +#include "Topics.h" + +#include <map> + +string getEventString(uint8_t event) +{ + static const map<uint8_t, string> event_string_map { + { EV_ADA_APOGEE_DETECTED, "EV_ADA_APOGEE_DETECTED" }, + { EV_ADA_READY, "EV_ADA_READY" }, + { EV_APOGEE, "EV_APOGEE" }, + { EV_ARMED, "EV_ARMED" }, + { EV_CALIBRATE_ADA, "EV_CALIBRATE_ADA" }, + { EV_DISARMED, "EV_DISARMED" }, + { EV_IMU_READY, "EV_IMU_READY" }, + { EV_INIT_ERROR, "EV_INIT_ERROR" }, + { EV_INIT_OK, "EV_INIT_OK" }, + { EV_LIFTOFF, "EV_LIFTOFF" }, + { EV_NC_BACKUP, "EV_NC_BACKUP" }, + { EV_NC_DETACHED, "EV_NC_DETACHED" }, + { EV_NC_OPEN, "EV_NC_OPEN" }, + { EV_NC_TEST, "EV_NC_TEST" }, + { EV_RESET_SERVO, "EV_RESET_SERVO" }, + { EV_SEND_HR_TM, "EV_SEND_HR_TM" }, + { EV_SEND_LR_TM, "EV_SEND_LR_TM" }, + { EV_SEND_TEST_TM, "EV_SEND_TEST_TM" }, + { EV_STATS_TIMEOUT, "EV_STATS_TIMEOUT" }, + { EV_TC_ARM, "EV_TC_ARM" }, + { EV_TC_CALIBRATE_ADA, "EV_TC_CALIBRATE_ADA" }, + { EV_TC_CALIBRATE_IMU, "EV_TC_CALIBRATE_IMU" }, + { EV_TC_CLOSE_LOG, "EV_TC_CLOSE_LOG" }, + { EV_TC_DISARM, "EV_TC_DISARM" }, + { EV_TC_END_MISSION, "EV_TC_END_MISSION" }, + { EV_TC_FORCE_INIT, "EV_TC_FORCE_INIT" }, + { EV_TC_FORCE_LAUNCH, "EV_TC_FORCE_LAUNCH" }, + { EV_TC_NC_BACKUP, "EV_TC_NC_BACKUP" }, + { EV_TC_NC_OPEN, "EV_TC_NC_OPEN" }, + { EV_TC_RESET, "EV_TC_RESET" }, + { EV_TC_RESET_SERVO, "EV_TC_RESET_SERVO" }, + { EV_TC_TEST_MODE, "EV_TC_TEST_MODE" }, + { EV_TC_WIGGLE_SERVO, "EV_TC_WIGGLE_SERVO" }, + { EV_TIMEOUT_BACKUP, "EV_TIMEOUT_BACKUP" }, + { EV_TIMEOUT_END_MISSION, "EV_TIMEOUT_END_MISSION" }, + { EV_TIMEOUT_NC_OPEN, "EV_TIMEOUT_NC_OPEN" }, + { EV_TIMEOUT_SHADOW_MODE, "EV_TIMEOUT_SHADOW_MODE" }, + { EV_UMBILICAL_DETACHED, "EV_UMBILICAL_DETACHED" }, + { EV_WIGGLE_SERVO, "EV_WIGGLE_SERVO" } + }; + auto it = event_string_map.find(event); + return it == event_string_map.end() ? "EV_UNKNOWN" : it->second; +} + +string getTopicString(uint8_t topic) +{ + static const map<uint8_t, string> topic_string_map{ + { TOPIC_ADA, "TOPIC_ADA" }, + { TOPIC_DPL, "TOPIC_DPL" }, + { TOPIC_FLIGHT, "TOPIC_FLIGHT" }, + { TOPIC_FMM, "TOPIC_FMM" }, + { TOPIC_PINS, "TOPIC_PINS" }, + { TOPIC_STATS, "TOPIC_STATS" }, + { TOPIC_TMTC, "TOPIC_TMTC" } + }; + auto it = topic_string_map.find(topic); + return it == topic_string_map.end() ? "TOPIC_UNKNOWN" : it->second; +} \ No newline at end of file diff --git a/scripts/eventgen/generated/Events.h b/scripts/eventgen/generated/Events.h new file mode 100644 index 0000000000000000000000000000000000000000..702a385b310b413438209e5f781eeb0e3fc78b5b --- /dev/null +++ b/scripts/eventgen/generated/Events.h @@ -0,0 +1,97 @@ +/* Copyright (c) 2018-2020 Skyward Experimental Rocketry + * Authors: Luca Erbetta, Alvise de' Faveri Tron + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/* + ****************************************************************************** + * THIS FILE IS AUTOGENERATED. DO NOT EDIT. * + ****************************************************************************** + */ + +// Autogen date: 2020-03-10 02:43:07.380770 + +#pragma once + +#include <cstdint> +#include <string> + +#include "events/Event.h" +#include "events/EventBroker.h" +#include "EventClasses.h" +#include "Topics.h" + +using std::string; +using std::map; + +/** + * Definition of all events in the Homeone Board software + * Refer to section 5.1.1 of the Software Design Document. + */ +enum Events : uint8_t +{ + EV_ADA_APOGEE_DETECTED = EV_FIRST_SIGNAL, + EV_ADA_READY, + EV_APOGEE, + EV_ARMED, + EV_CALIBRATE_ADA, + EV_DISARMED, + EV_IMU_READY, + EV_INIT_ERROR, + EV_INIT_OK, + EV_LIFTOFF, + EV_NC_BACKUP, + EV_NC_DETACHED, + EV_NC_OPEN, + EV_NC_TEST, + EV_RESET_SERVO, + EV_SEND_HR_TM, + EV_SEND_LR_TM, + EV_SEND_TEST_TM, + EV_STATS_TIMEOUT, + EV_TC_ARM, + EV_TC_CALIBRATE_ADA, + EV_TC_CALIBRATE_IMU, + EV_TC_CLOSE_LOG, + EV_TC_DISARM, + EV_TC_END_MISSION, + EV_TC_FORCE_INIT, + EV_TC_FORCE_LAUNCH, + EV_TC_NC_BACKUP, + EV_TC_NC_OPEN, + EV_TC_RESET, + EV_TC_RESET_SERVO, + EV_TC_TEST_MODE, + EV_TC_WIGGLE_SERVO, + EV_TIMEOUT_BACKUP, + EV_TIMEOUT_END_MISSION, + EV_TIMEOUT_NC_OPEN, + EV_TIMEOUT_SHADOW_MODE, + EV_UMBILICAL_DETACHED, + EV_WIGGLE_SERVO +}; + +/** + * @brief Returns the name of the provided event + * + * @param event + * @return string + */ +string getEventString(uint8_t event); \ No newline at end of file diff --git a/scripts/eventgen/generated/Topics.h b/scripts/eventgen/generated/Topics.h new file mode 100644 index 0000000000000000000000000000000000000000..7d27de00dd459eb8315718d3a8cc5fc89c131bd9 --- /dev/null +++ b/scripts/eventgen/generated/Topics.h @@ -0,0 +1,60 @@ +/* Copyright (c) 2018-2020 Skyward Experimental Rocketry + * Authors: Luca Erbetta, Alvise de' Faveri Tron + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/* + ****************************************************************************** + * THIS FILE IS AUTOGENERATED. DO NOT EDIT. * + ****************************************************************************** + */ + +// Autogen date: 2020-03-10 02:43:07.380770 + +#pragma once + +#include <stdint.h> +#include <string> + +using std::map; +using std::string; + +/** + * Definition of various event topics to use in the EventBroker + */ +enum Topics : uint8_t +{ + TOPIC_ADA, + TOPIC_DPL, + TOPIC_FLIGHT, + TOPIC_FMM, + TOPIC_PINS, + TOPIC_STATS, + TOPIC_TMTC +}; + +/** + * @brief Returns the name of the provided event + * + * @param event + * @return string + */ +string getTopicString(uint8_t topic); +