Laggger164

ESP32CAM_FTPClient library Ethernet fork header

Jul 7th, 2021 (edited)
382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class ESP32_FTPClient
  2. {
  3.   private:
  4.   void WriteClientBuffered(EthernetClient* cli, unsigned char * data, int dataLength);
  5.   char outBuf[128];
  6.   unsigned char outCount;
  7.   EthernetClient client;
  8.   EthernetClient dclient;
  9.   uint8_t verbose;
  10.  
  11.   template<typename T>
  12.         void FTPdbg(T msg) {
  13.         if(verbose == 2) Serial.print(msg);
  14.         }
  15.  
  16.   template<typename T>
  17.         void FTPdbgn(T msg) {
  18.         if(verbose == 2) Serial.println(msg);
  19.         }
  20.  
  21.     template<typename T>
  22.     void FTPerr(T msg) {
  23.     if(verbose == 1 || verbose == 2) Serial.print(msg);
  24.   }
  25.  
  26.   char* userName;
  27.   char* passWord;
  28.   char* serverAdress;
  29.   uint16_t port;
  30.   bool _isConnected = false;
  31.   unsigned char clientBuf[1500];
  32.   size_t bufferSize = 1500;
  33.   uint16_t timeout = 10000;
  34.   EthernetClient* GetDataClient();
  35.  
  36.   public:
  37.   ESP32_FTPClient(char* _serverAdress, uint16_t _port, char* _userName, char* _passWord, uint16_t _timeout = 10000, uint8_t _verbose = 1);
  38.   ESP32_FTPClient(char* _serverAdress, char* _userName, char* _passWord, uint16_t _timeout = 10000, uint8_t _verbose = 1);
  39.   void OpenConnection();
  40.   void CloseConnection();
  41.   bool isConnected();
  42.   void NewFile (const char* fileName);
  43.   void AppendFile( char* fileName);
  44.   void WriteData (unsigned char * data, int dataLength);
  45.   void CloseFile ();
  46.   void GetFTPAnswer (char* result = NULL, int offsetStart = 0);
  47.   void GetLastModifiedTime(const char* fileName, char* result);
  48.   void RenameFile(char* from, char* to);
  49.   void Write(const char * str);
  50.   void InitFile(const char* type);
  51.   void ChangeWorkDir(const char * dir);
  52.   void DeleteFile(const char * file);
  53.   void MakeDir(const char * dir);
  54.   void ContentList(const char * dir, String * list);
  55.   void ContentListWithListCommand(const char * dir, String * list);
  56.   void DownloadString(const char * filename, String &str);
  57.   void DownloadFile(const char * filename, unsigned char * buf, size_t length, bool printUART = false);
  58. };
Add Comment
Please, Sign In to add comment