sftupload.h

来自「通过串口发送接受文件」· C头文件 代码 · 共 58 行

H
58
字号
//---------------------------------------------------------------------------
#ifndef SFTUploadH
#define SFTUploadH
//---------------------------------------------------------------------------
#include <Vcl.h>
#include <Classes.hpp>
#include "Comport.h"
//---------------------------------------------------------------------------
class SFTUpload : public TThread
{
private:
        unsigned char SFT_tx_buf[4096];
        unsigned char SFT_rx_buf[4096];
        void transmit_eot(void);
        void transmit_ack(void);
        void transmit_nak(void);
        int  transmit_block(unsigned char *buffer, int len );
        int  receive_block(unsigned char *buffer, int time_out );
        void  SFTSendFile(void);
        void __fastcall ShowProgress();
        long asc_to_long(unsigned char *buf);
        int  asc_to_int(unsigned char *buf);
        void long_to_asc(unsigned char *buf, unsigned long value);
        void int_to_asc(unsigned char *buf, unsigned int value);
        void conv_filename(char *buf, char *filename);
        void filename_conv(char *filename, const char *buf);
        long fsize( String FileName );
        int  FileCount;
        long TotalFileSize;
        long CurrentFileSize;
        long UploadedLen;
        long TotalUploadedLen;
        char CurrentFileName[256];
        int  ComReadString(char *Str,int timeout);
        void ComWriteString(char *Str,int timeout);
protected:
        void __fastcall Execute();
public:
        __fastcall SFTUpload(bool CreateSuspended);
        TLabel *LabelFileCount;
        TLabel *LabelTotalFileSize;
        TLabel *LabelCurrentFileSize;
        TLabel *LabelCurrentFileName;
        TLabel *LabelUploadedLen;
        TProgressBar *ProgressBar;
        TProgressBar *ProgressBar1;
        TComport *Com ;
        bool Stop;
        TStrings *FileNames;
        int  ErrorNo;
        char ErrorString[64];
        char MachineID[32];
        void StopUpload(void);
        bool AllowMessageBox;
};
//---------------------------------------------------------------------------
#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?