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,
69 auto _statusStr =
builder.CreateString( statusStr );
72 auto _shutterStatusStr =
builder.CreateString( shutterStatusSr );
104 static_cast<size_t>( len ) );
113 static_cast<void>( len );
117 std::string msg =
"[stdcam] ";
119 if( fbs->mode() !=
nullptr )
122 msg += fbs->mode()->c_str();
126 if( fbs->roi() !=
nullptr )
129 msg += std::to_string( fbs->roi()->xcen() );
131 msg += std::to_string( fbs->roi()->ycen() );
133 msg += std::to_string( fbs->roi()->w() );
135 msg += std::to_string( fbs->roi()->h() );
137 msg += std::to_string( fbs->roi()->xbin() );
139 msg += std::to_string( fbs->roi()->ybin() );
144 msg += std::to_string( fbs->exptime() );
146 msg += std::to_string( fbs->fps() );
148 msg += std::to_string( fbs->emGain() );
150 msg += std::to_string( fbs->adcSpeed() );
152 if( fbs->tempCtrl() !=
nullptr )
155 msg += std::to_string( fbs->tempCtrl()->temp() );
157 msg += std::to_string( fbs->tempCtrl()->setpt() );
158 msg +=
" tempctr-stat: ";
159 msg += std::to_string( fbs->tempCtrl()->status() );
160 msg +=
" tempctr-ontgt: ";
161 msg += std::to_string( fbs->tempCtrl()->ontarget() );
163 if( fbs->tempCtrl()->statusStr() )
165 msg +=
" tempctr-statstr: ";
166 msg += fbs->tempCtrl()->statusStr()->c_str();
170 if( fbs->shutter() !=
nullptr )
172 if( fbs->shutter()->statusStr() )
174 msg +=
" shutter-statstr: ";
175 msg += fbs->shutter()->statusStr()->c_str();
178 if( fbs->shutter()->state() == -1 )
182 else if( fbs->shutter()->state() == 0 )
186 else if( fbs->shutter()->state() == 1 )
199 if( fbs->vshift() == 0 )
202 msg += std::to_string( fbs->vshift() );
205 if( fbs->cropMode() == -1 )
207 else if( fbs->cropMode() == 1 )
212 if( fbs->readout_speed() !=
nullptr )
214 if( fbs->readout_speed()->size() > 0 )
217 msg += fbs->readout_speed()->c_str();
221 if( fbs->fan_speed() !=
nullptr )
223 if( fbs->fan_speed()->size() > 0 )
226 msg += fbs->fan_speed()->c_str();
230 if( fbs->analog_gain() !=
nullptr )
232 if( fbs->analog_gain()->size() > 0 )
235 msg += fbs->analog_gain()->c_str();
240 if( fbs->led() == -1 )
242 else if( fbs->led() == 1 )
250 static std::string
mode(
void *msgBuffer )
253 if( fbs->mode() !=
nullptr )
255 return std::string( fbs->mode()->c_str() );
261 static float xcen(
void *msgBuffer )
264 if( fbs->roi() !=
nullptr )
265 return fbs->roi()->xcen();
270 static float ycen(
void *msgBuffer )
273 if( fbs->roi() !=
nullptr )
274 return fbs->roi()->ycen();
282 if( fbs->roi() !=
nullptr )
283 return fbs->roi()->w();
291 if( fbs->roi() !=
nullptr )
292 return fbs->roi()->h();
297 static int xbin(
void *msgBuffer )
300 if( fbs->roi() !=
nullptr )
301 return fbs->roi()->xbin();
306 static int ybin(
void *msgBuffer )
309 if( fbs->roi() !=
nullptr )
310 return fbs->roi()->ybin();
318 return fbs->exptime();
321 static float fps(
void *msgBuffer )
330 return fbs->emGain();
336 return fbs->adcSpeed();
339 static float temp(
void *msgBuffer )
342 if( fbs->tempCtrl() !=
nullptr )
343 return fbs->tempCtrl()->temp();
351 if( fbs->tempCtrl() !=
nullptr )
352 return fbs->tempCtrl()->setpt();
360 if( fbs->tempCtrl() !=
nullptr )
361 return fbs->tempCtrl()->status();
369 if( fbs->tempCtrl() !=
nullptr )
370 return fbs->tempCtrl()->ontarget();
378 if( fbs->tempCtrl() !=
nullptr )
380 if( fbs->tempCtrl()->statusStr() )
381 return fbs->tempCtrl()->statusStr()->c_str();
392 if( fbs->shutter() !=
nullptr )
394 if( fbs->shutter()->statusStr() )
395 return fbs->shutter()->statusStr()->c_str();
406 if( fbs->shutter() !=
nullptr )
408 if( fbs->shutter()->state() == -1 )
410 else if( fbs->shutter()->state() == 0 )
412 else if( fbs->shutter()->state() == 1 )
424 return fbs->synchro();
430 return fbs->vshift();
438 if( fbs->cropMode() == 1 )
447 if( fbs->readout_speed() !=
nullptr )
449 return std::string( fbs->readout_speed()->c_str() );
458 if( fbs->fan_speed() !=
nullptr )
460 return std::string( fbs->fan_speed()->c_str() );
469 if( fbs->analog_gain() !=
nullptr )
471 return std::string( fbs->analog_gain()->c_str() );
477 static bool led(
void *msgBuffer )
481 if( fbs->led() == 1 )
494 if( member ==
"mode" )
497 else if( member ==
"xcen" )
501 reinterpret_cast<void *
>( &
xcen ) } );
502 else if( member ==
"ycen" )
506 reinterpret_cast<void *
>( &
ycen ) } );
507 else if( member ==
"width" )
511 reinterpret_cast<void *
>( &
width ) } );
512 else if( member ==
"height" )
516 reinterpret_cast<void *
>( &
height ) } );
517 else if( member ==
"xbin" )
520 else if( member ==
"ybin" )
523 else if( member ==
"exptime" )
527 reinterpret_cast<void *
>( &
exptime ) } );
528 else if( member ==
"fps" )
531 else if( member ==
"emGain" )
535 reinterpret_cast<void *
>( &
emGain ) } );
536 else if( member ==
"adcSpeed" )
540 reinterpret_cast<void *
>( &
adcSpeed ) } );
541 else if( member ==
"temp" )
545 reinterpret_cast<void *
>( &
temp ) } );
546 else if( member ==
"tempSetpt" )
550 reinterpret_cast<void *
>( &
tempSetpt ) } );
551 else if( member ==
"tempStatus" )
556 else if( member ==
"tempOnTarget" )
561 else if( member ==
"tempStatusStr" )
566 else if( member ==
"shutterStatusStr" )
571 else if( member ==
"shutterState" )
576 else if( member ==
"synchro" )
580 reinterpret_cast<void *
>( &
synchro ) } );
581 else if( member ==
"vshift" )
585 reinterpret_cast<void *
>( &
vshift ) } );
586 else if( member ==
"cropMode" )
590 reinterpret_cast<void *
>( &
cropMode ) } );
591 else if( member ==
"readout_speed" )
596 else if( member ==
"fan_speed" )
600 reinterpret_cast<void *
>( &
fan_speed ) } );
601 else if( member ==
"analog_gain" )
606 else if( member ==
"led" )
611 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< 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 > fan_speed=0, ::flatbuffers::Offset<::flatbuffers::String > readout_speed=0, ::flatbuffers::Offset<::flatbuffers::String > analog_gain=0, int8_t led=-1)
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)
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 &fan_speed, const std::string &readout_speed, const std::string &analog_gain, const int8_t &led)
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 std::string fan_speed(void *msgBuffer)
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 bool led(void *msgBuffer)
static std::string readout_speed(void *msgBuffer)
static std::string analog_gain(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)