10 #ifndef logger_types_telem_chrony_status_hpp
11 #define logger_types_telem_chrony_status_hpp
13 #include "generated/telem_chrony_status_generated.h"
42 const std::string & ip,
43 const std::string & sync,
44 const std::string &
leap
47 auto _mac =
builder.CreateString(mac);
48 auto _ip =
builder.CreateString(ip);
49 auto _sync =
builder.CreateString(sync);
52 auto fp = CreateTelem_chrony_status_fb(
builder, _mac, _ip, _sync, _leap);
63 return VerifyTelem_chrony_status_fbBuffer(verifier);
71 static_cast<void>(len);
73 auto fbs = GetTelem_chrony_status_fb(msgBuffer);
75 std::string
msg =
"[chrony_status] ";
80 msg += fbs->sourceMAC()->c_str();
86 msg += fbs->sourceIP()->c_str();
92 msg += fbs->synch()->c_str();
98 msg += fbs->leap()->c_str();
107 auto fbs = GetTelem_chrony_status_fb(msgBuffer);
108 if(fbs->sourceMAC())
return std::string(fbs->sourceMAC()->c_str());
114 auto fbs = GetTelem_chrony_status_fb(msgBuffer);
115 if(fbs->sourceIP())
return std::string(fbs->sourceIP()->c_str());
119 static std::string
synch(
void * msgBuffer )
121 auto fbs = GetTelem_chrony_status_fb(msgBuffer);
122 if(fbs->synch())
return std::string(fbs->synch()->c_str());
126 static std::string
leap(
void * msgBuffer )
128 auto fbs = GetTelem_chrony_status_fb(msgBuffer);
129 if(fbs->leap())
return std::string(fbs->leap()->c_str());
140 if(member ==
"sourceMAC")
return reinterpret_cast<void*
>(&
sourceMAC);
141 else if(member ==
"sourceIP")
return reinterpret_cast<void*
>(&
sourceIP);
142 else if(member ==
"synch")
return reinterpret_cast<void*
>(&
synch);
143 else if(member ==
"leap")
return reinterpret_cast<void*
>(&
leap);
146 std::cerr <<
"No string member " << member <<
" in telem_chrony_status\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 std::string &mac, const std::string &ip, const std::string &sync, const std::string &leap)
Construct from components.
Log entry recording the status of chrony.
static bool verify(flatlogs::bufferPtrT &logBuff, flatlogs::msgLenT len)
static std::string leap(void *msgBuffer)
static timespec lastRecord
The time of the last time this log was recorded. Used by the telemetry system.
static const flatlogs::logPrioT defaultLevel
The default level.
static void * getAccessor(const std::string &member)
Get pointer to the accessor for a member by name.
static const flatlogs::eventCodeT eventCode
The event code.
static std::string sourceIP(void *msgBuffer)
static std::string synch(void *msgBuffer)
static std::string msgString(void *msgBuffer, flatlogs::msgLenT len)
Get the message formatte for human consumption.
static std::string sourceMAC(void *msgBuffer)