-
Notifications
You must be signed in to change notification settings - Fork 7
/
jetson_tx2_power.hh
76 lines (63 loc) · 1.86 KB
/
jetson_tx2_power.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef _JETSON_TX2_POWER_HH_
#define _JETSON_TX2_POWER_HH_
#include <string>
#include <iostream>
#include <vector>
#include <map>
class PowerReadingValue
{
protected:
std::string name;
std::string path;
std::string value;
int number;
public:
PowerReadingValue(std::string name);
void update(void);
std::string get_name(void);
std::string get_value(void);
friend std::ostream& operator<< (std::ostream& stream, const PowerReadingValue& value);
};
class PowerReadingVoltage: public PowerReadingValue
{
public:
PowerReadingVoltage(std::string path, int number);
};
class PowerReadingCurrent: public PowerReadingValue
{
public:
PowerReadingCurrent(std::string path, int number);
};
class PowerReadingRail
{
protected:
std::string name;
PowerReadingVoltage voltage;
PowerReadingCurrent current;
public:
PowerReadingRail(std::string path, int num);
std::string get_name(void);
void update(void);
std::string to_csv(void);
std::string get_csv_header(void);
friend std::ostream& operator<< (std::ostream& stream, const PowerReadingRail& r);
};
class PowerReadingDevice
{
protected:
std::vector<PowerReadingRail> rails;
public:
PowerReadingDevice(std::string path);
void update(void);
std::string to_csv(void);
std::string get_csv_header(void);
friend std::ostream& operator<< (std::ostream& stream, const PowerReadingDevice& d);
};
std::vector<PowerReadingDevice> create_devices(void);
void to_csv(std::string csv_file, std::vector<PowerReadingDevice> &devices, std::string comment);
void to_csv(std::string csv_file, std::vector<PowerReadingDevice> &devices);
void to_csv(std::string csv_file, std::vector<PowerReadingDevice> &devices,
std::map<std::string,std::string> &xtra_fields);
int update_power_values(std::vector<PowerReadingDevice> &devices);
int print_values(std::vector<PowerReadingDevice> &devices);
#endif // _JETSON_TX2_POWER_HH_