Arduino DLNA Server
HttpChunkWriter.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "Client.h"
4 #include "basic/Logger.h"
5 
6 namespace tiny_dlna {
7 
13  public:
14  int writeChunk(Client& client, const char* str, int len,
15  const char* str1 = nullptr, int len1 = 0) {
16  DlnaLogger.log(DlnaDebug, "HttpChunkWriter", "writeChunk");
17  client.println(len + len1, HEX);
18  int result = client.write((uint8_t*)str, len);
19  if (str1 != nullptr) {
20  result += client.write((uint8_t*)str1, len1);
21  }
22  client.println();
23  return result;
24  }
25 
26  int writeChunk(Client& client, const char* str) {
27  int len = strlen(str);
28  return writeChunk(client, str, len);
29  }
30 
31  void writeEnd(Client& client) { writeChunk(client, "", 0); }
32 };
33 
34 } // namespace tiny_dlna
Writes the data chunked to the actual client.
Definition: HttpChunkWriter.h:12
int writeChunk(Client &client, const char *str, int len, const char *str1=nullptr, int len1=0)
Definition: HttpChunkWriter.h:14
int writeChunk(Client &client, const char *str)
Definition: HttpChunkWriter.h:26
void writeEnd(Client &client)
Definition: HttpChunkWriter.h:31
void log(DlnaLogLevel current_level, const char *fmt...)
Print log message.
Definition: Logger.h:40
Definition: Allocator.h:6
@ DlnaDebug
Definition: Logger.h:16
LoggerClass DlnaLogger
Definition: Logger.cpp:5