#ifndef FILETRANSECEIVER_H #define FILETRANSECEIVER_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #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