⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sftupload.h

📁 通过串口发送接受文件
💻 H
字号:
//---------------------------------------------------------------------------
#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -