API
 
Loading...
Searching...
No Matches
telem_pico.hpp
Go to the documentation of this file.
1/** \file telem_pico.hpp
2 * \brief The MagAO-X logger telem_pico log type.
3 * \author Chris Bohlman (cbohlmanaz@gmail.com)
4 *
5 * \ingroup logger_types_files
6 *
7 * History:
8 * - 2018-10-15 created by CJB
9 */
10#ifndef logger_types_telem_pico_hpp
11#define logger_types_telem_pico_hpp
12
13#include "generated/telem_pico_generated.h"
14#include "flatbuffer_log.hpp"
15
16namespace MagAOX
17{
18namespace logger
19{
20
21
22/// Log entry recording CPU temperatures
23/** \ingroup logger_types
24 */
26{
27
28 static const flatlogs::eventCodeT eventCode = eventCodes::TELEM_PICO;
30
31 static timespec lastRecord; ///< The time of the last time this log was recorded. Used by the telemetry system.
32
33 ///The type of the input message
34 struct messageT : public fbMessage
35 {
36 ///Construct from components
37 messageT( std::vector<int64_t> & counts )
38 {
39
40 auto _countsVec = builder.CreateVector(counts);
41
42 auto fp = CreateTelem_pico_fb(builder, _countsVec );
43
44 builder.Finish(fp);
45
46 }
47
48 };
49
50 static bool verify( flatlogs::bufferPtrT & logBuff, ///< [in] Buffer containing the flatbuffer serialized message.
51 flatlogs::msgLenT len ///< [in] length of msgBuffer.
52 )
53 {
54 auto verifier = flatbuffers::Verifier( static_cast<uint8_t*>(flatlogs::logHeader::messageBuffer(logBuff)), static_cast<size_t>(len));
55 return VerifyTelem_pico_fbBuffer(verifier);
56 }
57
58 ///Get the message formatte for human consumption.
59 static std::string msgString( void * msgBuffer, /**< [in] Buffer containing the flatbuffer serialized message.*/
60 flatlogs::msgLenT len /**< [in] [unused] length of msgBuffer.*/
61 )
62 {
63
64 static_cast<void>(len); // unused by most log types
65
66 auto rgs = GetTelem_pico_fb(msgBuffer);
67
68 std::string msg;
69
70 if (rgs->counts() != nullptr)
71 {
72 msg+= "[pico pos] ";
73 for(flatbuffers::Vector<int64_t>::const_iterator it = rgs->counts()->begin(); it != rgs->counts()->end(); ++it)
74 {
75 msg+= std::to_string(*it);
76 msg+= " ";
77 }
78 }
79
80 return msg;
81
82 }
83
84}; //telem_pico
85
86
87
88} //namespace logger
89} //namespace MagAOX
90
91#endif //logger_types_telem_pico_hpp
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(std::vector< int64_t > &counts)
Construct from components.
Log entry recording CPU temperatures.
static const flatlogs::eventCodeT eventCode
static timespec lastRecord
The time of the last time this log was recorded. Used by the telemetry system.
static bool verify(flatlogs::bufferPtrT &logBuff, flatlogs::msgLenT len)
static std::string msgString(void *msgBuffer, flatlogs::msgLenT len)
Get the message formatte for human consumption.
static const flatlogs::logPrioT defaultLevel