44 lines
1.0 KiB
C
44 lines
1.0 KiB
C
|
|
#ifndef FILEOPERATOR_H
|
|||
|
|
#define FILEOPERATOR_H
|
|||
|
|
|
|||
|
|
#include <QFile>
|
|||
|
|
#include <QObject>
|
|||
|
|
#include "CommSerialDef.h"
|
|||
|
|
using namespace std;
|
|||
|
|
|
|||
|
|
class FileOperator
|
|||
|
|
{
|
|||
|
|
public:
|
|||
|
|
//filePath: 包含文件名的绝对路径
|
|||
|
|
FileOperator();
|
|||
|
|
~FileOperator();
|
|||
|
|
|
|||
|
|
bool Open(const QString &filePath);
|
|||
|
|
bool OpenOXDatFile(const QString &xFilePath);//0x开头的文本格式
|
|||
|
|
bool OpenUXDatFile(const QString &uxFilePath);//没有0x开头的文本格式
|
|||
|
|
bool OpenBitFile(const QString &xFilePath); //二进制格式
|
|||
|
|
|
|||
|
|
void GetFlashData(int nFrameIndex,uchar* buf,int &len);
|
|||
|
|
void GetConvertData(int nFrameIndex, uchar *buf,int &len);
|
|||
|
|
|
|||
|
|
//bit文件存储
|
|||
|
|
bool WriteDataToFile(const QString &savePath);
|
|||
|
|
|
|||
|
|
|
|||
|
|
int HexStringToData(const char* szStr,QByteArray& arr);
|
|||
|
|
int HexChar(char c);
|
|||
|
|
|
|||
|
|
public:
|
|||
|
|
|
|||
|
|
unsigned char m_FileCheckValue[4]; //文件和校验, 低字节在前,高字节在后
|
|||
|
|
unsigned char m_iFileNo;
|
|||
|
|
qint64 m_size;
|
|||
|
|
int m_nFrameCount;
|
|||
|
|
uchar* m_bufAll;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
#endif // FILEOPERATOR_H
|
|||
|
|
|
|||
|
|
|
|||
|
|
|