API
 
Loading...
Searching...
No Matches
telem_telvane.hpp
Go to the documentation of this file.
1/** \file telem_telvane.hpp
2 * \brief The MagAO-X logger telem_telvane log type.
3 * \author Jared R. Males (jaredmales@gmail.com)
4 *
5 * \ingroup logger_types_files
6 *
7 * History:
8 * - 2018-09-06 created by JRM
9 */
10#ifndef logger_types_telem_telvane_hpp
11#define logger_types_telem_telvane_hpp
12
13#include "generated/telem_telvane_generated.h"
14#include "flatbuffer_log.hpp"
15
16namespace MagAOX
17{
18namespace logger
19{
20
21
22/// Log entry recording the build-time git state.
23/** \ingroup logger_types
24 */
26{
27 ///The event code
28 static const flatlogs::eventCodeT eventCode = eventCodes::TELEM_TELVANE;
29
30 ///The default level
32
33 static timespec lastRecord; ///< The time of the last time this log was recorded. Used by the telemetry system.
34
35 ///The type of the input message
36 struct messageT : public fbMessage
37 {
38 ///Construct from components
39 messageT( const double & secz, ///< [in] secondary z-position
40 const double & encz, ///< [in] secondary z-encoder
41 const double & secx, ///< [in] secondary x-position
42 const double & encx, ///< [in] secondary x-encoder
43 const double & secy, ///< [in] secondary y-position
44 const double & ency, ///< [in] secondary y-encoder
45 const double & sech, ///< [in] secondary h-position
46 const double & ench, ///< [in] secondary h-encoder
47 const double & secv, ///< [in] secondary v-position
48 const double & encv ///< [in] secondary v-encoder
49 )
50 {
51 auto fp = CreateTelem_telvane_fb(builder, secz, encz, secx, encx, secy, ency,sech, ench, secv, encv);
52 builder.Finish(fp);
53 }
54
55 };
56
57
58 static bool verify( flatlogs::bufferPtrT & logBuff, ///< [in] Buffer containing the flatbuffer serialized message.
59 flatlogs::msgLenT len ///< [in] length of msgBuffer.
60 )
61 {
62 auto verifier = flatbuffers::Verifier( static_cast<uint8_t*>(flatlogs::logHeader::messageBuffer(logBuff)), static_cast<size_t>(len));
63 return VerifyTelem_telvane_fbBuffer(verifier);
64 }
65
66 ///Get the message formatte for human consumption.
67 static std::string msgString( void * msgBuffer, /**< [in] Buffer containing the flatbuffer serialized message.*/
68 flatlogs::msgLenT len /**< [in] [unused] length of msgBuffer.*/
69 )
70 {
71 static_cast<void>(len);
72
73 auto fbs = GetTelem_telvane_fb(msgBuffer);
74
75 std::string msg = "[telvane] ";
76
77 msg += "secz: ";
78 msg += std::to_string(fbs->secz()) + " ";
79
80 msg += "encz: ";
81 msg += std::to_string(fbs->encz()) + " ";
82
83 msg += "secx: ";
84 msg += std::to_string(fbs->secx()) + " ";
85
86 msg += "encx: ";
87 msg += std::to_string(fbs->encx()) + " ";
88
89 msg += "secy: ";
90 msg += std::to_string(fbs->secy()) + " ";
91
92 msg += "ency: ";
93 msg += std::to_string(fbs->ency()) + " ";
94
95 msg += "sech: ";
96 msg += std::to_string(fbs->sech()) + " ";
97
98 msg += "ench: ";
99 msg += std::to_string(fbs->ench()) + " ";
100
101 msg += "secv: ";
102 msg += std::to_string(fbs->secv()) + " ";
103
104 msg += "encv: ";
105 msg += std::to_string(fbs->encv()) + " ";
106
107 return msg;
108
109 }
110
111}; //telem_telvane
112
113
114
115} //namespace logger
116} //namespace MagAOX
117
118#endif //logger_types_telem_telvane_hpp
119
The MagAO-X logger flatbuffer log base type.
uint16_t eventCodeT
The type of an event code (16-bit unsigned int).
Definition logDefs.hpp:40
msgLen2T msgLenT
The type used to refer to the message length, regardless of length.
Definition logDefs.hpp:69
int8_t logPrioT
The type of the log priority code.
Definition logDefs.hpp:21
static void * messageBuffer(bufferPtrT &logBuffer)
Get the message buffer address.
std::shared_ptr< char > bufferPtrT
The log entry buffer smart pointer.
Definition logHeader.hpp:58
Definition dm.hpp:24
static constexpr logPrioT LOG_TELEM
A telemetry recording.
Message type for resolving log messages with a f.b. builder.
flatbuffers::FlatBufferBuilder builder
Base class for logs consisting of a flatbuffer message.
The type of the input message.
messageT(const double &secz, const double &encz, const double &secx, const double &encx, const double &secy, const double &ency, const double &sech, const double &ench, const double &secv, const double &encv)
Construct from components.
Log entry recording the build-time git state.
static bool verify(flatlogs::bufferPtrT &logBuff, flatlogs::msgLenT len)
static timespec lastRecord
The time of the last time this log was recorded. Used by the telemetry system.
static const flatlogs::eventCodeT eventCode
The event code.
static std::string msgString(void *msgBuffer, flatlogs::msgLenT len)
Get the message formatte for human consumption.
static const flatlogs::logPrioT defaultLevel
The default level.