6#ifndef YARP_FRAMEGRABBER_PROTOCOL_FRAMEGRABBEROF_FORWARDER_INL_H
7#define YARP_FRAMEGRABBER_PROTOCOL_FRAMEGRABBEROF_FORWARDER_INL_H
13YARP_LOG_COMPONENT(FRAMEGRABBEROF_FORWARDER,
"yarp.proto.framegrabber.FrameGrabberOf_Forwarder")
37 if (m_port.getOutputCount() == 0) {
42 if (!m_port.write(cmd, response)) {
43 yCWarning(FRAMEGRABBEROF_FORWARDER,
"Could not execute RPC command");
52 yCWarning(FRAMEGRABBEROF_FORWARDER,
"Invalid reply received");
70 if (m_port.getOutputCount() == 0) {
75 if (!m_port.write(cmd, response)) {
76 yCWarning(FRAMEGRABBEROF_FORWARDER,
"Could not execute RPC command");
85 yCWarning(FRAMEGRABBEROF_FORWARDER,
"Invalid reply received");
105 if (m_port.getOutputCount() == 0) {
106 yCWarningThrottle(FRAMEGRABBEROF_FORWARDER, 5.0,
"Remote port is not connected");
110 if (!m_port.write(cmd, response)) {
111 yCWarning(FRAMEGRABBEROF_FORWARDER,
"Could not execute RPC command");
120 yCWarning(FRAMEGRABBEROF_FORWARDER,
"Invalid reply received");
124 auto& serializedImage = response.
get(3);
127 yCWarning(FRAMEGRABBEROF_FORWARDER,
"Image is not serialized properly");
151 for (
size_t i=0; i<vertices.size(); i++)
157 if (m_port.getOutputCount() == 0) {
158 yCWarningThrottle(FRAMEGRABBEROF_FORWARDER, 5.0,
"Remote port is not connected");
162 if (!m_port.write(cmd, response)) {
163 yCWarning(FRAMEGRABBEROF_FORWARDER,
"Could not execute RPC command");
172 yCWarning(FRAMEGRABBEROF_FORWARDER,
"Cropped image is not serialized properly");
176 auto& serializedImage = response.
get(3);
179 yCWarning(FRAMEGRABBEROF_FORWARDER,
"...");
constexpr yarp::conf::vocab32_t VOCAB_FRAMEGRABBER_IMAGE
constexpr yarp::conf::vocab32_t VOCAB_CROP
constexpr yarp::conf::vocab32_t VOCAB_IS
constexpr yarp::conf::vocab32_t VOCAB_WIDTH
constexpr yarp::conf::vocab32_t VOCAB_GET
constexpr yarp::conf::vocab32_t VOCAB_HEIGHT
yarp::sig::ImageOf< yarp::sig::PixelRgb > ImageType
A simple collection of objects that can be described and transmitted in a portable way.
void addVocab32(yarp::conf::vocab32_t x)
Places a vocabulary item in the bottle, at the end of the list.
Bottle & addList()
Places an empty nested list in the bottle, at the end of the list.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
void addInt32(std::int32_t x)
Places a 32-bit integer in the bottle, at the end of the list.
A mini-server for network communication.
static bool copyPortable(const PortWriter &writer, PortReader &reader)
Copy one portable to another, via writing and reading.
virtual yarp::conf::vocab32_t asVocab32() const
Get vocabulary identifier as an integer.
virtual std::int32_t asInt32() const
Get 32-bit integer value.
virtual bool isList() const
Checks if value is a list.
virtual bool isInt32() const
Checks if value is a 32-bit integer.
virtual bool isVocab32() const
Checks if value is a vocabulary identifier.
FrameGrabberOf_Forwarder(yarp::os::Port &port)
int height() const override
Return the height of each frame.
int width() const override
Return the width of each frame.
bool getImage(ImageType &image) override
Get an image from the frame grabber.
bool getImageCrop(cropType_id_t cropType, yarp::sig::VectorOf< std::pair< int, int > > vertices, ImageType &image) override
Get a crop of the image from the frame grabber.
void zero()
Set all pixels to 0.
#define yCWarning(component,...)
#define YARP_LOG_COMPONENT(name,...)
#define yCWarningThrottle(component, period,...)