10 #ifndef logger_types_telem_dmspeck_hpp
11 #define logger_types_telem_dmspeck_hpp
13 #include "generated/telem_dmspeck_generated.h"
43 const std::vector<float> &
angles,
45 const std::vector<bool> &
crosses
64 return VerifyTelem_dmspeck_fbBuffer(verifier);
72 static_cast<void>(len);
74 auto fbs = GetTelem_dmspeck_fb(msgBuffer);
76 std::string
msg =
"[speckles] ";
78 if(!fbs->modulating())
80 msg +=
"not modulating";
87 msg +=
" by trigger ";
92 msg += std::to_string(fbs->frequency());
97 for(flatbuffers::Vector<float>::const_iterator
it = fbs->separations()->begin();
it != fbs->separations()->end(); ++
it)
99 msg+= std::to_string(*
it);
103 for(flatbuffers::Vector<float>::const_iterator
it = fbs->angles()->begin();
it != fbs->angles()->end(); ++
it)
105 msg+= std::to_string(*
it);
109 for(flatbuffers::Vector<float>::const_iterator
it = fbs->amplitudes()->begin();
it != fbs->amplitudes()->end(); ++
it)
111 msg+= std::to_string(*
it);
114 for(flatbuffers::Vector<unsigned char>::const_iterator
it = fbs->crosses()->begin();
it != fbs->crosses()->end(); ++
it)
127 auto fbs = GetTelem_dmspeck_fb(msgBuffer);
128 return fbs->modulating();
133 auto fbs = GetTelem_dmspeck_fb(msgBuffer);
134 return fbs->trigger();
139 auto fbs = GetTelem_dmspeck_fb(msgBuffer);
140 return fbs->frequency();
145 std::vector<float> v;
147 auto fbs = GetTelem_dmspeck_fb(msgBuffer);
149 for(flatbuffers::Vector<float>::const_iterator
it = fbs->separations()->begin();
it != fbs->separations()->end(); ++
it)
157 static std::vector<float>
angles(
void * msgBuffer )
159 std::vector<float> v;
161 auto fbs = GetTelem_dmspeck_fb(msgBuffer);
163 for(flatbuffers::Vector<float>::const_iterator
it = fbs->angles()->begin();
it != fbs->angles()->end(); ++
it)
173 std::vector<float> v;
175 auto fbs = GetTelem_dmspeck_fb(msgBuffer);
177 for(flatbuffers::Vector<float>::const_iterator
it = fbs->amplitudes()->begin();
it != fbs->amplitudes()->end(); ++
it)
185 static std::vector<bool>
crosses(
void * msgBuffer )
189 auto fbs = GetTelem_dmspeck_fb(msgBuffer);
191 for(flatbuffers::Vector<unsigned char>::const_iterator
it = fbs->crosses()->begin();
it != fbs->crosses()->end(); ++
it)
206 if(member ==
"modulating")
return logMetaDetail({
"MODULATING", logMeta::valTypes::Bool, logMeta::metaTypes::State,
reinterpret_cast<void*
>(&
modulating)});
207 else if(member ==
"trigger")
return logMetaDetail({
"TRIGGERED", logMeta::valTypes::Bool, logMeta::metaTypes::State,
reinterpret_cast<void*
>(&
trigger)});
208 else if(member ==
"frequency")
return logMetaDetail({
"FREQUENCY", logMeta::valTypes::Float, logMeta::metaTypes::State,
reinterpret_cast<void*
>(&
frequency)});
209 else if(member ==
"separations")
return logMetaDetail({
"SEPARATIONS", logMeta::valTypes::Vector_Float, logMeta::metaTypes::State,
reinterpret_cast<void*
>(&
separations)});
210 else if(member ==
"angles")
return logMetaDetail({
"ANGLES", logMeta::valTypes::Vector_Float, logMeta::metaTypes::State,
reinterpret_cast<void*
>(&
angles)});
211 else if(member ==
"amplitudes")
return logMetaDetail({
"AMPLITUDES", logMeta::valTypes::Vector_Float, logMeta::metaTypes::State,
reinterpret_cast<void*
>(&
amplitudes)});
212 else if(member ==
"crosses")
return logMetaDetail({
"CROSSES", logMeta::valTypes::Vector_Bool, logMeta::metaTypes::State,
reinterpret_cast<void*
>(&
crosses)});
215 std::cerr <<
"No string member " << member <<
" in telem_dmspeck\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 bool &modulating, const bool &trigger, const float &frequency, const std::vector< float > &separations, const std::vector< float > &angles, const std::vector< float > &litudes, const std::vector< bool > &crosses)
Construct from components.
Log entry recording stdMotionStage status.
static std::vector< float > amplitudes(void *msgBuffer)
static bool trigger(void *msgBuffer)
static std::vector< float > angles(void *msgBuffer)
static bool modulating(void *msgBuffer)
static float frequency(void *msgBuffer)
static bool verify(flatlogs::bufferPtrT &logBuff, flatlogs::msgLenT len)
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 const flatlogs::logPrioT defaultLevel
The default level.
static logMetaDetail getAccessor(const std::string &member)
Get pointer to the accessor for a member by name.
static std::vector< bool > crosses(void *msgBuffer)
static std::vector< float > separations(void *msgBuffer)