10#ifndef logger_types_telem_stdcam_hpp
11#define logger_types_telem_stdcam_hpp
52 const uint8_t & status,
53 const uint8_t & ontarget,
54 const std::string & statusStr,
55 const std::string & shutterStatusSr,
66 auto _statusStr =
builder.CreateString(statusStr);
69 auto _shutterStatusStr =
builder.CreateString(shutterStatusSr);
74 auto fp =
CreateTelem_stdcam_fb(
builder, _mode, _roi,
exptime,
fps,
emGain,
adcSpeed, _tempCtrl, _shutter,
synchro,
vshift,
cropMode, _readoutSpeed);
93 static_cast<void>(len);
97 std::string msg =
"[stdcam] ";
99 if(fbs->mode() !=
nullptr)
102 msg += fbs->mode()->c_str();
106 if(fbs->roi() !=
nullptr)
109 msg += std::to_string(fbs->roi()->xcen());
111 msg += std::to_string(fbs->roi()->ycen());
113 msg += std::to_string(fbs->roi()->w());
115 msg += std::to_string(fbs->roi()->h());
117 msg += std::to_string(fbs->roi()->xbin());
119 msg += std::to_string(fbs->roi()->ybin());
124 msg += std::to_string(fbs->exptime());
126 msg += std::to_string(fbs->fps());
128 msg += std::to_string(fbs->emGain());
130 msg += std::to_string(fbs->adcSpeed());
132 if(fbs->tempCtrl() !=
nullptr)
135 msg += std::to_string(fbs->tempCtrl()->temp());
137 msg += std::to_string(fbs->tempCtrl()->setpt());
138 msg +=
" tempctr-stat: ";
139 msg += std::to_string(fbs->tempCtrl()->status());
140 msg +=
" tempctr-ontgt: ";
141 msg += std::to_string(fbs->tempCtrl()->ontarget());
143 if(fbs->tempCtrl()->statusStr())
145 msg +=
" tempctr-statstr: ";
146 msg += fbs->tempCtrl()->statusStr()->c_str();
150 if(fbs->shutter() !=
nullptr)
152 if(fbs->shutter()->statusStr())
154 msg +=
" shutter-statstr: ";
155 msg += fbs->shutter()->statusStr()->c_str();
158 if( fbs->shutter()->state() == -1)
162 else if( fbs->shutter()->state() == 0)
166 else if( fbs->shutter()->state() == 1)
173 if(fbs->synchro()) msg +=
"ON";
177 if(fbs->vshift() == 0) msg +=
"---";
178 else msg += std::to_string(fbs->vshift());
181 if(fbs->cropMode()==-1) msg +=
"---";
182 else if(fbs->cropMode()==1) msg +=
"ON";
185 if(fbs->readout_speed() !=
nullptr)
187 if(fbs->readout_speed()->size() > 0)
190 msg += fbs->readout_speed()->c_str();
198 static std::string
mode(
void * msgBuffer )
201 if(fbs->mode() !=
nullptr)
203 return std::string(fbs->mode()->c_str());
208 static float xcen(
void * msgBuffer )
211 if(fbs->roi() !=
nullptr)
return fbs->roi()->xcen();
215 static float ycen(
void * msgBuffer )
218 if(fbs->roi() !=
nullptr)
return fbs->roi()->ycen();
222 static int width(
void * msgBuffer )
225 if(fbs->roi() !=
nullptr)
return fbs->roi()->w();
232 if(fbs->roi() !=
nullptr)
return fbs->roi()->h();
236 static int xbin(
void * msgBuffer )
239 if(fbs->roi() !=
nullptr)
return fbs->roi()->xbin();
243 static int ybin(
void * msgBuffer )
246 if(fbs->roi() !=
nullptr)
return fbs->roi()->ybin();
253 return fbs->exptime();
256 static float fps(
void * msgBuffer )
265 return fbs->emGain();
271 return fbs->adcSpeed();
274 static float temp(
void * msgBuffer )
277 if(fbs->tempCtrl() !=
nullptr)
return fbs->tempCtrl()->temp();
284 if(fbs->tempCtrl() !=
nullptr)
return fbs->tempCtrl()->setpt();
291 if(fbs->tempCtrl() !=
nullptr)
return fbs->tempCtrl()->status();
298 if(fbs->tempCtrl() !=
nullptr)
return fbs->tempCtrl()->ontarget();
305 if(fbs->tempCtrl() !=
nullptr)
307 if(fbs->tempCtrl()->statusStr())
return fbs->tempCtrl()->statusStr()->c_str();
316 if(fbs->shutter() !=
nullptr)
318 if(fbs->shutter()->statusStr())
return fbs->shutter()->statusStr()->c_str();
327 if(fbs->shutter() !=
nullptr)
329 if( fbs->shutter()->state() == -1)
return "UNKNOWN";
330 else if( fbs->shutter()->state() == 0)
return "SHUT";
331 else if( fbs->shutter()->state() == 1)
return "OPEN";
332 else return "INVALID";
334 else return "INVALID";
340 return fbs->synchro();
346 return fbs->vshift();
354 if(fbs->cropMode() == 1)
return true;
361 if(fbs->readout_speed() !=
nullptr)
363 return std::string(fbs->readout_speed()->c_str());
399 std::cerr <<
"No member " << member <<
" in telem_stdcam\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.
static constexpr flatlogs::eventCodeT TELEM_STDCAM
const MagAOX::logger::Telem_stdcam_fb * GetTelem_stdcam_fb(const void *buf)
inline ::flatbuffers::Offset< ROI > CreateROI(::flatbuffers::FlatBufferBuilder &_fbb, float xcen=0.0f, float ycen=0.0f, int32_t w=0, int32_t h=0, int32_t xbin=0, int32_t ybin=0)
inline ::flatbuffers::Offset< Telem_stdcam_fb > CreateTelem_stdcam_fb(::flatbuffers::FlatBufferBuilder &_fbb, ::flatbuffers::Offset<::flatbuffers::String > mode=0, ::flatbuffers::Offset< MagAOX::logger::ROI > roi=0, float exptime=0.0f, float fps=0.0f, float emGain=0.0f, float adcSpeed=0.0f, ::flatbuffers::Offset< MagAOX::logger::TempCtrl > tempCtrl=0, ::flatbuffers::Offset< MagAOX::logger::Shutter > shutter=0, uint8_t synchro=0, float vshift=0.0f, int8_t cropMode=-1, ::flatbuffers::Offset<::flatbuffers::String > readout_speed=0)
bool VerifyTelem_stdcam_fbBuffer(::flatbuffers::Verifier &verifier)
inline ::flatbuffers::Offset< TempCtrl > CreateTempCtrl(::flatbuffers::FlatBufferBuilder &_fbb, float temp=0.0f, float setpt=0.0f, bool status=false, bool ontarget=false, ::flatbuffers::Offset<::flatbuffers::String > statusStr=0)
inline ::flatbuffers::Offset< Shutter > CreateShutter(::flatbuffers::FlatBufferBuilder &_fbb, ::flatbuffers::Offset<::flatbuffers::String > statusStr=0, int32_t state=0)
static constexpr 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 &mode, const float &xcen, const float &ycen, const int &width, const int &height, const int &xbin, const int &ybin, const float &exptime, const float &fps, const float &emGain, const float &adcSpeed, const float &temp, const float &setpt, const uint8_t &status, const uint8_t &ontarget, const std::string &statusStr, const std::string &shutterStatusSr, const int8_t &shutterState, const uint8_t &synchro, const float &vshift, const uint8_t &cropMode, const std::string &readout_speed)
Construct from components.
Log entry recording stdcam stage specific status.
static float temp(void *msgBuffer)
static bool synchro(void *msgBuffer)
static std::string shutterStatusStr(void *msgBuffer)
static const flatlogs::eventCodeT eventCode
The event code.
static bool cropMode(void *msgBuffer)
static float vshift(void *msgBuffer)
static std::string shutterState(void *msgBuffer)
static timespec lastRecord
The timestamp of the last time this log was recorded. Used by the telemetry system.
static float tempSetpt(void *msgBuffer)
static logMetaDetail getAccessor(const std::string &member)
Get the logMetaDetail for a member by name.
static int tempStatus(void *msgBuffer)
static const flatlogs::logPrioT defaultLevel
The default level.
static float adcSpeed(void *msgBuffer)
static int tempOnTarget(void *msgBuffer)
static std::string tempStatusStr(void *msgBuffer)
static float ycen(void *msgBuffer)
static bool verify(flatlogs::bufferPtrT &logBuff, flatlogs::msgLenT len)
static int height(void *msgBuffer)
static std::string msgString(void *msgBuffer, flatlogs::msgLenT len)
Get the message formatted for human consumption.
static float fps(void *msgBuffer)
static float emGain(void *msgBuffer)
static std::string mode(void *msgBuffer)
static std::string readout_speed(void *msgBuffer)
static int xbin(void *msgBuffer)
static float xcen(void *msgBuffer)
static int ybin(void *msgBuffer)
static float exptime(void *msgBuffer)
static int width(void *msgBuffer)