MagAO-X
Operations Applications Utilities Source
ttmmod_params.hpp
Go to the documentation of this file.
1 /** \file ttmmod_params.hpp
2  * \brief The MagAO-X logger ttmmod_params 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_ttmmod_params_hpp
11 #define logger_types_ttmmod_params_hpp
12 
13 #include "generated/ttmmod_params_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::TTMMOD_PARAMS;
29 
30  ///The default level
32 
33 
34  ///The type of the input message
35  struct messageT : public fbMessage
36  {
37  ///Construct from components
38  messageT( const uint8_t & modState,
39  const double & modFreq,
40  const double & modRad,
41  const double & offset1,
42  const double & offset2
43  )
44  {
45  auto fp = CreateTtmmod_params_fb(builder, modState, modFreq, modRad, offset1, offset2);
46  builder.Finish(fp);
47 
48  }
49 
50  };
51 
52  ///Get the message formatte for human consumption.
53  static std::string msgString( void * msgBuffer, /**< [in] Buffer containing the flatbuffer serialized message.*/
54  flatlogs::msgLenT len /**< [in] [unused] length of msgBuffer.*/
55  )
56  {
57  static_cast<void>(len);
58 
59  auto fbs = GetTtmmod_params_fb(msgBuffer);
60 
61 
62  std::string msg = "UNK";
63 
64  if(fbs->modState() == 0) msg = "OFF";
65  if(fbs->modState() == 1) msg = "REST";
66  if(fbs->modState() == 2) msg = "INT";
67  if(fbs->modState() == 3) msg = "SET";
68  if(fbs->modState() == 4)
69  {
70  msg = "MOD";
71 
72  msg += " Freq: ";
73  msg += std::to_string(fbs->modFreq()) + " Hz";
74 
75  msg += " Rad: ";
76  msg += std::to_string(fbs->modRad()) + " lam/D";
77  }
78 
79  return msg;
80 
81  }
82 
83 }; //ttmmod_params
84 
85 
86 } //namespace logger
87 } //namespace MagAOX
88 
89 #endif //logger_types_ttmmod_params_hpp
static constexpr logPrioT LOG_INFO
Informational. The info log level is the lowest level recorded during normal operations.
Definition: logPriority.hpp:49
Log entry recording the build-time git state.
static const flatlogs::logPrioT defaultLevel
The default level.
The MagAO-X logger flatbuffer log base type.
static std::string msgString(void *msgBuffer, flatlogs::msgLenT len)
Get the message formatte for human consumption.
The type of the input message.
Base class for logs consisting of a flatbuffer message.
int8_t logPrioT
The type of the log priority code.
Definition: logDefs.hpp:19
static const flatlogs::eventCodeT eventCode
The event code.
flatbuffers::FlatBufferBuilder builder
msgLen2T msgLenT
The type used to refer to the message length, regardless of length.
Definition: logDefs.hpp:67
Message type for resolving log messages with a f.b. builder.
uint16_t eventCodeT
The type of an event code (16-bit unsigned int).
Definition: logDefs.hpp:38
messageT(const uint8_t &modState, const double &modFreq, const double &modRad, const double &offset1, const double &offset2)
Construct from components.