YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FakeDeviceWrapper.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2024-2024 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#include "FakeDeviceWrapper.h"
7
8#include <yarp/os/Log.h>
10#include <yarp/os/LogStream.h>
11
12using namespace yarp::os;
13using namespace yarp::dev;
14
15namespace {
16YARP_LOG_COMPONENT(FAKEDEVICEWRAPPER, "yarp.device.fakeDeviceWrapper")
17}
18
20{
21 if (!iTest) { yCError(FAKEDEVICEWRAPPER) << "Invalid/not yet attached interface"; }
22
23 yCInfo(FAKEDEVICEWRAPPER) << "testSetValue() called";
24 return iTest->testSetValue(value);
25}
26
28{
29 if (!iTest) { yCError(FAKEDEVICEWRAPPER) << "Invalid/not yet attached interface"; }
30
31 yCInfo(FAKEDEVICEWRAPPER) << "testGetValue() called";
32 return iTest->testGetValue(value);
33}
34
36{
37 yCInfo(FAKEDEVICEWRAPPER) << "FakeDeviceWrapper opened";
38 return true;
39}
40
42{
43 yCInfo(FAKEDEVICEWRAPPER) << "FakeDeviceWrapper closed";
44 return true;
45}
46
48{
49 iTest=nullptr;
50 return true;
51}
52
54{
55 if (drv->isValid())
56 {
57 drv->view(iTest);
58 return true;
59 }
60 return false;
61}
bool detach() override
Detach the object (you must have first called attach).
bool close() override
Close the DeviceDriver.
yarp::dev::ReturnValue testGetValue(int &value) override
This method is used to get a single value from a test device.
yarp::dev::ReturnValue testSetValue(int value) override
This method is used to set a single value inside the test device.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool attach(yarp::dev::PolyDriver *drv) override
Attach to another object.
bool view(T *&x)
Get an interface to the device driver.
A container for a device driver.
Definition PolyDriver.h:23
bool isValid() const
Check if device is valid.
virtual yarp::dev::ReturnValue testGetValue(int &value)=0
This method is used to get a single value from a test device.
virtual yarp::dev::ReturnValue testSetValue(int value)=0
This method is used to set a single value inside the test device.
A mini-server for performing network communication in the background.
A base class for nested structures that can be searched.
Definition Searchable.h:31
#define yCInfo(component,...)
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.