YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
audioRecorder_nwc_yarp_test.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023-2023 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
7
8#include <yarp/os/Network.h>
9#include <yarp/sig/Image.h>
10#include <yarp/sig/Vector.h>
11#include <yarp/dev/PolyDriver.h>
13#include <yarp/os/Time.h>
14
15#include <string>
16
18#include <catch2/catch_amalgamated.hpp>
19#include <harness.h>
20
21using namespace yarp::os;
22using namespace yarp::dev;
23using namespace yarp::sig;
24
25
26TEST_CASE("dev::audioRecorder_nwc_yarp", "[yarp::dev]")
27{
28 YARP_REQUIRE_PLUGIN("fakeMicrophone", "device");
29 YARP_REQUIRE_PLUGIN("audioRecorder_nws_yarp", "device");
30 YARP_REQUIRE_PLUGIN("audioRecorder_nwc_yarp", "device");
31
32 Network::setLocalMode(true);
33
34 SECTION("Test the audioRecorder_nwc_yarp device with a audioRecorder_nws_yarp device")
35 {
42
43 p_nws.put("device","audioRecorder_nws_yarp");
44 p_nws.put("name", "/audioRecorder_nws");
45 p_fake.put("device","fakeMicrophone");
49
51
54 bool result_att = ww_nws->attach(&dd_fake);
56
57 p_nwc.put("device", "audioRecorder_nwc_yarp");
58 p_nwc.put("remote", "/audioRecorder_nws");
59 p_nwc.put("local", "/audioRecorder_nwc");
62
63 IAudioGrabberSound* igrab = nullptr;
64 REQUIRE(dd_nwc.view(igrab));
65
67
68 CHECK (igrab->stopRecording());
69 bool isrec = false;
70 CHECK (igrab->isRecording(isrec)); CHECK(isrec == false);
71 CHECK (igrab->startRecording());
72 CHECK (igrab->isRecording(isrec)); CHECK(isrec == true);
73 CHECK (igrab->stopRecording());
74 CHECK (igrab->isRecording(isrec)); CHECK(isrec == false);
75 CHECK (igrab->setHWGain(0.5));
76 CHECK (igrab->setSWGain(0.5));
77
79
83 }
84
85 Network::setLocalMode(false);
86}
contains the definition of a Vector type
TEST_CASE("dev::audioRecorder_nwc_yarp", "[yarp::dev]")
Read a YARP-format sound block from a device.
A container for a device driver.
Definition PolyDriver.h:23
Helper interface for an object that can wrap/or "attach" to a single other device.
A mini-server for performing network communication in the background.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
A class for storing options and configuration information.
Definition Property.h:32
static void delaySystem(double seconds)
void exec_params_test(yarp::dev::PolyDriver *pdrv)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.