|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
10 #ifndef MJPEGCARRIER_INC
11 #define MJPEGCARRIER_INC
81 this->envelope = envelope;
102 return "mjpeg_carrier";
107 const char *target =
"GET /?ac";
108 for (
size_t i=0; i<8 && i<header.
length(); i++) {
109 header.
get()[i] = target[i];
117 const char *target =
"GET /?ac";
118 for (
int i=0; i<8; i++) {
119 if (header.
get()[i] != target[i]) {
154 std::string target =
"HTTP/1.0 200 OK\r\n\
155 Connection: close\r\n\
156 Server: yarp/mjpeg_carrier/0.1\r\n\
157 Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0\r\n\
158 Pragma: no-cache\r\n\
159 Expires: Mon, 3 Jan 2000 12:34:56 GMT\r\n\
160 Content-Type: multipart/x-mixed-replace;boundary=boundarydonotcross\r\n\
162 --boundarydonotcross\r\n";
181 if (stream==NULL) {
return false; }
A base class for connection types (tcp, mcast, shmem, ...) which are called carriers in YARP.
void setParameters(const yarp::os::Bytes &header) override
Configure this carrier based on the first 8 bytes of the connection.
virtual TwoWayStream * giveStreams()=0
Take ownership of the streams associated with the connection.
virtual void write(char ch)
Write a single byte to the stream.
bool sendAck(yarp::os::ConnectionState &proto) override
Send an acknowledgement, if needed for this carrier.
A carrier for sending/receiving images via mjpeg over http.
bool sendHeader(yarp::os::ConnectionState &proto) override
Write a header appropriate to the carrier to the connection, followed by any carrier-specific data.
bool write(yarp::os::ConnectionState &proto, yarp::os::SizedWriter &writer) override
Write a message.
virtual bool sendIndex(yarp::os::ConnectionState &proto, yarp::os::SizedWriter &writer)
bool expectSenderSpecifier(yarp::os::ConnectionState &proto) override
Expect the name of the sending port.
bool expectIndex(yarp::os::ConnectionState &proto) override
Expect a message header, if there is one for this carrier.
bool canEscape() const override
Check if carrier can encode administrative messages, as opposed to just user data.
bool requireAck() const override
Check if carrier has flow control, requiring sent messages to be acknowledged by recipient.
void getHeader(yarp::os::Bytes &header) const override
Provide 8 bytes describing this connection sufficiently to allow the other side of a connection to se...
bool expectAck(yarp::os::ConnectionState &proto) override
Receive an acknowledgement, if expected for this carrier.
bool isActive() const override
Check if carrier is alive and error free.
bool isLocal() const override
Check if carrier operates within a single process.
bool isPush() const override
Check if carrier is "push" or "pull" style.
virtual void takeStreams(TwoWayStream *streams)=0
Provide streams to be used with the connection.
OutputStream & os()
Shorthand for getOutputStream()
const yarp::os::LogComponent & MJPEGCARRIER()
bool expectExtraHeader(yarp::os::ConnectionState &proto) override
Receive any carrier-specific header.
std::string getBootstrapCarrierName() const override
Get the name of the carrier that should be used prior to handshaking, if a port is registered with th...
bool isConnectionless() const override
Check if this carrier is connectionless (like udp, mcast) or connection based (like tcp).
bool canOffer() const override
Check if writing is implemented for this carrier.
bool respondToHeader(yarp::os::ConnectionState &proto) override
Respond to the header.
A simple abstraction for a block of bytes.
virtual bool autoCompression() const
bool prepareSend(yarp::os::ConnectionState &proto) override
Perform any initialization needed before writing on a connection.
bool reply(yarp::os::ConnectionState &proto, yarp::os::SizedWriter &writer) override
bool canAccept() const override
Check if reading is implemented for this carrier.
std::string getName() const override
Get the name of this connection type ("tcp", "mcast", "shmem", ...)
The basic state of a connection - route, streams in use, etc.
void handleEnvelope(const std::string &envelope) override
Carriers that do not distinguish data from administrative headers (i.e.
bool isTextMode() const override
Check if carrier is textual in nature.
std::string toString() const override
Get name of carrier.
InputStream & is()
Shorthand for getInputStream()
Carrier * create() const override
Factory method.
bool supportReply() const override
This flag is used by YARP to determine whether the connection can carry RPC traffic,...
bool expectReplyToHeader(yarp::os::ConnectionState &proto) override
Process reply to header, if one is expected for this carrier.
#define yCTrace(component,...)
bool checkHeader(const yarp::os::Bytes &header) override
Given the first 8 bytes received on a connection, decide if this is the right carrier type to use for...
Minimal requirements for an efficient Writer.