YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FrameGrabberControlsDC1394_Forwarder.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
8#include "CameraVocabs.h"
9
10#include <yarp/os/Bottle.h>
11
13
18
19
20bool FrameGrabberControlsDC1394_Forwarder::setCommand(int code, double v)
21{
23 yarp::os::Bottle response;
26 cmd.addVocab32(code);
27 cmd.addFloat64(v);
28 m_port.write(cmd, response);
29 return true;
30}
31
32
33bool FrameGrabberControlsDC1394_Forwarder::setCommand(int code, double b, double r)
34{
36 yarp::os::Bottle response;
39 cmd.addVocab32(code);
40 cmd.addFloat64(b);
41 cmd.addFloat64(r);
42 m_port.write(cmd, response);
43 return true;
44}
45
46
47double FrameGrabberControlsDC1394_Forwarder::getCommand(int code) const
48{
50 yarp::os::Bottle response;
53 cmd.addVocab32(code);
54 m_port.write(cmd, response);
55 // response should be [cmd] [name] value
56 return response.get(2).asFloat64();
57}
58
59
60bool FrameGrabberControlsDC1394_Forwarder::getCommand(int code, double& b, double& r) const
61{
63 yarp::os::Bottle response;
66 cmd.addVocab32(code);
67 m_port.write(cmd, response);
68 // response should be [cmd] [name] value
69 b = response.get(2).asFloat64();
70 r = response.get(3).asFloat64();
71 return true;
72}
73
74
76{
78 yarp::os::Bottle response;
81 m_port.write(cmd, response);
82 return static_cast<unsigned int>(response.get(0).asInt32());
83}
84
85
87{
89 yarp::os::Bottle response;
92 m_port.write(cmd, response);
93 return static_cast<unsigned int>(response.get(0).asInt32());
94}
95
96
98{
100 yarp::os::Bottle response;
103 cmd.addInt32(video_mode);
104 m_port.write(cmd, response);
105 return response.get(0).asBool();
106}
107
108
110{
112 yarp::os::Bottle response;
115 m_port.write(cmd, response);
116 return static_cast<unsigned int>(response.get(0).asInt32());
117}
118
119
121{
123 yarp::os::Bottle response;
126 m_port.write(cmd, response);
127 return static_cast<unsigned int>(response.get(0).asInt32());
128}
129
130
132{
134 yarp::os::Bottle response;
137 cmd.addInt32(fps);
138 m_port.write(cmd, response);
139 return response.get(0).asBool();
140}
141
142
144{
146 yarp::os::Bottle response;
149 m_port.write(cmd, response);
150 return static_cast<unsigned int>(response.get(0).asInt32());
151}
152
153
155{
157 yarp::os::Bottle response;
160 cmd.addInt32(speed);
161 m_port.write(cmd, response);
162 return response.get(0).asBool();
163}
164
165
167{
169 yarp::os::Bottle response;
172 cmd.addInt32(video_mode);
173 m_port.write(cmd, response);
174 return static_cast<unsigned int>(response.get(0).asInt32());
175}
176
177
179{
181 yarp::os::Bottle response;
184 m_port.write(cmd, response);
185 return static_cast<unsigned int>(response.get(0).asInt32());
186}
187
188
190{
192 yarp::os::Bottle response;
195 cmd.addInt32(coding);
196 m_port.write(cmd, response);
197 return response.get(0).asBool();
198}
199
200
202 unsigned int& ydim,
203 unsigned int& xstep,
204 unsigned int& ystep,
205 unsigned int& xoffstep,
206 unsigned int& yoffstep)
207{
209 yarp::os::Bottle response;
212 m_port.write(cmd, response);
213
214 xdim = response.get(0).asInt32();
215 ydim = response.get(1).asInt32();
216 xstep = response.get(2).asInt32();
217 ystep = response.get(3).asInt32();
218 xoffstep = response.get(4).asInt32();
219 yoffstep = response.get(5).asInt32();
220 return response.get(0).asBool();
221}
222
223
224bool FrameGrabberControlsDC1394_Forwarder::getFormat7WindowDC1394(unsigned int& xdim, unsigned int& ydim, int& x0, int& y0)
225{
227 yarp::os::Bottle response;
230 m_port.write(cmd, response);
231 xdim = response.get(0).asInt32();
232 ydim = response.get(1).asInt32();
233 x0 = response.get(2).asInt32();
234 y0 = response.get(3).asInt32();
235 return response.get(0).asBool();
236}
237
238
239bool FrameGrabberControlsDC1394_Forwarder::setFormat7WindowDC1394(unsigned int xdim, unsigned int ydim, int x0, int y0)
240{
242 yarp::os::Bottle response;
245 cmd.addInt32(xdim);
246 cmd.addInt32(ydim);
247 cmd.addInt32(x0);
248 cmd.addInt32(y0);
249 m_port.write(cmd, response);
250 return response.get(0).asBool();
251}
252
253
255{
257 yarp::os::Bottle response;
260 cmd.addInt32(int(b1394b));
261 m_port.write(cmd, response);
262 return response.get(0).asBool();
263}
264
265
267{
269 yarp::os::Bottle response;
272 m_port.write(cmd, response);
273 return response.get(0).asBool();
274}
275
276
278{
280 yarp::os::Bottle response;
283 cmd.addInt32(int(bTxON));
284 m_port.write(cmd, response);
285 return response.get(0).asBool();
286}
287
288
290{
292 yarp::os::Bottle response;
295 m_port.write(cmd, response);
296 return response.get(0).asBool();
297}
298
299
301{
303 yarp::os::Bottle response;
306 cmd.addInt32(static_cast<int>(onoff));
307 m_port.write(cmd, response);
308 return response.get(0).asBool();
309}
310
311
313{
315 yarp::os::Bottle response;
318 m_port.write(cmd, response);
319 return response.get(0).asBool();
320}
321
322
324{
326 yarp::os::Bottle response;
329 m_port.write(cmd, response);
330 return response.get(0).asBool();
331}
332
333
335{
337 yarp::os::Bottle response;
340 cmd.addInt32(static_cast<int>(onoff));
341 m_port.write(cmd, response);
342 return response.get(0).asBool();
343}
344
345
347{
349 yarp::os::Bottle response;
352 cmd.addInt32(int(bON));
353 m_port.write(cmd, response);
354 return response.get(0).asBool();
355}
356
357
359{
361 yarp::os::Bottle response;
364 cmd.addInt32(int(bpp));
365 m_port.write(cmd, response);
366 return response.get(0).asBool();
367}
368
369
371{
373 yarp::os::Bottle response;
376 m_port.write(cmd, response);
377 return static_cast<unsigned int>(response.get(0).asInt32());
378}
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_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_DRGETCOD
constexpr yarp::conf::vocab32_t VOCAB_DRSETISO
constexpr yarp::conf::vocab32_t VOCAB_DRGETOPM
constexpr yarp::conf::vocab32_t VOCAB_GET
constexpr yarp::conf::vocab32_t VOCAB_SET
A simple collection of objects that can be described and transmitted in a portable way.
Definition Bottle.h:64
void addVocab32(yarp::conf::vocab32_t x)
Places a vocabulary item in the bottle, at the end of the list.
Definition Bottle.cpp:164
void addFloat64(yarp::conf::float64_t x)
Places a 64-bit floating point number in the bottle, at the end of the list.
Definition Bottle.cpp:158
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
Definition Bottle.cpp:246
void addInt32(std::int32_t x)
Places a 32-bit integer in the bottle, at the end of the list.
Definition Bottle.cpp:140
A mini-server for network communication.
Definition Port.h:46
bool write(const PortWriter &writer, const PortWriter *callback=nullptr) const override
Write an object to the port.
Definition Port.cpp:436
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
Definition Value.cpp:222
virtual bool asBool() const
Get boolean value.
Definition Value.cpp:186
virtual std::int32_t asInt32() const
Get 32-bit integer value.
Definition Value.cpp:204
bool getFormat7WindowDC1394(unsigned int &xdim, unsigned int &ydim, int &x0, int &y0) override
bool setFormat7WindowDC1394(unsigned int xdim, unsigned int ydim, int x0, int y0) override
bool getFormat7MaxWindowDC1394(unsigned int &xdim, unsigned int &ydim, unsigned int &xstep, unsigned int &ystep, unsigned int &xoffstep, unsigned int &yoffstep) override