1+ #pragma once
2+
3+ #include < functional>
4+
5+ namespace zest ::competition {
6+ /* *
7+ * @brief the competition mode (disabled, driver control, autonomous)
8+ *
9+ */
10+ enum class Mode {
11+ Disabled,
12+ DriverControl,
13+ Autonomous,
14+ };
15+
16+ /* *
17+ * @brief the competition system being used
18+ *
19+ */
20+ enum class System {
21+ FieldControl,
22+ CompetitionSwitch,
23+ None,
24+ };
25+
26+ /* *
27+ * @brief Get the competition mode (disabled, driver control, autonomous)
28+ *
29+ * @return Status
30+ */
31+ Mode get_mode ();
32+
33+ /* *
34+ * @brief Get the system type being used (field control, competition switch, or none)
35+ *
36+ * @return System
37+ */
38+ System get_system ();
39+
40+ /* *
41+ * @brief Whether field control or a competition switch is connected
42+ *
43+ * @return true
44+ * @return false
45+ */
46+ bool is_connected ();
47+
48+ /* *
49+ * @brief register the callable that will be called when the autonomous period starts.
50+ *
51+ * The callable is called whenever the competition state changes to autonomous. The task that runs
52+ * it is killed as soon as the competition state changes to driver control or disabled.
53+ *
54+ * @param callable
55+ */
56+ void register_autonomous (std::function<void ()> callable);
57+
58+ /* *
59+ * @brief register the callable that will be called when the driver control period starts.
60+ *
61+ * The callable is called whenever the competition state changes to autonomous. The task that runs
62+ * it is killed as soon as the competition state changes to driver control or disabled.
63+ *
64+ * @param callable
65+ */
66+ void register_driver_control (std::function<void ()> callable);
67+
68+ /* *
69+ * @brief register the callable that will be called when the disabled period starts.
70+ *
71+ * The callable is called whenever the competition state changes to autonomous. The task that
72+ * runs it is killed as soon as the competition state changes to driver control or disabled.
73+ *
74+ * @param callable
75+ */
76+ void register_disabled (std::function<void ()> callable);
77+
78+ /* *
79+ * @brief initialize the competition control task
80+ *
81+ * TODO: figure out how to hide this from the user
82+ *
83+ * This function is called after `int main` is called.
84+ */
85+ void initialize ();
86+ } // namespace zest::competition
0 commit comments