feature/ipc_mgsqueue_printer (#57)
closes #56 Co-authored-by: localhorst <localhorst@mosad.xyz> Reviewed-on: #57
This commit is contained in:
@ -33,9 +33,9 @@ public:
|
||||
|
||||
bool bWasShredded = false; //all shred iterations done
|
||||
bool bWasChecked = false; //all shred iterations and optional checking done
|
||||
bool bWasDeleteted = false;
|
||||
bool bWasDeleted = false;
|
||||
bool bIsOffline = false;
|
||||
uint32_t u32DriveChecksumAferShredding = 0U;
|
||||
uint32_t u32DriveChecksumAfterShredding = 0U;
|
||||
|
||||
private:
|
||||
string sPath;
|
||||
|
60
include/printer.h
Normal file
60
include/printer.h
Normal file
@ -0,0 +1,60 @@
|
||||
/**
|
||||
* @file printer.h
|
||||
* @brief Send drive data to printer service using ipc msg queue
|
||||
* @author Hendrik Schutter
|
||||
* @date 24.11.2022
|
||||
*/
|
||||
|
||||
#ifndef PRINTER_H_
|
||||
#define PRINTER_H_
|
||||
|
||||
#include "reHDD.h"
|
||||
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/msg.h>
|
||||
|
||||
#define STR_BUFFER_SIZE 64U
|
||||
#define IPC_MSG_QUEUE_KEY 0x1B11193C0
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char caDriveIndex[STR_BUFFER_SIZE];
|
||||
char caDriveHours[STR_BUFFER_SIZE];
|
||||
char caDriveCycles[STR_BUFFER_SIZE];
|
||||
char caDriveErrors[STR_BUFFER_SIZE];
|
||||
char caDriveShredTimestamp[STR_BUFFER_SIZE];
|
||||
char caDriveShredDuration[STR_BUFFER_SIZE];
|
||||
char caDriveCapacity[STR_BUFFER_SIZE];
|
||||
char caDriveState[STR_BUFFER_SIZE];
|
||||
char caDriveModelFamily[STR_BUFFER_SIZE];
|
||||
char caDriveModelName[STR_BUFFER_SIZE];
|
||||
char caDriveSerialnumber[STR_BUFFER_SIZE];
|
||||
char caDriveReHddVersion[STR_BUFFER_SIZE];
|
||||
|
||||
} t_driveData;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
long msg_queue_type;
|
||||
t_driveData driveData;
|
||||
} t_msgQueueData;
|
||||
|
||||
|
||||
class Printer
|
||||
{
|
||||
protected:
|
||||
|
||||
public:
|
||||
static Printer* getPrinter();
|
||||
void print(Drive* drive);
|
||||
|
||||
private:
|
||||
static bool instanceFlag;
|
||||
static Printer *single;
|
||||
int msqid;
|
||||
Printer();
|
||||
~Printer();
|
||||
|
||||
|
||||
};
|
||||
#endif // PRINTER_H_
|
@ -8,7 +8,7 @@
|
||||
#ifndef REHDD_H_
|
||||
#define REHDD_H_
|
||||
|
||||
#define REHDD_VERSION "V1.0.0"
|
||||
#define REHDD_VERSION "V1.1.0"
|
||||
|
||||
// Drive handling Settings
|
||||
#define WORSE_HOURS 19200 //mark drive if at this limit or beyond
|
||||
@ -64,6 +64,7 @@ using namespace std;
|
||||
#include "shred.h"
|
||||
#include "delete.h"
|
||||
#include "tui.h"
|
||||
#include "printer.h"
|
||||
#include "logger/logger.h"
|
||||
|
||||
extern Logger* logging;
|
||||
@ -90,7 +91,7 @@ private:
|
||||
static void filterIgnoredDrives(list <Drive>* plistDrives);
|
||||
static void filterNewDrives(list <Drive>* plistOldDrives, list <Drive>* plistNewDrives);
|
||||
static void addSMARTData(list <Drive>* plistDrives);
|
||||
static void ThreadScannDevices();
|
||||
static void ThreadScanDevices();
|
||||
static void ThreadUserInput();
|
||||
static void ThreadShred(Drive* const pDrive);
|
||||
static void ThreadDelete();
|
||||
|
@ -21,7 +21,7 @@
|
||||
#define CHUNK_SIZE 1024*1024*32 //amount of bytes that are overwritten at once --> 32MB
|
||||
#define TFNG_DATA_SIZE CHUNK_SIZE //amount of bytes used by tfng
|
||||
|
||||
//#define DEMO_DRIVE_SIZE 1024*1024*256L // 256MB
|
||||
#define DEMO_DRIVE_SIZE 1024*1024*256L // 256MB
|
||||
//#define DEMO_DRIVE_SIZE 1024*1024*1024L // 1GB
|
||||
//#define DEMO_DRIVE_SIZE 5*1024*1024*1024L // 5GB
|
||||
//#define DEMO_DRIVE_SIZE 1024*1024*1024*10L // 10GB
|
||||
|
Reference in New Issue
Block a user