YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FakeFrameGrabber_Controls.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025-2025 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#include "FakeFrameGrabber.h"
7
9#include <yarp/os/LogStream.h>
10
11#include <cstdio>
12#include <thread>
13#include <random>
14
15using namespace yarp::os;
16using namespace yarp::dev;
17
18//namespace {
19//YARP_LOG_COMPONENT(FAKEFRAMEGRABBER, "yarp.device.fakeFrameGrabber")
20//}
21
22struct
23{
24 bool hasFeature = false;
25 double feature = 0.0;
26 double feature1 = 0.0;
27 double feature2 = 0.0;
28 bool hasOnOff = false;
29 bool hasAuto = false;
30 bool hasManual = false;
31 bool hasOnePush = false;
32 bool isActive = false;
36
38{
39 std::lock_guard<std::mutex> lock(rpc_methods_mutex);
40 camera = m_controls.camera;
41 return ReturnValue_ok;
42}
43
45{
46 std::lock_guard<std::mutex> lock(rpc_methods_mutex);
47 hasFeature = m_controls.hasFeature;
48 return ReturnValue_ok;
49}
50
52{
53 std::lock_guard<std::mutex> lock(rpc_methods_mutex);
54 m_controls.feature = value;
55 return ReturnValue_ok;
56}
57
59{
60 std::lock_guard<std::mutex> lock(rpc_methods_mutex);
61 value = m_controls.feature;
62 return ReturnValue_ok;
63}
64
66{
67 std::lock_guard<std::mutex> lock(rpc_methods_mutex);
68 m_controls.feature1 = value1;
69 m_controls.feature2 = value2;
70 return ReturnValue_ok;
71}
72
74{
75 std::lock_guard<std::mutex> lock(rpc_methods_mutex);
76 value1 = m_controls.feature2;
77 value2 = m_controls.feature2;
78 return ReturnValue_ok;
79}
80
82{
83 std::lock_guard<std::mutex> lock(rpc_methods_mutex);
84 HasOnOff = m_controls.hasOnOff;
85 return ReturnValue_ok;
86}
87
89{
90 std::lock_guard<std::mutex> lock(rpc_methods_mutex);
91 m_controls.isActive = onoff;
92 return ReturnValue_ok;
93}
94
96{
97 std::lock_guard<std::mutex> lock(rpc_methods_mutex);
98 isActive = m_controls.isActive;
99 return ReturnValue_ok;
100}
101
103{
104 std::lock_guard<std::mutex> lock(rpc_methods_mutex);
105 hasAuto = m_controls.hasAuto;
106 return ReturnValue_ok;
107}
108
110{
111 std::lock_guard<std::mutex> lock(rpc_methods_mutex);
112 hasManual = m_controls.hasManual;
113 return ReturnValue_ok;
114}
115
117{
118 std::lock_guard<std::mutex> lock(rpc_methods_mutex);
119 hasOnePush = m_controls.hasOnePush;
120 return ReturnValue_ok;
121}
122
124{
125 std::lock_guard<std::mutex> lock(rpc_methods_mutex);
126 m_controls.mode = mode;
127 return ReturnValue_ok;
128}
129
131{
132 std::lock_guard<std::mutex> lock(rpc_methods_mutex);
133 mode = m_controls.mode;
134 return ReturnValue_ok;
135}
136
138{
139 std::lock_guard<std::mutex> lock(rpc_methods_mutex);
140 m_controls.hasOnePush = true;
141 return ReturnValue_ok;
142}
CameraDescriptor camera
FeatureMode mode
struct @90 m_controls
#define ReturnValue_ok
Definition ReturnValue.h:80
yarp::dev::ReturnValue setMode(yarp::dev::cameraFeature_id_t feature, yarp::dev::FeatureMode mode) override
Set the requested mode for the feature.
yarp::dev::ReturnValue hasOnePush(yarp::dev::cameraFeature_id_t feature, bool &hasOnePush) override
Check if the requested feature has the 'onePush' mode.
yarp::dev::ReturnValue setActive(yarp::dev::cameraFeature_id_t feature, bool onoff) override
Set the requested feature on or off.
yarp::dev::ReturnValue hasFeature(yarp::dev::cameraFeature_id_t feature, bool &hasFeature) override
Check if camera has the requested feature (saturation, brightness ... )
yarp::dev::ReturnValue getActive(yarp::dev::cameraFeature_id_t feature, bool &isActive) override
Get the current status of the feature, on or off.
yarp::dev::ReturnValue hasOnOff(yarp::dev::cameraFeature_id_t feature, bool &HasOnOff) override
Check if the camera has the ability to turn on/off the requested feature.
yarp::dev::ReturnValue getFeature(yarp::dev::cameraFeature_id_t feature, double &value) override
Get the current value for the requested feature.
yarp::dev::ReturnValue hasAuto(yarp::dev::cameraFeature_id_t feature, bool &hasAuto) override
Check if the requested feature has the 'auto' mode.
yarp::dev::ReturnValue hasManual(yarp::dev::cameraFeature_id_t feature, bool &hasManual) override
Check if the requested feature has the 'manual' mode.
yarp::dev::ReturnValue setFeature(yarp::dev::cameraFeature_id_t feature, double value) override
Set the requested feature to a value (saturation, brightness ... )
yarp::dev::ReturnValue getMode(yarp::dev::cameraFeature_id_t feature, yarp::dev::FeatureMode &mode) override
Get the current mode for the feature.
yarp::dev::ReturnValue getCameraDescription(yarp::dev::CameraDescriptor &camera) override
Get a basic description of the camera hw.
yarp::dev::ReturnValue setOnePush(yarp::dev::cameraFeature_id_t feature) override
Set the requested feature to a value (saturation, brightness ... )
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.