41 yCError(SERVERFRAMEGRABBER,
"Did you just try to open the same ServerFrameGrabber twice?\n");
46 bool separatePorts =
false;
52 if (config.
check(
"subdevice",name,
"name (or nested configuration) of device to wrap")) {
56 p.setMonitor(config.getMonitor(),
66 if (!poly.isValid()) {
71 yCError(SERVERFRAMEGRABBER,
"\"--subdevice <name>\" not set for server_framegrabber\n");
89 poly.view(fgImageRaw);
99 ifgCtrl_Responder.configure(fgCtrl);
104 bool conf = rgbParser.configure(rgbVis_p);
108 yCWarning(SERVERFRAMEGRABBER) <<
"ServerFrameGrabber: error configuring interfaces for parsers";
112 canDrop = !config.
check(
"no_drop",
"if present, use strict policy for sending data");
113 addStamp = config.
check(
"stamp",
"if present, add timestamps to data");
118 "name of port to send data on").asString());
129 !config.
check(
"shared-ports",
130 "If present, send audio and images on same port")) {
131 separatePorts =
true;
132 yCAssert(SERVERFRAMEGRABBER, p2==
nullptr);
134 yCAssert(SERVERFRAMEGRABBER, p2!=
nullptr);
135 p2->open(config.
check(
"name2",
Value(
"/grabber2"),
136 "Name of second port to send data on, when audio and images sent separately").asString());
141 yCAssert(SERVERFRAMEGRABBER, p2!=
nullptr);
144 thread.attach(
new DataWriter<ImageRgbSound>(p,*
this,canDrop,
147 }
else if (fgImage!=
nullptr) {
149 }
else if (fgImageRaw!=
nullptr) {
152 yCError(SERVERFRAMEGRABBER,
"subdevice <%s> doesn't look like a framegrabber\n",
158 config.
check(
"single_threaded",
159 "if present, operate in single threaded mode")!=0;
160 thread.open(config.
check(
"framerate",
Value(
"0"),
161 "maximum rate in Hz to read from subdevice").asFloat64(),
166 DeviceResponder::makeUsage();
167 addUsage(
"[set] [bri] $fBrightness",
"set brightness");
168 addUsage(
"[set] [expo] $fExposure",
"set exposure");
169 addUsage(
"[set] [shar] $fSharpness",
"set sharpness");
170 addUsage(
"[set] [whit] $fBlue $fRed",
"set white balance");
171 addUsage(
"[set] [hue] $fHue",
"set hue");
172 addUsage(
"[set] [satu] $fSaturation",
"set saturation");
173 addUsage(
"[set] [gamm] $fGamma",
"set gamma");
174 addUsage(
"[set] [shut] $fShutter",
"set shutter");
175 addUsage(
"[set] [gain] $fGain",
"set gain");
176 addUsage(
"[set] [iris] $fIris",
"set iris");
178 addUsage(
"[get] [bri]",
"get brightness");
179 addUsage(
"[get] [expo]",
"get exposure");
180 addUsage(
"[get] [shar]",
"get sharpness");
181 addUsage(
"[get] [whit]",
"get white balance");
182 addUsage(
"[get] [hue]",
"get hue");
183 addUsage(
"[get] [satu]",
"get saturation");
184 addUsage(
"[get] [gamm]",
"get gamma");
185 addUsage(
"[get] [shut]",
"get shutter");
186 addUsage(
"[get] [gain]",
"get gain");
187 addUsage(
"[get] [iris]",
"get iris");
189 addUsage(
"[get] [w]",
"get width of image");
190 addUsage(
"[get] [h]",
"get height of image");
207 return ifgCtrl_Responder.respond(cmd, response);
211 return rgbParser.respond(cmd,response);
224 response.
addInt32(
int(fgCtrlDC1394->getVideoModeMaskDC1394()));
227 response.
addInt32(
int(fgCtrlDC1394->getVideoModeDC1394()));
233 response.
addInt32(
int(fgCtrlDC1394->getFPSMaskDC1394()));
236 response.
addInt32(
int(fgCtrlDC1394->getFPSDC1394()));
243 response.
addInt32(
int(fgCtrlDC1394->getISOSpeedDC1394()));
253 response.
addInt32(
int(fgCtrlDC1394->getColorCodingDC1394()));
260 unsigned int xstep,ystep,xdim,ydim,xoffstep,yoffstep;
261 fgCtrlDC1394->getFormat7MaxWindowDC1394(xdim,ydim,xstep,ystep,xoffstep,yoffstep);
272 unsigned int xdim,ydim;
274 fgCtrlDC1394->getFormat7WindowDC1394(xdim,ydim,x0,y0);
285 response.
addInt32(
int(fgCtrlDC1394->setOperationModeDC1394(cmd.
get(1).
asInt32()!=0)));
288 response.
addInt32(fgCtrlDC1394->getOperationModeDC1394());
295 response.
addInt32(fgCtrlDC1394->getTransmissionDC1394());
309 response.
addInt32(
int(fgCtrlDC1394->setDefaultsDC1394()));
312 response.
addInt32(
int(fgCtrlDC1394->setResetDC1394()));
324 response.
addInt32(fgCtrlDC1394->getBytesPerPacketDC1394());
327 return DeviceResponder::respond(cmd,response);
332 yCError(SERVERFRAMEGRABBER) <<
"ServerFrameGrabber: command not recognized" << cmd.
toString();
333 return DeviceResponder::respond(cmd,response);
426 return getImage(image);
431 return getImage(image);
436 return getDatum(imageSound.
head,imageSound.
body);
442 return getAudioVisual(image,sound);
447 if (fgImage==
nullptr) {
return false; }
448 return fgImage->getImage(image);
453 if (fgImageRaw==
nullptr) {
return false; }
454 return fgImageRaw->getImage(image);
460 if (fgAv==
nullptr) {
return false; }
461 return fgAv->getAudioVisual(image,sound);
466 if (fgImage) {
return fgImage->height(); }
467 if (fgImageRaw) {
return fgImageRaw->height(); }
473 if (fgImage) {
return fgImage->width(); }
474 if (fgImageRaw) {
return fgImageRaw->width(); }
485 if (singleThreaded) {
494 if (singleThreaded) {
constexpr yarp::conf::vocab32_t VOCAB_DRGETISO
constexpr yarp::conf::vocab32_t VOCAB_DRSETFPS
constexpr yarp::conf::vocab32_t VOCAB_DRSETDEF
constexpr yarp::conf::vocab32_t VOCAB_DRSETVMD
constexpr yarp::conf::vocab32_t VOCAB_RGB_VISUAL_PARAMS
constexpr yarp::conf::vocab32_t VOCAB_FRAMEGRABBER_CONTROL_DC1394
constexpr yarp::conf::vocab32_t VOCAB_DRSETWF7
constexpr yarp::conf::vocab32_t VOCAB_DRGETF7M
constexpr yarp::conf::vocab32_t VOCAB_DRSETBCS
constexpr yarp::conf::vocab32_t VOCAB_DRSETCAP
constexpr yarp::conf::vocab32_t VOCAB_DRSETCOD
constexpr yarp::conf::vocab32_t VOCAB_DRGETMSK
constexpr yarp::conf::vocab32_t VOCAB_DRGETFPS
constexpr yarp::conf::vocab32_t VOCAB_DRSETOPM
constexpr yarp::conf::vocab32_t VOCAB_DRGETBPP
constexpr yarp::conf::vocab32_t VOCAB_DRSETPWR
constexpr yarp::conf::vocab32_t VOCAB_DRGETCCM
constexpr yarp::conf::vocab32_t VOCAB_DRGETTXM
constexpr yarp::conf::vocab32_t VOCAB_DRSETRST
constexpr yarp::conf::vocab32_t VOCAB_DRSETBPP
constexpr yarp::conf::vocab32_t VOCAB_DRGETWF7
constexpr yarp::conf::vocab32_t VOCAB_DRGETVMD
constexpr yarp::conf::vocab32_t VOCAB_DRGETFPM
constexpr yarp::conf::vocab32_t VOCAB_DRSETTXM
constexpr yarp::conf::vocab32_t VOCAB_FRAMEGRABBER_CONTROL
constexpr yarp::conf::vocab32_t VOCAB_DRGETCOD
constexpr yarp::conf::vocab32_t VOCAB_DRSETISO
constexpr yarp::conf::vocab32_t VOCAB_DRGETOPM
bool close() override
Close the DeviceDriver.
virtual bool respond(const yarp::os::Bottle &command, yarp::os::Bottle &reply) override
Respond to a message.
int width() const override
Return the width of each frame.
bool getDatum(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override
bool stopService() override
Shut down the service, whatever it is.
bool startService() override
Initiate the service, whatever it is.
bool getImage(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override
bool open(yarp::os::Searchable &config) override
Configure with a set of options.
int height() const override
Return the height of each frame.
virtual bool getAudioVisual(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image, yarp::sig::Sound &sound) override
Get an image and sound.
bool updateService() override
Give the service the chance to run for a while.
virtual bool hasAudio()=0
virtual bool hasRawVideo()
virtual bool hasVideo()=0
A simple collection of objects that can be described and transmitted in a portable way.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
Bottle tail() const
Get all but the first element of a bottle.
void addInt32(std::int32_t x)
Places a 32-bit integer in the bottle, at the end of the list.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
A mini-server for network communication.
Group a pair of objects to be sent and received together.
BODY body
An object of the second type (BODY).
HEAD head
An object of the first type (HEAD).
A class for storing options and configuration information.
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
void unput(const std::string &key)
Remove the association from the given key to a value, if present.
A base class for nested structures that can be searched.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
virtual Bottle & findGroup(const std::string &key) const =0
Gets a list corresponding to a given keyword.
static Type byName(const char *name)
A single value (typically within a Bottle).
virtual bool isString() const
Checks if value is a string.
virtual yarp::conf::vocab32_t asVocab32() const
Get vocabulary identifier as an integer.
virtual std::int32_t asInt32() const
Get 32-bit integer value.
std::string toString() const override
Return a standard text representation of the content of the object.
Class for storing sounds See Audio in YARP for additional documentation on YARP audio.
#define yCError(component,...)
#define yCAssert(component, x)
#define yCWarning(component,...)
#define YARP_LOG_COMPONENT(name,...)
An interface for the device drivers.
An interface to the operating system, including Port based communication.
#define YARP_WARNING_POP
Ends a temporary alteration of the enabled warnings.
#define YARP_WARNING_PUSH
Starts a temporary alteration of the enabled warnings.
#define YARP_DISABLE_DEPRECATED_WARNING
Disable deprecated warnings in the following code.