Arduino DLNA Server
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tiny_dlna::HttpStreamedMultiOutput Class Reference

Generic HttpStreamedMultiOutput Class which handles multicast streaming. We can optionally define some default (e.g. html) content that will be written at the beginning and at the end of the streaming session to the client. More...

#include <HttpStreamedMultiOutput.h>

Inheritance diagram for tiny_dlna::HttpStreamedMultiOutput:
Inheritance graph
[legend]
Collaboration diagram for tiny_dlna::HttpStreamedMultiOutput:
Collaboration graph
[legend]

Public Member Functions

 HttpStreamedMultiOutput (const char *mime, const char *startHtml=nullptr, const char *endHtml=nullptr, int maxHistoryLength=0)
 
virtual const char * mime ()
 
virtual bool isValid (WiFiClient &client)
 
virtual void open (WiFiClient &client)
 
virtual bool isOpen ()
 
virtual void close ()
 
virtual int availableForWrite ()
 Do not accept any writes if we are not connected. More...
 
virtual size_t write (uint8_t *content, int len)
 
virtual size_t print (const char *str)
 
virtual size_t println (const char *str)
 
virtual void doLoop ()
 

Protected Member Functions

void cleanup ()
 
void onClose (WiFiClient &client)
 content that is written when the request is opened More...
 
void addHistory (const char *line, bool delimiter, int len)
 adds the line to the history - removest oldest lines More...
 

Protected Attributes

HttpChunkWriter writer
 
List< WiFiClient > clients
 
Strhistory = nullptr
 
int max_history_length
 
const char * start = nullptr
 
const char * end = nullptr
 
const char * mime_type = nullptr
 
int id_value = 0
 

Detailed Description

Generic HttpStreamedMultiOutput Class which handles multicast streaming. We can optionally define some default (e.g. html) content that will be written at the beginning and at the end of the streaming session to the client.

The output (write, print ...) functions are sending the same output to all open clients.

The id is used to identify the output stream so that we can potentially send different content to different clients.

We automatically manage all the clients which are open and clean up the closed clients to release the memory.

Constructor & Destructor Documentation

◆ HttpStreamedMultiOutput()

tiny_dlna::HttpStreamedMultiOutput::HttpStreamedMultiOutput ( const char *  mime,
const char *  startHtml = nullptr,
const char *  endHtml = nullptr,
int  maxHistoryLength = 0 
)
inline

Member Function Documentation

◆ addHistory()

void tiny_dlna::HttpStreamedMultiOutput::addHistory ( const char *  line,
bool  delimiter,
int  len 
)
inlineprotected

adds the line to the history - removest oldest lines

◆ availableForWrite()

virtual int tiny_dlna::HttpStreamedMultiOutput::availableForWrite ( )
inlinevirtual

Do not accept any writes if we are not connected.

◆ cleanup()

void tiny_dlna::HttpStreamedMultiOutput::cleanup ( )
inlineprotectedvirtual

◆ close()

virtual void tiny_dlna::HttpStreamedMultiOutput::close ( )
inlinevirtual

◆ doLoop()

virtual void tiny_dlna::HttpStreamedMultiOutput::doLoop ( )
inlinevirtual

◆ isOpen()

virtual bool tiny_dlna::HttpStreamedMultiOutput::isOpen ( )
inlinevirtual

◆ isValid()

virtual bool tiny_dlna::HttpStreamedMultiOutput::isValid ( WiFiClient &  client)
inlinevirtual

◆ mime()

virtual const char* tiny_dlna::HttpStreamedMultiOutput::mime ( )
inlinevirtual

◆ onClose()

void tiny_dlna::HttpStreamedMultiOutput::onClose ( WiFiClient &  client)
inlineprotected

content that is written when the request is opened

◆ open()

virtual void tiny_dlna::HttpStreamedMultiOutput::open ( WiFiClient &  client)
inlinevirtual

◆ print()

virtual size_t tiny_dlna::HttpStreamedMultiOutput::print ( const char *  str)
inlinevirtual

◆ println()

virtual size_t tiny_dlna::HttpStreamedMultiOutput::println ( const char *  str)
inlinevirtual

◆ write()

virtual size_t tiny_dlna::HttpStreamedMultiOutput::write ( uint8_t *  content,
int  len 
)
inlinevirtual

Member Data Documentation

◆ clients

List<WiFiClient> tiny_dlna::HttpStreamedMultiOutput::clients
protected

◆ end

const char* tiny_dlna::HttpStreamedMultiOutput::end = nullptr
protected

◆ history

Str* tiny_dlna::HttpStreamedMultiOutput::history = nullptr
protected

◆ id_value

int tiny_dlna::HttpStreamedMultiOutput::id_value = 0
protected

◆ max_history_length

int tiny_dlna::HttpStreamedMultiOutput::max_history_length
protected

◆ mime_type

const char* tiny_dlna::HttpStreamedMultiOutput::mime_type = nullptr
protected

◆ start

const char* tiny_dlna::HttpStreamedMultiOutput::start = nullptr
protected

◆ writer

HttpChunkWriter tiny_dlna::HttpStreamedMultiOutput::writer
protected

The documentation for this class was generated from the following file: