Fawkes API  Fawkes Development Version
fawkes::DynamicMJPEGStreamWebReply Class Reference

#include <>>

Inheritance diagram for fawkes::DynamicMJPEGStreamWebReply:

Public Member Functions

 DynamicMJPEGStreamWebReply (std::shared_ptr< WebviewJpegStreamProducer > stream_producer)
 Constructor. More...
 
 DynamicMJPEGStreamWebReply (const DynamicMJPEGStreamWebReply &other)
 Copy Constructor. More...
 
virtual ~DynamicMJPEGStreamWebReply ()
 Destructor. More...
 
DynamicMJPEGStreamWebReplyoperator= (const DynamicMJPEGStreamWebReply &other)
 Assignment operator. More...
 
virtual size_t size ()
 
virtual size_t next_chunk (size_t pos, char *buffer, size_t buf_max_size)
 
virtual void handle_buffer (std::shared_ptr< WebviewJpegStreamProducer::Buffer > buffer)
 
- Public Member Functions inherited from fawkes::DynamicWebReply
 DynamicWebReply (Code code)
 Constructor. More...
 
virtual size_t chunk_size ()
 Chunksize. More...
 
- Public Member Functions inherited from fawkes::WebReply
 WebReply (Code code)
 Constructor. More...
 
virtual ~WebReply ()
 Destructor. More...
 
Code code () const
 Get response code. More...
 
void set_code (Code code)
 Set response code. More...
 
void add_header (const std::string &header, const std::string &content)
 Add a HTTP header. More...
 
void add_header (const std::string &header_string)
 Add a HTTP header. More...
 
const HeaderMapheaders () const
 get headers. More...
 
void set_caching (bool caching)
 Enable or disable caching for this specific reply. More...
 
void set_request (WebRequest *request)
 Set associated request. More...
 
WebRequestget_request () const
 Get associated request. More...
 
void pack_caching ()
 Called just before the reply is sent. More...
 
- Public Member Functions inherited from fawkes::WebviewJpegStreamProducer::Subscriber
virtual ~Subscriber ()
 Destructor. More...
 

Additional Inherited Members

- Public Types inherited from fawkes::WebReply
enum  Code {
  HTTP_CONTINUE = 100, HTTP_SWITCHING_PROTOCOLS = 101, HTTP_PROCESSING = 102, HTTP_OK = 200,
  HTTP_CREATED = 201, HTTP_ACCEPTED = 202, HTTP_NON_AUTHORITATIVE_INFORMATION = 203, HTTP_NO_CONTENT = 204,
  HTTP_RESET_CONTENT = 205, HTTP_PARTIAL_CONTENT = 206, HTTP_MULTI_STATUS = 207, HTTP_MULTIPLE_CHOICES = 300,
  HTTP_MOVED_PERMANENTLY = 301, HTTP_FOUND = 302, HTTP_SEE_OTHER = 303, HTTP_NOT_MODIFIED = 304,
  HTTP_USE_PROXY = 305, HTTP_SWITCH_PROXY = 306, HTTP_TEMPORARY_REDIRECT = 307, HTTP_BAD_REQUEST = 400,
  HTTP_UNAUTHORIZED = 401, HTTP_PAYMENT_REQUIRED = 402, HTTP_FORBIDDEN = 403, HTTP_NOT_FOUND = 404,
  HTTP_METHOD_NOT_ALLOWED = 405, HTTP_METHOD_NOT_ACCEPTABLE = 406, HTTP_PROXY_AUTHENTICATION_REQUIRED = 407, HTTP_REQUEST_TIMEOUT = 408,
  HTTP_CONFLICT = 409, HTTP_GONE = 410, HTTP_LENGTH_REQUIRED = 411, HTTP_PRECONDITION_FAILED = 412,
  HTTP_REQUEST_ENTITY_TOO_LARGE = 413, HTTP_REQUEST_URI_TOO_LONG = 414, HTTP_UNSUPPORTED_MEDIA_TYPE = 415, HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416,
  HTTP_EXPECTATION_FAILED = 417, HTTP_UNPROCESSABLE_ENTITY = 422, HTTP_LOCKED = 423, HTTP_FAILED_DEPENDENCY = 424,
  HTTP_UNORDERED_COLLECTION = 425, HTTP_UPGRADE_REQUIRED = 426, HTTP_RETRY_WITH = 449, HTTP_INTERNAL_SERVER_ERROR = 500,
  HTTP_NOT_IMPLEMENTED = 501, HTTP_BAD_GATEWAY = 502, HTTP_SERVICE_UNAVAILABLE = 503, HTTP_GATEWAY_TIMEOUT = 504,
  HTTP_HTTP_VERSION_NOT_SUPPORTED = 505, HTTP_VARIANT_ALSO_NEGOTIATES = 506, HTTP_INSUFFICIENT_STORAGE = 507, HTTP_BANDWIDTH_LIMIT_EXCEEDED = 509,
  HTTP_NOT_EXTENDED = 510
}
 HTTP response code. More...
 
typedef std::map< std::string, std::string > HeaderMap
 Map of headers. More...
 
- Static Public Member Functions inherited from fawkes::WebReply
static void set_caching_default (bool caching)
 Enable or disable caching default for replies. More...
 

Detailed Description

Dynamic raw file transfer reply. This dynamic file transfer reply transmits the given file with a mime type determined with libmagic.

Author
Tim Niemueller

Definition at line 39 of file mjpeg_reply.h.

Constructor & Destructor Documentation

◆ DynamicMJPEGStreamWebReply() [1/2]

fawkes::DynamicMJPEGStreamWebReply::DynamicMJPEGStreamWebReply ( std::shared_ptr< WebviewJpegStreamProducer stream_producer)

Constructor.

Parameters
stream_producerstream producer to query for JPEG buffers

Definition at line 47 of file mjpeg_reply.cpp.

References fawkes::WebReply::add_header().

◆ DynamicMJPEGStreamWebReply() [2/2]

fawkes::DynamicMJPEGStreamWebReply::DynamicMJPEGStreamWebReply ( const DynamicMJPEGStreamWebReply other)

Copy Constructor.

Parameters
otherinstance to copy from

Definition at line 63 of file mjpeg_reply.cpp.

References fawkes::WebReply::add_header().

◆ ~DynamicMJPEGStreamWebReply()

fawkes::DynamicMJPEGStreamWebReply::~DynamicMJPEGStreamWebReply ( )
virtual

Destructor.

Definition at line 76 of file mjpeg_reply.cpp.

Member Function Documentation

◆ handle_buffer()

void fawkes::DynamicMJPEGStreamWebReply::handle_buffer ( std::shared_ptr< WebviewJpegStreamProducer::Buffer buffer)
virtual

Notification if a new buffer is available.

Parameters
buffernew buffer

Implements fawkes::WebviewJpegStreamProducer::Subscriber.

Definition at line 107 of file mjpeg_reply.cpp.

References fawkes::Mutex::lock(), fawkes::Mutex::unlock(), and fawkes::WaitCondition::wake_all().

◆ next_chunk()

size_t fawkes::DynamicMJPEGStreamWebReply::next_chunk ( size_t  pos,
char *  buffer,
size_t  buf_max_size 
)
virtual

Get data of next chunk.

Parameters
posposition in the stream. Note that a certain position may be called several times.
bufferbuffer to store data in
buf_max_sizemaximum size in bytes of data that can be put into buffer
Returns
number of bytes written to buffer, or -1 to immediately stop the transfer.

Implements fawkes::DynamicWebReply.

Definition at line 116 of file mjpeg_reply.cpp.

References fawkes::Mutex::lock(), fawkes::Mutex::unlock(), and fawkes::WaitCondition::wait().

◆ operator=()

DynamicMJPEGStreamWebReply & fawkes::DynamicMJPEGStreamWebReply::operator= ( const DynamicMJPEGStreamWebReply other)

Assignment operator.

Parameters
otherinstance to copy from
Returns
reference to this instance

Definition at line 88 of file mjpeg_reply.cpp.

References fawkes::WebReply::add_header().

◆ size()

size_t fawkes::DynamicMJPEGStreamWebReply::size ( )
virtual

Total size of the web reply. Return the total size of the reply if known, or -1 if it is not known. In the latter case your next_chunk() method has to return -1 at some point to end the transfer. If possible by any means return a meaningful value, as it will improve the experience of users, especially for long transfers!

Returns
total size of reply in bytes

Implements fawkes::DynamicWebReply.

Definition at line 101 of file mjpeg_reply.cpp.


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