6 #ifndef YARP_FRAMEGRABBER_PROTOCOL_FRAMEGRABBEROF_FORWARDER_INL_H
7 #define YARP_FRAMEGRABBER_PROTOCOL_FRAMEGRABBEROF_FORWARDER_INL_H
13 YARP_LOG_COMPONENT(FRAMEGRABBEROF_FORWARDER,
"yarp.proto.framegrabber.FrameGrabberOf_Forwarder")
18 namespace framegrabber {
20 template <
typename ImageType,
28 template <
typename ImageType,
39 if (m_port.getOutputCount() == 0) {
44 if (!m_port.write(cmd, response)) {
45 yCWarning(FRAMEGRABBEROF_FORWARDER,
"Could not execute RPC command");
54 yCWarning(FRAMEGRABBEROF_FORWARDER,
"Invalid reply received");
61 template <
typename ImageType,
72 if (m_port.getOutputCount() == 0) {
77 if (!m_port.write(cmd, response)) {
78 yCWarning(FRAMEGRABBEROF_FORWARDER,
"Could not execute RPC command");
87 yCWarning(FRAMEGRABBEROF_FORWARDER,
"Invalid reply received");
94 template <
typename ImageType,
107 if (m_port.getOutputCount() == 0) {
108 yCWarningThrottle(FRAMEGRABBEROF_FORWARDER, 5.0,
"Remote port is not connected");
112 if (!m_port.write(cmd, response)) {
113 yCWarning(FRAMEGRABBEROF_FORWARDER,
"Could not execute RPC command");
122 yCWarning(FRAMEGRABBEROF_FORWARDER,
"Invalid reply received");
126 auto& serializedImage = response.
get(3);
129 yCWarning(FRAMEGRABBEROF_FORWARDER,
"Image is not serialized properly");
137 template <
typename ImageType,
153 for (
size_t i=0; i<vertices.size(); i++)
159 if (m_port.getOutputCount() == 0) {
160 yCWarningThrottle(FRAMEGRABBEROF_FORWARDER, 5.0,
"Remote port is not connected");
164 if (!m_port.write(cmd, response)) {
165 yCWarning(FRAMEGRABBEROF_FORWARDER,
"Could not execute RPC command");
174 yCWarning(FRAMEGRABBEROF_FORWARDER,
"Cropped image is not serialized properly");
178 auto& serializedImage = response.
get(3);
181 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
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.
#define yCWarning(component,...)
#define YARP_LOG_COMPONENT(name,...)
#define yCWarningThrottle(component, period,...)
The main, catch-all namespace for YARP.