hlp:桂林国际齿轮泵代码
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
#ifndef LICENSEMANGER_H
|
||||
#define LICENSEMANGER_H
|
||||
#include <QtGlobal>
|
||||
#include <QDate>
|
||||
#include <QMutex>
|
||||
#include "Aes/TAesClass.h"
|
||||
#include "VerBVersion.h"
|
||||
|
||||
#define LIC_FILE "/etc/licenseData"
|
||||
#define UPDATE_LIC_FILE "/udisk/lic_update_file"
|
||||
//#define MACH_INFO_FILE "/home/student/mini2440/UP/QtUI/machine_info"
|
||||
#define MACH_INFO_FILE "/etc/appdata/machine_info"
|
||||
|
||||
#define LICENSE_STATE_OK 0
|
||||
#define LICENSE_STATE_MACH_INFO_DAMAGED 1
|
||||
#define LICENSE_STATE_LIC_DATA_DAMAGED 2
|
||||
#define LICENSE_STATE_REMAIN_TIME_WARNING 3 //提前提示维护码到期
|
||||
#define LICENSE_STATE_REMAIN_TIME_REARCH 4
|
||||
|
||||
#define UPDATE_LICENSE_FILE_OK 0
|
||||
#define UPDATE_LICENSE_FILE_NOT_EXIT 1
|
||||
#define UPDATE_LICENSE_FILE_OPEN_FAILED 2
|
||||
#define UPDATE_LICENSE_FILE_SERIAL_NUMBER_ERR 3 //提前提示维护码到期
|
||||
#define UPDATE_LICENSE_FILE_ACTIVE_NUMBER_ERR 4
|
||||
#define UPDATE_LICENSE_FILE_SW_VERSION_ERR 5
|
||||
#define UPDATE_LICENSE_FILE_MD5_VALUE_ERR 66
|
||||
|
||||
#define LIC_DATA_MD5_LEN 16
|
||||
|
||||
typedef struct {
|
||||
unsigned int serial_number;
|
||||
unsigned char md5[LIC_DATA_MD5_LEN];
|
||||
}MACHINE_INFO_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned int serial_number;
|
||||
unsigned char enable; //1Byte
|
||||
unsigned char powerEn; // 1Byte
|
||||
unsigned char printEn; // 1Byte
|
||||
|
||||
unsigned int powerMinuteMax;
|
||||
unsigned int powerMinuteCnt;
|
||||
unsigned int printMax;
|
||||
unsigned int printCnt; // printDot/1024
|
||||
|
||||
unsigned int start;// yyyymmdd
|
||||
unsigned int end; // yyyymmdd
|
||||
unsigned int nDate;
|
||||
unsigned int workout;
|
||||
unsigned int remainingTime;//10 second count: 1 day = 6x60x24=8640; 1 week = 7x8640 = 60480; 1 year=8640 x 365 = 3153600
|
||||
unsigned int printer_bworkout;
|
||||
unsigned int printer_active_count;
|
||||
unsigned int printer_auth_flag;
|
||||
unsigned int vernon_bach_version;
|
||||
unsigned char md5[LIC_DATA_MD5_LEN];
|
||||
}LICENSE_DATA_t;
|
||||
|
||||
|
||||
|
||||
typedef enum {
|
||||
LicenseState_eLicAvailable,
|
||||
LicenseState_eLicTimeOut,
|
||||
LicenseState_eMachineError
|
||||
}LicenseState_e;
|
||||
|
||||
|
||||
|
||||
class LicenseManger
|
||||
{
|
||||
private:
|
||||
|
||||
public:
|
||||
LicenseManger();
|
||||
|
||||
qint32 setMachineInfo(quint32 serial_num);
|
||||
qint32 checkMachineInfoAvailable();
|
||||
qint8 getLicState();
|
||||
void SaveLicData2File();
|
||||
void ReadLicDataFromFile();
|
||||
void ResetLicDataFile();
|
||||
int CheckLicDataValid();
|
||||
quint32 CheckRemainingTime();
|
||||
quint32 CheckUpdateFileState();
|
||||
quint32 UpdateLicenseFileData();
|
||||
private:
|
||||
QDate curDate;
|
||||
TAesClass *pAes;
|
||||
};
|
||||
|
||||
extern MACHINE_INFO_t machine_info;
|
||||
extern LICENSE_DATA_t license_data;
|
||||
#endif // LICENSEMANGER_H
|
||||
Reference in New Issue
Block a user