First commit
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
#ifndef FILETRANSECEIVER_H
|
||||
#define FILETRANSECEIVER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include<stdio.h>
|
||||
#include<sys/types.h>
|
||||
#include<sys/socket.h>
|
||||
#include<netinet/in.h>
|
||||
#include<arpa/inet.h>
|
||||
#include<string.h>
|
||||
#include<stdlib.h>
|
||||
#include<unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <QMessageBox>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QQueue>
|
||||
#include <QMutex>
|
||||
#define DOC_DIR "/home/plg/doc"
|
||||
#define SEARCH 100
|
||||
#define DOWN 200
|
||||
#define END 500
|
||||
#define FAIL 300
|
||||
#define SUCCESS 400
|
||||
#define UP 600
|
||||
#define UPGRADE 601
|
||||
|
||||
struct msg
|
||||
{
|
||||
int type;
|
||||
int flag;
|
||||
char buf[64];
|
||||
char fname[100];
|
||||
};
|
||||
|
||||
typedef unsigned char UCHAR;
|
||||
|
||||
class FileTranseceiver : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FileTranseceiver(uint16_t hostshort);
|
||||
~FileTranseceiver(void);
|
||||
|
||||
int ftp_download(int connfd,struct msg info);
|
||||
int upload_ftp(int connfd,struct msg info);
|
||||
void start();
|
||||
void showData(QString tag,QByteArray dat)const;
|
||||
QByteArray read(int length);
|
||||
bool CheckSumIn(QByteArray a);
|
||||
void write(int code, QByteArray d);
|
||||
void InstructionCode1(QByteArray d);
|
||||
void InstructionCode2(QByteArray d);
|
||||
void InstructionCode3(QByteArray d);
|
||||
void InstructionCode4(QByteArray d);
|
||||
void InstructionCode5(QByteArray d);
|
||||
void InstructionCode6(QByteArray d);
|
||||
void InstructionCode7(QByteArray d);
|
||||
void InstructionCode8(QByteArray d);
|
||||
|
||||
private slots:
|
||||
void refreshtimerHandler();
|
||||
protected slots:
|
||||
void connectListen();
|
||||
//void printer_operate_0x05();
|
||||
void printer_operate_0x01_result(int status);
|
||||
void WriteInstructionCodeAck(int InstructionCode,QByteArray data);
|
||||
private:
|
||||
uint16_t port;
|
||||
int sockfd;
|
||||
int connfd;
|
||||
QThread *serverThead;
|
||||
int upload_and_upgrade(int connfd, msg info);
|
||||
void connectListen5001();
|
||||
void connectListen5002();
|
||||
UCHAR CheckSumIn( UCHAR *buf, unsigned int len);
|
||||
QTimer *refresh_timer;
|
||||
QMutex mutex;
|
||||
signals:
|
||||
void fileRecieved(QString fileName);
|
||||
void printer_operate_0x01();
|
||||
void printer_operate_0x02();
|
||||
void printer_operate_0x03(QString);
|
||||
void printer_operate_0x04();
|
||||
void printer_operate_0x06();
|
||||
void clear_DataCache();
|
||||
void drop_NextSignal();
|
||||
};
|
||||
|
||||
#endif // FILETRANSECEIVER_H
|
||||
Reference in New Issue
Block a user