SatNOGS-COMMS  4.1.0
A COMMS subsystem for CubeSats
Loading...
Searching...
No Matches
mission.cpp
Go to the documentation of this file.
1/*
2 * SatNOGS-COMMS MCU software
3 *
4 * Copyright (C) 2025, Libre Space Foundation <http://libre.space>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * SPDX-License-Identifier: GNU General Public License v3.0 or later
20 */
21
22#include "mission.hpp"
23
24namespace satnogs::comms
25{
26
31void
33{
34 m_pre_init.call_if();
35}
36
42void
43mission::register_pre_init(etl::delegate<void(void)> callback)
44{
45 m_pre_init = callback;
46}
47
52void
54{
55 m_post_init.call_if();
56}
57
63void
64mission::register_post_init(etl::delegate<void(void)> callback)
65{
66 m_post_init = callback;
67}
68
73void
75{
76 m_start.call_if();
77}
78
84void
85mission::register_start(etl::delegate<void(void)> callback)
86{
87 m_start = callback;
88}
89
95void
97 etl::delegate<bool(msg_arbiter::msg &msg)> callback)
98{
99 m_msg_parser = callback;
100}
101
102void
104 etl::delegate<bool(msg_arbiter::msg &msg)> callback)
105{
106 m_sp_msg_parser = callback;
107}
108
121bool
123{
124 if (is_sp) {
125 auto x = m_sp_msg_parser.call_if(msg);
126 return x.value_or(false);
127 } else {
128 auto x = m_msg_parser.call_if(msg);
129 return x.value_or(false);
130 }
131}
132
133} // namespace satnogs::comms
void start() const
This method is called at the end of the startup::start().
Definition mission.cpp:74
bool msg_parser(msg_arbiter::msg &msg, bool is_sp)
This method is called inside the msg_arbiter, in case an incoming message was not parsed by the defau...
Definition mission.cpp:122
void register_start(etl::delegate< void(void)> callback)
Registers a callback for the start().
Definition mission.cpp:85
void register_sp_msg_parser(etl::delegate< bool(msg_arbiter::msg &msg)> callback)
Definition mission.cpp:103
void register_pre_init(etl::delegate< void(void)> callback)
Registers a callback for the pre_init().
Definition mission.cpp:43
void register_post_init(etl::delegate< void(void)> callback)
Registers a callback for the post_init().
Definition mission.cpp:64
void register_msg_parser(etl::delegate< bool(msg_arbiter::msg &msg)> callback)
Registers a callback for the msg_parser().
Definition mission.cpp:96
void pre_init() const
This method is called before the satnogs::comms::lib::board::init().
Definition mission.cpp:32
void post_init() const
This method is called after the satnogs::comms::lib::board::init().
Definition mission.cpp:53