API
telem_telsee.hpp
Go to the documentation of this file.
1 /** \file telem_telsee.hpp
2  * \brief The MagAO-X logger telem_telsee 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_telsee_hpp
11 #define logger_types_telem_telsee_hpp
12 
13 #include "generated/telem_telsee_generated.h"
14 #include "flatbuffer_log.hpp"
15 
16 namespace MagAOX
17 {
18 namespace 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_TELSEE;
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 int & dimm_time, ///< [in]
40  const double & dimm_el, ///< [in]
41  const double & dimm_fwhm_corr, ///< [in]
42  const double & dimm_fwhm_bad, ///< [in]
43  const int & mag1_time, ///< [in]
44  const double & mag1_el, ///< [in]
45  const double & mag1_fwhm, ///< [in]
46  const double & mag1_fwhm_corr, ///< [in]
47  const int & mag2_time, ///< [in]
48  const double & mag2_el, ///< [in]
49  const double & mag2_fwhm, ///< [in]
50  const double & mag2_fwhm_corr ///< [in]
51  )
52  {
53  auto fp = CreateTelem_telsee_fb(builder, dimm_time, dimm_el, dimm_fwhm_corr, dimm_fwhm_bad, mag1_time, mag1_el, mag1_fwhm, mag1_fwhm_corr, mag2_time, mag2_el, mag2_fwhm, mag2_fwhm_corr);
54  builder.Finish(fp);
55  }
56 
57  };
58 
59  static bool verify( flatlogs::bufferPtrT & logBuff, ///< [in] Buffer containing the flatbuffer serialized message.
60  flatlogs::msgLenT len ///< [in] length of msgBuffer.
61  )
62  {
63  auto verifier = flatbuffers::Verifier( static_cast<uint8_t*>(flatlogs::logHeader::messageBuffer(logBuff)), static_cast<size_t>(len));
64  return VerifyTelem_telsee_fbBuffer(verifier);
65  }
66 
67  ///Get the message formatte for human consumption.
68  static std::string msgString( void * msgBuffer, /**< [in] Buffer containing the flatbuffer serialized message.*/
69  flatlogs::msgLenT len /**< [in] [unused] length of msgBuffer.*/
70  )
71  {
72  static_cast<void>(len);
73 
74  auto fbs = GetTelem_telsee_fb(msgBuffer);
75 
76  std::string msg = "[telsee] ";
77 
78  msg += "dimm[ ";
79 
80  msg += "t: ";
81  msg += std::to_string(fbs->dimm_time()) + " ";
82 
83  msg += "el: ";
84  msg += std::to_string(fbs->dimm_el()) + " ";
85 
86  msg += "fw-cor: ";
87  msg += std::to_string(fbs->dimm_fwhm_corr()) + "] ";
88 
89  msg += "mag1[ ";
90 
91  msg += "t: ";
92  msg += std::to_string(fbs->mag1_time()) + " ";
93 
94  msg += "el: ";
95  msg += std::to_string(fbs->mag1_el()) + " ";
96 
97  msg += "fw: ";
98  msg += std::to_string(fbs->mag1_fwhm()) + " ";
99 
100  msg += "fw-cor: ";
101  msg += std::to_string(fbs->mag1_fwhm_corr()) + "] ";
102 
103 
104  msg += "mag2[ ";
105 
106  msg += "t: ";
107  msg += std::to_string(fbs->mag2_time()) + " ";
108 
109  msg += "el: ";
110  msg += std::to_string(fbs->mag2_el()) + " ";
111 
112  msg += "fw: ";
113  msg += std::to_string(fbs->mag2_fwhm()) + " ";
114 
115  msg += "fw-cor: ";
116  msg += std::to_string(fbs->mag2_fwhm_corr()) + "] ";
117  return msg;
118 
119  }
120 
121 }; //telem_telsee
122 
123 
124 
125 } //namespace logger
126 } //namespace MagAOX
127 
128 #endif //logger_types_telem_telsee_hpp
129 
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.
Definition: logHeader.hpp:621
std::shared_ptr< char > bufferPtrT
The log entry buffer smart pointer.
Definition: logHeader.hpp:58
std::stringstream msg
Definition: dm.hpp:24
constexpr static logPrioT LOG_TELEM
A telemetry recording.
Definition: logPriority.hpp:58
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 int &dimm_time, const double &dimm_el, const double &dimm_fwhm_corr, const double &dimm_fwhm_bad, const int &mag1_time, const double &mag1_el, const double &mag1_fwhm, const double &mag1_fwhm_corr, const int &mag2_time, const double &mag2_el, const double &mag2_fwhm, const double &mag2_fwhm_corr)
Construct from components.
Log entry recording the build-time git state.
static const flatlogs::logPrioT defaultLevel
The default level.
static bool verify(flatlogs::bufferPtrT &logBuff, flatlogs::msgLenT len)
static const flatlogs::eventCodeT eventCode
The event code.
static timespec lastRecord
The time of the last time this log was recorded. Used by the telemetry system.
static std::string msgString(void *msgBuffer, flatlogs::msgLenT len)
Get the message formatte for human consumption.