YARP
Yet Another Robot Platform
ServerFrameGrabber.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_DEV_SERVERFRAMEGRABBER_H
11 #define YARP_DEV_SERVERFRAMEGRABBER_H
12 
13 #include <cstdio>
14 
20 #include <yarp/dev/PolyDriver.h>
21 #include <yarp/os/BufferedPort.h>
22 #include <yarp/os/Time.h>
23 #include <yarp/os/Network.h>
24 #include <yarp/os/Vocab.h>
25 #include <yarp/os/Bottle.h>
27 
28 #define YARP_INCLUDING_DEPRECATED_HEADER_ON_PURPOSE
29 #include <yarp/os/RateThread.h>
30 #include <yarp/dev/DataSource.h>
31 #undef YARP_INCLUDING_DEPRECATED_HEADER_ON_PURPOSE
32 
35 
84  public yarp::dev::IService,
85  public yarp::dev::DataSource<yarp::sig::ImageOf<yarp::sig::PixelRgb>>,
86  public yarp::dev::DataSource<yarp::sig::ImageOf<yarp::sig::PixelMono>>,
87  public yarp::dev::DataSource<yarp::dev::ImageRgbSound>,
88  public yarp::dev::DataSource2<yarp::sig::ImageOf<yarp::sig::PixelRgb>,yarp::sig::Sound>
89 {
90 private:
92  yarp::dev::IRgbVisualParams* rgbVis_p{nullptr};
94  yarp::os::Port *p2{nullptr};
100  yarp::dev::IFrameGrabberImage *fgImage{nullptr};
101  yarp::dev::IFrameGrabberImageRaw *fgImageRaw{nullptr};
102  yarp::dev::IAudioGrabberSound *fgSound{nullptr};
103  yarp::dev::IAudioVisualGrabber *fgAv{nullptr};
104  yarp::dev::IFrameGrabberControls *fgCtrl{nullptr};
105  yarp::dev::IPreciselyTimed *fgTimed{nullptr};
106  bool spoke{false}; // location of this variable tickles bug on Solaris/gcc3.2
107  bool canDrop{false};
108  bool addStamp{false};
109  bool active{false};
110  bool singleThreaded{false};
111 
113 
114 public:
115  ServerFrameGrabber() = default;
120  ~ServerFrameGrabber() override = default;
121 
122  bool close() override;
133  bool open(yarp::os::Searchable& config) override;
134 
135  //bool read(ConnectionReader& connection) override;
136 
137  virtual bool respond(const yarp::os::Bottle& command,
138  yarp::os::Bottle& reply) override;
139 
141 
143 
144  bool getDatum(yarp::dev::ImageRgbSound& imageSound) override;
145 
147  yarp::sig::Sound& sound) override;
148 
150 
152 
154  yarp::sig::Sound& sound) override;
155 
156  int height() const override;
157 
158  int width() const override;
159 
160  bool startService() override;
161 
162  bool stopService() override;
163 
164  bool updateService() override;
165 };
166 
168 
169 #endif // YARP_DEV_SERVERFRAMEGRABBER_H
YARP_WARNING_PUSH
#define YARP_WARNING_PUSH
Starts a temporary alteration of the enabled warnings.
Definition: system.h:334
yarp::os::Bottle
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:73
yarp::dev::IFrameGrabberImageRaw
Read a YARP-format image from a device.
Definition: FrameGrabberInterfaces.h:293
ServiceInterfaces.h
Network.h
yarp::os::Searchable
A base class for nested structures that can be searched.
Definition: Searchable.h:69
yarp::os::PortablePair
Group a pair of objects to be sent and received together.
Definition: PortablePair.h:51
ServerFrameGrabber::close
bool close() override
Close the DeviceDriver.
Definition: ServerFrameGrabber.cpp:26
AudioGrabberInterfaces.h
ServerFrameGrabber::getAudioVisual
virtual bool getAudioVisual(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image, yarp::sig::Sound &sound) override
Get an image and sound.
Definition: ServerFrameGrabber.cpp:458
ServerFrameGrabber::respond
virtual bool respond(const yarp::os::Bottle &command, yarp::os::Bottle &reply) override
Respond to a message.
Definition: ServerFrameGrabber.cpp:196
FrameGrabberControlImpl.h
DataSource.h
ServerFrameGrabber::~ServerFrameGrabber
~ServerFrameGrabber() override=default
RateThread.h
yarp::sig::ImageOf< yarp::sig::PixelRgb >
yarp::os::Port
A mini-server for network communication.
Definition: Port.h:50
yarp::os::RateThreadWrapper
This class takes a Runnable instance and wraps a thread around it.
Definition: RateThread.h:244
yarp::dev::IAudioGrabberSound
Read a YARP-format sound block from a device.
Definition: IAudioGrabberSound.h:26
ServerFrameGrabber::ServerFrameGrabber
ServerFrameGrabber(const ServerFrameGrabber &)=delete
AudioVisualInterfaces.h
IVisualParamsImpl.h
yarp::dev::IFrameGrabberImage
Read a YARP-format image from a device.
Definition: FrameGrabberInterfaces.h:241
PolyDriver.h
ServerFrameGrabber::getImage
bool getImage(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override
Get an rgb image from the frame grabber, if required demosaicking/color reconstruction is applied.
Definition: ServerFrameGrabber.cpp:446
yarp::dev::IAudioVisualGrabber
Read a YARP-format image and sound from a device.
Definition: IAudioVisualGrabber.h:27
yarp::dev::PolyDriver
A container for a device driver.
Definition: PolyDriver.h:27
ServerFrameGrabber::height
int height() const override
Return the height of each frame.
Definition: ServerFrameGrabber.cpp:465
yarp::dev::IService
Common interface for devices that act like services (by which we mean they do something for remote us...
Definition: ServiceInterfaces.h:28
ServerFrameGrabber::updateService
bool updateService() override
Give the service the chance to run for a while.
Definition: ServerFrameGrabber.cpp:493
ServerFrameGrabber::operator=
ServerFrameGrabber & operator=(const ServerFrameGrabber &)=delete
ServerFrameGrabber::startService
bool startService() override
Initiate the service, whatever it is.
Definition: ServerFrameGrabber.cpp:484
ServerFrameGrabber::ServerFrameGrabber
ServerFrameGrabber()=default
ServerFrameGrabber::getDatum
bool getDatum(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override
Definition: ServerFrameGrabber.cpp:425
yarp::dev::IFrameGrabberControls
Control interface for frame grabber devices.
Definition: FrameGrabberInterfaces.h:365
BufferedPort.h
FrameGrabberInterfaces.h
define common interfaces to discover remote camera capabilities
yarp::dev::Implement_RgbVisualParams_Parser
Definition: IVisualParamsImpl.h:54
YARP_WARNING_POP
#define YARP_WARNING_POP
Ends a temporary alteration of the enabled warnings.
Definition: system.h:335
ServerFrameGrabber::operator=
ServerFrameGrabber & operator=(ServerFrameGrabber &&)=delete
yarp::dev::DeviceResponder
A cheap and cheerful framework for human readable/writable forms of messages to devices.
Definition: DeviceDriver.h:134
yarp::dev::IRgbVisualParams
An interface for retrieving intrinsic parameter from a rgb camera.
Definition: IVisualParams.h:73
yarp::dev::DeprecatedDeviceDriver
Interface implemented by deprecated device drivers.
Definition: DeviceDriver.h:119
ServerFrameGrabber::stopService
bool stopService() override
Shut down the service, whatever it is.
Definition: ServerFrameGrabber.cpp:479
yarp::sig::Sound
Class for storing sounds.
Definition: Sound.h:28
ServerFrameGrabber
grabber: Export a frame grabber to the network.
Definition: ServerFrameGrabber.h:89
Vocab.h
ServerFrameGrabber::ServerFrameGrabber
ServerFrameGrabber(ServerFrameGrabber &&)=delete
Time.h
yarp::dev::FrameGrabberControls_Parser
Definition: FrameGrabberControlImpl.h:59
YARP_DISABLE_DEPRECATED_WARNING
#define YARP_DISABLE_DEPRECATED_WARNING
Disable deprecated warnings in the following code.
Definition: system.h:336
yarp::dev::IPreciselyTimed
Definition: IPreciselyTimed.h:21
ServerFrameGrabber::open
bool open(yarp::os::Searchable &config) override
Configure with a set of options.
Definition: ServerFrameGrabber.cpp:40
Bottle.h
ServerFrameGrabber::width
int width() const override
Return the width of each frame.
Definition: ServerFrameGrabber.cpp:472