SatNOGS-COMMS  4.1.0
A COMMS subsystem for CubeSats
Loading...
Searching...
No Matches
mission.hpp
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#pragma once
23
24#include "msg_arbiter.hpp"
25#include <etl/delegate.h>
26#include <etl/delegate_service.h>
27
28namespace satnogs::comms
29{
30
56{
57public:
58 void
59 pre_init() const;
60
61 void
62 register_pre_init(etl::delegate<void(void)> callback);
63
64 void
65 post_init() const;
66
67 void
68 register_post_init(etl::delegate<void(void)> callback);
69
70 void
71 start() const;
72
73 void
74 register_start(etl::delegate<void(void)> callback);
75
76 void
77 register_msg_parser(etl::delegate<bool(msg_arbiter::msg &msg)> callback);
78
79 void
80 register_sp_msg_parser(etl::delegate<bool(msg_arbiter::msg &msg)> callback);
81
82 bool
83 msg_parser(msg_arbiter::msg &msg, bool is_sp);
84
90 static mission &
92 {
93 static mission instance;
94 return instance;
95 }
96 /* Singleton */
97 mission(mission const &) = delete;
98 void
99 operator=(mission const &) = delete;
100
101private:
102 etl::delegate<void(void)> m_pre_init;
103 etl::delegate<void(void)> m_post_init;
104 etl::delegate<void(void)> m_start;
105 etl::delegate<bool(msg_arbiter::msg &msg)> m_msg_parser;
106 etl::delegate<bool(msg_arbiter::msg &msg)> m_sp_msg_parser;
107
108 mission() = default;
109};
110
112} // namespace satnogs::comms
mission(mission const &)=delete
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 operator=(mission const &)=delete
void register_msg_parser(etl::delegate< bool(msg_arbiter::msg &msg)> callback)
Registers a callback for the msg_parser().
Definition mission.cpp:96
static mission & get_instance()
Get a singleton access to the mission subsystem.
Definition mission.hpp:91
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