rad 6.2.0
Loading...
Searching...
No Matches
trsHealth.hpp
Go to the documentation of this file.
1
9#ifndef RAD_TRSHEALTH_HPP
10#define RAD_TRSHEALTH_HPP
11
12#include <rad/anyEvent.hpp>
13#include <rad/smAdapter.hpp>
14
15#include <memory>
16#include <string>
17#include <string_view>
18
19#include <boost/asio.hpp>
20
21#include <ptpmon/client.hpp>
22
23namespace rad {
24
26 static constexpr char const* ID = "TrsEvents.HealthBad";
27 using payload_t = std::string;
28};
30
32 static constexpr char const* ID = "TrsEvents.HealthGood";
33 using payload_t = std::string;
34};
36
40class TrsHealth : protected ptpmon::StatusNotifier {
41 public:
49 explicit TrsHealth(
50 boost::asio::io_context& ioc,
51 SMAdapter& sm,
52 const std::string_view path = ptpmon::DEFAULT_SOCKET_PATH);
53
54 virtual ~TrsHealth() = default;
55
56 TrsHealth(const TrsHealth&) = delete;
57 TrsHealth& operator=(const TrsHealth&) = delete;
58
59 TrsHealth(TrsHealth&&) = default;
61
63 const ptpmon::StatusMessage& GetStatus() const;
64
66 void Enable();
67
69 void Disable();
70
71 protected:
72 void Notify(const ptpmon::StatusMessage& status) override;
73
74 private:
75 boost::asio::io_context& m_ioc;
76
78 SMAdapter& m_sm;
79
81 std::string m_path;
82
84 ptpmon::StatusMessage m_status;
85
87 std::unique_ptr<ptpmon::Client> m_client;
88};
89
90} // namespace rad
91
92
93#endif // RAD_TRSHEALTH_HPP
AnyEvent class header file.
Definition anyEvent.hpp:93
Definition smAdapter.hpp:60
Adapter for ptpmond's TRS Health status to the state machine.
Definition trsHealth.hpp:40
void Disable()
Disable TRS health status notification.
Definition trsHealth.cpp:44
void Notify(const ptpmon::StatusMessage &status) override
Definition trsHealth.cpp:50
const ptpmon::StatusMessage & GetStatus() const
Retrieve the most recent status.
Definition trsHealth.cpp:29
void Enable()
Enable TRS health status notification.
Definition trsHealth.cpp:34
TrsHealth(const TrsHealth &)=delete
TrsHealth & operator=(const TrsHealth &)=delete
TrsHealth(boost::asio::io_context &ioc, SMAdapter &sm, const std::string_view path=ptpmon::DEFAULT_SOCKET_PATH)
Register callbacks and start connecting to the ptpmond socket.
Definition trsHealth.cpp:19
virtual ~TrsHealth()=default
TrsHealth(TrsHealth &&)=default
TrsHealth & operator=(TrsHealth &&)=default
Definition actionsApp.cpp:23
SMAdapter class header file.
Definition trsHealth.hpp:25
std::string payload_t
Definition trsHealth.hpp:27
static constexpr char const * ID
Definition trsHealth.hpp:26
Definition trsHealth.hpp:31
std::string payload_t
Definition trsHealth.hpp:33
static constexpr char const * ID
Definition trsHealth.hpp:32