project cleanup
This commit is contained in:
51
include/drive.h
Normal file
51
include/drive.h
Normal file
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* @file drive.h
|
||||
* @brief represent physical drive
|
||||
* @author hendrik schutter
|
||||
* @date 01.05.2020
|
||||
*/
|
||||
|
||||
#ifndef DRIVE_H_
|
||||
#define DRIVE_H_
|
||||
|
||||
#include "reHDD.h"
|
||||
|
||||
class Drive
|
||||
{
|
||||
protected:
|
||||
|
||||
public:
|
||||
Drive(string path)
|
||||
{
|
||||
this->sPath = path;
|
||||
}
|
||||
|
||||
string getPath(void);
|
||||
string getModelFamily(void);
|
||||
string getModelName(void);
|
||||
string getSerial(void);
|
||||
uint64_t getCapacity(void); //in byte
|
||||
uint32_t getErrorCount(void);
|
||||
uint32_t getPowerOnHours(void); //in hours
|
||||
uint32_t getPowerCycles(void);
|
||||
|
||||
void setDriveSMARTData( string modelFamily,
|
||||
string modelName,
|
||||
string serial,
|
||||
uint64_t capacity,
|
||||
uint32_t errorCount,
|
||||
uint32_t powerOnHours,
|
||||
uint32_t powerCycles);
|
||||
|
||||
private:
|
||||
string sPath;
|
||||
string sModelFamily;
|
||||
string sModelName;
|
||||
string sSerial;
|
||||
uint64_t u64Capacity = 0U; //in byte
|
||||
uint32_t u32ErrorCount = 0U;
|
||||
uint32_t u32PowerOnHours = 0U; //in hours
|
||||
uint32_t u32PowerCycles = 0U;
|
||||
};
|
||||
|
||||
#endif // DRIVE_H_
|
47
include/reHDD.h
Normal file
47
include/reHDD.h
Normal file
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* @file reHDD.h
|
||||
* @brief represent
|
||||
* @author hendrik schutter
|
||||
* @date 01.05.2020
|
||||
*/
|
||||
|
||||
#ifndef REHDD_H_
|
||||
#define REHDD_H_
|
||||
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include "drive.h"
|
||||
#include "smart.h"
|
||||
|
||||
template <typename T, typename I> T* iterator_to_pointer(I i)
|
||||
{
|
||||
return (&(*i));
|
||||
}
|
||||
|
||||
class reHDD
|
||||
{
|
||||
protected:
|
||||
|
||||
public:
|
||||
reHDD(void);
|
||||
void app_logic();
|
||||
|
||||
private:
|
||||
|
||||
vector <Drive> vecDrives; //stores all drive data
|
||||
|
||||
void searchDrives(vector <Drive>* pvecDrives);
|
||||
void printDrives(vector <Drive>* pvecDrives);
|
||||
void filterIgnoredDrives(vector <Drive>* pvecDrives);
|
||||
void addSMARTData(vector <Drive>* pvecDrives);
|
||||
};
|
||||
|
||||
|
||||
#endif // REHDD_H_
|
40
include/smart.h
Normal file
40
include/smart.h
Normal file
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @file smart.h
|
||||
* @brief read S.M.A.R.T values
|
||||
* @author hendrik schutter
|
||||
* @date 01.05.2020
|
||||
*/
|
||||
|
||||
#ifndef SMART_H_
|
||||
#define SMART_H_
|
||||
|
||||
#include "reHDD.h"
|
||||
|
||||
class SMART
|
||||
{
|
||||
protected:
|
||||
|
||||
public:
|
||||
static void readSMARTData(Drive* drive);
|
||||
|
||||
private:
|
||||
SMART(void);
|
||||
|
||||
static void parseModelFamily(string sLine);
|
||||
static void parseModelName(string sLine);
|
||||
static void parseSerial(string sLine);
|
||||
static void parseCapacity(string sLine);
|
||||
static void parseErrorCount(string sLine);
|
||||
static void parsePowerOnHours(string sLine);
|
||||
static void parsePowerCycle(string sLine);
|
||||
|
||||
static string modelFamily;
|
||||
static string modelName;
|
||||
static string serial;
|
||||
static uint64_t capacity;
|
||||
static uint32_t errorCount;
|
||||
static uint32_t powerOnHours;
|
||||
static uint32_t powerCycle;
|
||||
};
|
||||
|
||||
#endif // SMART_H_
|
Reference in New Issue
Block a user