10 #ifndef logger_types_telem_blockgains_hpp
11 #define logger_types_telem_blockgains_hpp
13 #include "generated/telem_blockgains_generated.h"
40 const std::vector<uint8_t> & gains_constant,
41 const std::vector<float> & multcs,
42 const std::vector<uint8_t> & multcs_constant,
43 const std::vector<float> & lims,
44 const std::vector<uint8_t> & lims_constant
47 auto _gains =
builder.CreateVector(gains);
48 auto _gainsc =
builder.CreateVector(gains_constant);
49 auto _mcs =
builder.CreateVector(multcs);
50 auto _mcsc =
builder.CreateVector(multcs_constant);
51 auto _lims =
builder.CreateVector(lims);
52 auto _limsc =
builder.CreateVector(lims_constant);
54 auto fb = CreateTelem_blockgains_fb(
builder, _gains, _gainsc, _mcs, _mcsc, _lims, _limsc);
66 return VerifyTelem_blockgains_fbBuffer(verifier);
74 static_cast<void>(len);
76 auto fbs = GetTelem_blockgains_fb(msgBuffer);
78 std::string
msg =
"[gains] ";
81 if( fbs->gains() && fbs->gains_constant() )
83 if(fbs->gains()->size() == fbs->gains_constant()->size())
85 for(
size_t i=0; i< fbs->gains()->size(); ++i)
88 msg += std::to_string(fbs->gains()->Get(i));
90 msg += std::to_string(fbs->gains_constant()->Get(i));
96 for(
size_t i=0; i< fbs->gains()->size(); ++i)
99 msg += std::to_string(fbs->gains()->Get(i));
104 else if (fbs->gains())
106 for(
size_t i=0; i< fbs->gains()->size(); ++i)
109 msg += std::to_string(fbs->gains()->Get(i));
115 if( fbs->mcs() && fbs->mcs_constant() )
117 if(fbs->mcs()->size() == fbs->mcs_constant()->size())
119 for(
size_t i=0; i< fbs->mcs()->size(); ++i)
122 msg += std::to_string(fbs->mcs()->Get(i));
124 msg += std::to_string(fbs->mcs_constant()->Get(i));
130 for(
size_t i=0; i< fbs->mcs()->size(); ++i)
133 msg += std::to_string(fbs->mcs()->Get(i));
140 for(
size_t i=0; i< fbs->mcs()->size(); ++i)
143 msg += std::to_string(fbs->mcs()->Get(i));
150 if( fbs->lims() && fbs->lims_constant() )
152 if(fbs->lims()->size() == fbs->lims_constant()->size())
154 for(
size_t i=0; i< fbs->lims()->size(); ++i)
157 msg += std::to_string(fbs->lims()->Get(i));
159 msg += std::to_string(fbs->lims_constant()->Get(i));
165 for(
size_t i=0; i< fbs->lims()->size(); ++i)
168 msg += std::to_string(fbs->lims()->Get(i));
173 else if (fbs->lims())
175 for(
size_t i=0; i< fbs->lims()->size(); ++i)
178 msg += std::to_string(fbs->lims()->Get(i));
The MagAO-X logger flatbuffer log base type.
uint16_t eventCodeT
The type of an event code (16-bit unsigned int).
msgLen2T msgLenT
The type used to refer to the message length, regardless of length.
int8_t logPrioT
The type of the log priority code.
static void * messageBuffer(bufferPtrT &logBuffer)
Get the message buffer address.
std::shared_ptr< char > bufferPtrT
The log entry buffer smart pointer.
constexpr static 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 std::vector< float > &gains, const std::vector< uint8_t > &gains_constant, const std::vector< float > &multcs, const std::vector< uint8_t > &multcs_constant, const std::vector< float > &lims, const std::vector< uint8_t > &lims_constant)
Construct from components.
Log entry recording electronics rack temperature.
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.
static bool verify(flatlogs::bufferPtrT &logBuff, flatlogs::msgLenT len)
static const flatlogs::logPrioT defaultLevel
The default level.
static const flatlogs::eventCodeT eventCode
The event code.