reHDD/include/printer.h

60 lines
1.2 KiB
C
Raw Normal View History

2022-11-24 19:03:33 +01:00
/**
* @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"
2022-11-24 19:21:24 +01:00
#include <sys/ipc.h>
#include <sys/msg.h>
2022-11-24 19:03:33 +01:00
#define STR_BUFFER_SIZE 64U
2022-11-24 19:21:24 +01:00
#define IPC_MSG_QUEUE_KEY 0x1B11193C0
2022-11-24 19:03:33 +01:00
typedef struct
2022-11-24 19:21:24 +01:00
{
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 caDriveModelFamiliy[STR_BUFFER_SIZE];
char caDriveModelName[STR_BUFFER_SIZE];
char caDriveSerialnumber[STR_BUFFER_SIZE];
char caDriveReHddVersion[STR_BUFFER_SIZE];
2022-11-24 19:03:33 +01:00
} t_driveData;
typedef struct
{
2022-11-24 19:21:24 +01:00
long msg_queue_type;
t_driveData driveData;
2022-11-24 19:03:33 +01:00
} t_msgQueueData;
class Printer
{
protected:
public:
static Printer* getPrinter();
void print();
private:
static bool instanceFlag;
static Printer *single;
2022-11-24 19:21:24 +01:00
int msqid;
2022-11-24 19:03:33 +01:00
Printer();
~Printer();
2022-11-24 19:21:24 +01:00
2022-11-24 19:03:33 +01:00
};
#endif // PRINTER_H_