10 #ifndef logger_types_telem_fxngen_hpp
11 #define logger_types_telem_fxngen_hpp
13 #include "generated/telem_fxngen_generated.h"
16 #define TELEM_FXNGEN_WVTP_DC (0)
17 #define TELEM_FXNGEN_WVTP_SINE (1)
18 #define TELEM_FXNGEN_WVTP_PULSE (2)
49 const double & C1ofst,
50 const double & C1phse,
51 const uint8_t & C1wvtp,
52 const uint8_t & C2outp,
55 const double & C2ofst,
56 const double & C2phse,
57 const uint8_t & C2wvtp,
58 const uint8_t & C1sync,
59 const uint8_t & C2sync,
60 const double & C1wdth,
64 auto fp = CreateTelem_fxngen_fb(
builder, C1outp,
C1freq, C1vpp, C1ofst, C1phse, C1wvtp,
65 C2outp,
C2freq, C2vpp, C2ofst, C2phse, C2wvtp, C1sync, C2sync, C1wdth, C2wdth);
76 return VerifyTelem_fxngen_fbBuffer(verifier);
84 static_cast<void>(len);
86 auto fbs = GetTelem_fxngen_fb(msgBuffer);
88 std::string
msg =
"Ch 1: ";
95 if(fbs->C1outp() == 0)
msg +=
"OFF ";
96 else if(fbs->C1outp() == 1)
msg +=
"ON ";
99 msg += std::to_string(fbs->C1freq()) +
" Hz ";
100 msg += std::to_string(fbs->C1vpp()) +
" Vp2p ";
101 msg += std::to_string(fbs->C1ofst()) +
" V ";
102 msg += std::to_string(fbs->C1phse()) +
" deg ";
103 msg += std::to_string(fbs->C1wdth()) +
" s ";
105 if(fbs->C1sync())
msg +=
"ON ";
115 if(fbs->C2outp() == 0)
msg +=
"OFF ";
116 else if(fbs->C2outp() == 1)
msg +=
"ON ";
119 msg += std::to_string(fbs->C2freq()) +
" Hz ";
120 msg += std::to_string(fbs->C2vpp()) +
" Vp2p ";
121 msg += std::to_string(fbs->C2ofst()) +
" V ";
122 msg += std::to_string(fbs->C2phse()) +
" deg ";
123 msg += std::to_string(fbs->C2wdth()) +
" s ";
125 if(fbs->C2sync())
msg +=
"ON ";
134 auto fbs = GetTelem_fxngen_fb(msgBuffer);
135 return fbs->C1freq();
140 auto fbs = GetTelem_fxngen_fb(msgBuffer);
141 return fbs->C2freq();
147 if( member ==
"C1freq")
return logMetaDetail({
"C1 FREQ", logMeta::valTypes::Double, logMeta::metaTypes::Continuous,
reinterpret_cast<void*
>(&
C1freq)});
148 else if(member ==
"C2freq")
return logMetaDetail({
"C2 FREQ", logMeta::valTypes::Double, logMeta::metaTypes::Continuous,
reinterpret_cast<void*
>(&
C2freq)});
151 std::cerr <<
"No string member " << member <<
" in telem_fxngen\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 uint8_t &C1outp, const double &C1freq, const double &C1vpp, const double &C1ofst, const double &C1phse, const uint8_t &C1wvtp, const uint8_t &C2outp, const double &C2freq, const double &C2vpp, const double &C2ofst, const double &C2phse, const uint8_t &C2wvtp, const uint8_t &C1sync, const uint8_t &C2sync, const double &C1wdth, const double &C2wdth)
Construct from components.
Log entry recording the function generator parameters.
static double C1freq(void *msgBuffer)
static logMetaDetail getAccessor(const std::string &member)
Get the logMetaDetail for a member by name.
static const flatlogs::logPrioT defaultLevel
The default level.
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::eventCodeT eventCode
The event code.
static double C2freq(void *msgBuffer)
static timespec lastRecord
The timestamp of the last time this log was recorded. Used by the telemetry system.
#define TELEM_FXNGEN_WVTP_DC
#define TELEM_FXNGEN_WVTP_PULSE
#define TELEM_FXNGEN_WVTP_SINE