FtpDataFileList.h
Go to the documentation of this file.
1 /****
2  * Sming Framework Project - Open Source framework for high efficiency native ESP8266 development.
3  * Created 2015 by Skurydin Alexey
4  * http://github.com/SmingHub/Sming
5  * All files of the Sming Core are provided under the LGPL v3 license.
6  *
7  * FtpDataFileList.h
8  *
9  ****/
10 
11 #pragma once
12 
13 #include "FtpDataStream.h"
14 #include "FileSystem.h"
15 
17 {
18 public:
19  explicit FtpDataFileList(FtpServerConnection* connection) : FtpDataStream(connection)
20  {
21  }
22 
23  void transferData(TcpConnectionEvent sourceEvent) override
24  {
25  if(completed) {
26  return;
27  }
28  Vector<String> list = fileList();
29  debug_d("send file list: %d", list.count());
30  for(unsigned i = 0; i < list.count(); i++) {
31  writeString("01-01-15 01:00AM " + String(fileGetSize(list[i])) + " " + list[i] + "\r\n");
32  }
33  completed = true;
35  }
36 };
Definition: FtpDataStream.h:16
The String class.
Definition: WString.h:136
FtpDataFileList(FtpServerConnection *connection)
Definition: FtpDataFileList.h:19
unsigned int count() const override
Definition: WVector.h:47
TcpConnectionEvent
Definition: TcpConnection.h:25
#define debug_d
Definition: debug_progmem.h:100
void finishTransfer()
Definition: FtpDataStream.h:40
Vector< String > fileList()
Get list of files on file system.
bool completed
Definition: FtpDataStream.h:74
Definition: FtpServerConnection.h:29
void transferData(TcpConnectionEvent sourceEvent) override
Definition: FtpDataFileList.h:23
Definition: FtpDataFileList.h:16
int writeString(const char *data, uint8_t apiflags=TCP_WRITE_FLAG_COPY)
Definition: TcpConnection.h:59
uint32_t fileGetSize(const String &fileName)
Get size of file.