Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
MultipartStream.h
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  * MultipartStream.h
8  *
9  * @author Slavey Karadzhov <slaff@attachix.com>
10  *
11  ****/
12 
13 #ifndef _SMING_CORE_DATA_STREAM_MULTIPART_STREAM_H_
14 #define _SMING_CORE_DATA_STREAM_MULTIPART_STREAM_H_
15 
16 #include "MultiStream.h"
17 #include "Delegate.h"
18 #include "Network/Http/HttpHeaders.h"
19 
27 typedef struct {
28  HttpHeaders* headers = nullptr;
29  IDataSourceStream* stream = nullptr;
31 
33 
35 {
36 public:
37  MultipartStream(HttpPartProducerDelegate delegate) : producer(delegate)
38  {
39  }
40 
46  const char* getBoundary();
47 
48 protected:
49  IDataSourceStream* getNextStream() override
50  {
51  result = producer();
52  return result.stream;
53  }
54 
55  void onNextStream() override;
56  bool onCompleted() override;
57 
58 private:
59  HttpPartProducerDelegate producer;
60  HttpPartResult result;
61 
62  char boundary[16] = {0};
63 };
64 
66 #endif /* _SMING_CORE_DATA_STREAM_MULTIPART_STREAM_H_ */
Definition: MultiStream.h:19
Base class for data source stream.
Definition: DataSourceStream.h:39
Encapsulates a set of HTTP header information.
Definition: HttpHeaders.h:96
Definition: MultipartStream.h:34
Multipart stream class.
Definition: MultipartStream.h:27