10 #ifndef logger_types_telem_stage_hpp
11 #define logger_types_telem_stage_hpp
13 #include "generated/telem_stage_generated.h"
57 return VerifyTelem_stage_fbBuffer(verifier);
65 static_cast<void>(len);
67 auto fbs = GetTelem_stage_fb(msgBuffer);
69 std::string
msg =
"[stage] ";
72 if(fbs->moving() == -2)
msg +=
" OFF ";
73 else if(fbs->moving() == -1)
msg +=
" NOTHOMED ";
74 else if(fbs->moving() == 0)
msg +=
" STOPPED ";
75 else if(fbs->moving() == 1)
msg +=
" MOVING ";
76 else if(fbs->moving() == 2)
msg +=
" HOMING ";
79 msg += std::to_string(fbs->preset()) +
" ";
84 msg += fbs->presetName()->c_str();
91 static int moving(
void * msgBuffer )
93 auto fbs = GetTelem_stage_fb(msgBuffer);
97 static float preset(
void * msgBuffer )
99 auto fbs = GetTelem_stage_fb(msgBuffer);
100 return fbs->preset();
105 auto fbs = GetTelem_stage_fb(msgBuffer);
106 if(fbs->presetName())
108 return std::string(fbs->presetName()->c_str());
110 else return std::string();
120 if( member ==
"moving")
return logMetaDetail({
"MOVING", logMeta::valTypes::Int, logMeta::metaTypes::State,
reinterpret_cast<void*
>(&
moving)});
121 else if(member ==
"preset")
return logMetaDetail({
"PRESET POSITION", logMeta::valTypes::Float, logMeta::metaTypes::State,
reinterpret_cast<void*
>(&
preset)});
122 else if(member ==
"presetName")
return logMetaDetail({
"PRESET NAME", logMeta::valTypes::String, logMeta::metaTypes::State,
reinterpret_cast<void*
>(&
presetName)});
125 std::cerr <<
"No string member " << member <<
" in telem_stage\n";
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 int8_t &moving, const float &preset, const std::string &presetName)
Construct from components.
Log entry recording stdMotionStage status.
static const flatlogs::logPrioT defaultLevel
The default level.
static float preset(void *msgBuffer)
static logMetaDetail getAccessor(const std::string &member)
Get the logMetaDetail for a member by name.
static std::string presetName(void *msgBuffer)
static timespec lastRecord
The timestamp 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 bool verify(flatlogs::bufferPtrT &logBuff, flatlogs::msgLenT len)
static int moving(void *msgBuffer)