introduce the aircraft reporter
This commit is contained in:
53
include/aman/com/AircraftReporter.h
Normal file
53
include/aman/com/AircraftReporter.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* @brief Defines the aircraft reporter module to communicate with the backend
|
||||
* @file aman/com/AircraftReporter.h
|
||||
* @author Sven Czarnian <devel@svcz.de>
|
||||
* @copyright Copyright 2021 Sven Czarnian
|
||||
* @license This project is published under the GNU General Public License v3 (GPLv3)
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <zmq.hpp>
|
||||
|
||||
#include <aman/types/Communication.h>
|
||||
|
||||
namespace aman {
|
||||
/**
|
||||
* @brief Defines the base class for all file formats
|
||||
* @ingroup format
|
||||
*
|
||||
* The base class provides error information, etc.
|
||||
*/
|
||||
class AircraftReporter {
|
||||
private:
|
||||
bool m_initialized;
|
||||
zmq::socket_t m_socket;
|
||||
|
||||
AircraftReporter() noexcept;
|
||||
|
||||
template <typename T>
|
||||
bool setSocketKey(const std::string& key, T entry) {
|
||||
try {
|
||||
this->m_socket.set(entry, key);
|
||||
return true;
|
||||
}
|
||||
catch (std::exception&) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
AircraftReporter(const AircraftReporter&) = delete;
|
||||
AircraftReporter(AircraftReporter&&) = delete;
|
||||
AircraftReporter& operator=(const AircraftReporter&) = delete;
|
||||
AircraftReporter& operator=(AircraftReporter&&) = delete;
|
||||
|
||||
bool initialize(const Communication& configuration);
|
||||
bool deinitialize();
|
||||
|
||||
bool send(zmq::message_t& message);
|
||||
|
||||
static AircraftReporter& instance();
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user