API
 
Loading...
Searching...
No Matches
ocam_temps.hpp
Go to the documentation of this file.
1/** \file ocam_temps.hpp
2 * \brief The MagAO-X logger ocam_temps log type.
3 * \author Jared R. Males (jaredmales@gmail.com)
4 *
5 * \ingroup logger_types_files
6 *
7 * History:
8 * - 2018-09-06 created by JRM
9 */
10#ifndef logger_types_ocam_temps_hpp
11#define logger_types_ocam_temps_hpp
12
13#include "generated/ocam_temps_generated.h"
14#include "flatbuffer_log.hpp"
15
16namespace MagAOX
17{
18namespace logger
19{
20
21
22/// Log entry recording the build-time git state.
23/** \ingroup logger_types
24 */
26{
27 ///The event code
28 static const flatlogs::eventCodeT eventCode = eventCodes::OCAM_TEMPS;
29
30 ///The default level
32
33 static timespec lastRecord; ///< The time of the last time this log was recorded. Used by the telemetry system.
34
35 ///The type of the input message
36 struct messageT : public fbMessage
37 {
38 ///Construct from components
39 messageT( const float & ccd, ///<[in] CCD temperature
40 const float & cpu, ///<[in] CPU temperature
41 const float & power, ///<[in] Power unit temperature
42 const float & bias, ///<[in] Bias temperature
43 const float & water, ///<[in] Water temperature
44 const float & left, ///<[in] Left temperature
45 const float & right, ///<[in] Right temperature
46 const float & cooling ///<[in] Cooling power
47 )
48 {
49 auto fp = CreateOcam_temps_fb(builder, ccd,cpu, power, bias, water, left, right, cooling);
50 builder.Finish(fp);
51 }
52
53 };
54
55 static bool verify( flatlogs::bufferPtrT & logBuff, ///< [in] Buffer containing the flatbuffer serialized message.
56 flatlogs::msgLenT len ///< [in] length of msgBuffer.
57 )
58 {
59 auto verifier = flatbuffers::Verifier( static_cast<uint8_t*>(flatlogs::logHeader::messageBuffer(logBuff)), static_cast<size_t>(len));
60 return VerifyOcam_temps_fbBuffer(verifier);
61 }
62
63 ///Get the message formatte for human consumption.
64 static std::string msgString( void * msgBuffer, /**< [in] Buffer containing the flatbuffer serialized message.*/
65 flatlogs::msgLenT len /**< [in] [unused] length of msgBuffer.*/
66 )
67 {
68 static_cast<void>(len);
69
70 auto fbs = GetOcam_temps_fb(msgBuffer);
71
72 std::string msg = "ccd: ";
73 msg += std::to_string(fbs->ccd()) + " C ";
74
75 msg += "cpu: ";
76 msg += std::to_string(fbs->cpu()) + " C ";
77
78 msg += "pwr: ";
79 msg += std::to_string(fbs->power()) + " C ";
80
81 msg += "bias: ";
82 msg += std::to_string(fbs->bias()) + " C ";
83
84 msg += "water: ";
85 msg += std::to_string(fbs->water()) + " C ";
86
87 msg += "left: ";
88 msg += std::to_string(fbs->left()) + " C ";
89
90 msg += "right: ";
91 msg += std::to_string(fbs->right()) + " C ";
92
93 msg += "cool-pwr: ";
94 msg += std::to_string(fbs->cooling()) + " mW ";
95
96 return msg;
97
98 }
99
100}; //ocam_temps
101
102
103
104} //namespace logger
105} //namespace MagAOX
106
107#endif //logger_types_ocam_temps_hpp
108
The MagAO-X logger flatbuffer log base type.
uint16_t eventCodeT
The type of an event code (16-bit unsigned int).
Definition logDefs.hpp:40
msgLen2T msgLenT
The type used to refer to the message length, regardless of length.
Definition logDefs.hpp:69
int8_t logPrioT
The type of the log priority code.
Definition logDefs.hpp:21
static void * messageBuffer(bufferPtrT &logBuffer)
Get the message buffer address.
std::shared_ptr< char > bufferPtrT
The log entry buffer smart pointer.
Definition logHeader.hpp:58
Definition dm.hpp:24
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 float &ccd, const float &cpu, const float &power, const float &bias, const float &water, const float &left, const float &right, const float &cooling)
Construct from components.
Log entry recording the build-time git state.
static const flatlogs::eventCodeT eventCode
The event code.
static bool verify(flatlogs::bufferPtrT &logBuff, flatlogs::msgLenT len)
static timespec lastRecord
The time of the last time this log was recorded. Used by the telemetry system.
static std::string msgString(void *msgBuffer, flatlogs::msgLenT len)
Get the message formatte for human consumption.
static const flatlogs::logPrioT defaultLevel
The default level.