iCub-main
diagnosticLowLevelFormatter_hid.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2018 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
9 
10 #ifndef __diagnosticLowLevelFormatter_hid_h__
11 #define __diagnosticLowLevelFormatter_hid_h__
12 
13 #include <string>
14 #include <string_view>
15 #include <memory>
16 #include <array>
17 #include <yarp/os/LogStream.h>
18 #include <yarp/os/Log.h>
20 #include "EoError.h"
21 
22 #include "IethResource.h"
23 
24 
25 namespace Diagnostic {
26  namespace LowLevel {
27  class DefaultParser;
28  class ConfigParser;
29  class MotionControlParser;
30  class SkinParser;
31  class HwErrorParser;
32  class SysParser;
33  class EthMonitorParser;
34  class InertialSensorParser;
35  class AnalogSensorParser;
36  class AuxEmbeddedInfo;
37  class EntityNameProvider;
38  }
39 }
40 
41 constexpr int diagstr_lenght = 64;
42 typedef char diagstr[diagstr_lenght];
43 
44 //In this class the Info formatter and the parsers collect the embedded diagnostic Info.
45 //Only the info contained in Diagnostic::EmbeddedInfo baseInfo are usefull for the user level.
47 {
48 public:
50  eOipv4addr_t sourceBoardIpAddr; // is the ipv4 address, in eOipv4addr_t, of the board that sends the diagnostic information
51  eOerror_code_t errorCode; // this is the error code sent by the board;
52  std::string baseMessage; //this is the base message string without any parameter
53  std::string extraMessage;// in some case, the board can send an extra string
54  uint64_t param64; // the 64 bits paramter sent by the board
55  uint16_t param16; //the 16 bits parameter sent by the board
56 
57 public:
58  void printMessage();
59 };
60 
61 
62 //This class has the goal to provide the name of an entity (axis, sensors, etc) to the parsers.
64 {
65 public:
66  EntityNameProvider(eOipv4addr_t boardAddr, eth::TheEthManager* ethManager);
67  EntityNameProvider() = delete;
71 private:
72  eth::TheEthManager* m_ethManager;
73  eth::IethResource* m_MC_ethRes;
74 public:
75  bool getAxisName(uint32_t entityId, std::string &axisName);
76 };
77 
78 
79 
81 {
82 
83 public:
85  DefaultParser() = delete;
89  virtual void parseInfo();
90 
91 protected:
94 
95  void printBaseInfo();
96 };
97 
99 {
100 public:
102  ConfigParser() = delete;
106 
107  void parseInfo();
108 };
109 
110 
112 {
113 public:
119 
120  void parseInfo();
121 
122 private:
123 std::string motorStatusBitsToString(eOmc_motorFaultState_t motorstatus);
124 };
125 
127 {
128 public:
130  SkinParser() = delete;
134 
135  void parseInfo();
136 };
137 
139 {
140 public:
142  HwErrorParser() = delete;
146 
147  void parseInfo();
148 
149 
150 };
151 
153 {
154 public:
156  SysParser() = delete;
160 
161  void parseInfo();
162 
163 private:
164 void canMask2canBoardsStr(uint16_t canmask, diagstr canboardsstr);
165 void getCanMonitorInfo(eOmn_serv_category_t &serv_category, diagstr boardsOnCan1, diagstr boardsOnCan2);
166 void getCanMonitorInfoWithTime(eOmn_serv_category_t &serv_category, diagstr boardsOnCan1, diagstr boardsOnCan2, uint32_t &time);
167 };
168 
169 
171 {
172 public:
174  EthMonitorParser() = delete;
178 
179  void parseInfo();
180 
181 };
182 
184 {
185 public:
191 
192  void parseInfo();
193 };
194 
196 {
197 public:
199  AnalogSensorParser() = delete;
203 
204  void parseInfo();
205 };
206 
207 
208 
209 #endif //__diagnosticLowLevelFormatter_hid_h__
AnalogSensorParser(Diagnostic::LowLevel::AnalogSensorParser &&parser)=delete
AnalogSensorParser(const Diagnostic::LowLevel::AnalogSensorParser &parser)=delete
ConfigParser(const Diagnostic::LowLevel::ConfigParser &parser)=delete
ConfigParser(Diagnostic::LowLevel::ConfigParser &&parser)=delete
DefaultParser(const Diagnostic::LowLevel::DefaultParser &parser)=delete
DefaultParser(Diagnostic::LowLevel::DefaultParser &&parser)=delete
Diagnostic::LowLevel::EntityNameProvider & m_entityNameProvider
Diagnostic::LowLevel::AuxEmbeddedInfo & m_dnginfo
EntityNameProvider(const Diagnostic::LowLevel::EntityNameProvider &EntityNameProvider)
EntityNameProvider(const Diagnostic::LowLevel::EntityNameProvider &&EntityNameProvider)
bool getAxisName(uint32_t entityId, std::string &axisName)
EthMonitorParser(const Diagnostic::LowLevel::EthMonitorParser &parser)=delete
EthMonitorParser(Diagnostic::LowLevel::EthMonitorParser &&parser)=delete
HwErrorParser(Diagnostic::LowLevel::HwErrorParser &&parser)=delete
HwErrorParser(const Diagnostic::LowLevel::HwErrorParser &parser)=delete
InertialSensorParser(const Diagnostic::LowLevel::InertialSensorParser &parser)=delete
InertialSensorParser(Diagnostic::LowLevel::InertialSensorParser &&parser)=delete
MotionControlParser(const Diagnostic::LowLevel::MotionControlParser &parser)=delete
MotionControlParser(Diagnostic::LowLevel::MotionControlParser &&parser)=delete
SkinParser(Diagnostic::LowLevel::SkinParser &&parser)=delete
SkinParser(const Diagnostic::LowLevel::SkinParser &parser)=delete
SysParser(const Diagnostic::LowLevel::SysParser &parser)=delete
SysParser(Diagnostic::LowLevel::SysParser &&parser)=delete
char diagstr[diagstr_lenght]
constexpr int diagstr_lenght
degrees time
Definition: sine.m:5