YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
serialPort_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#include <yarp/os/Network.h>
10
11#include <catch2/catch_amalgamated.hpp>
12#include <harness.h>
13
14using namespace yarp::dev;
15using namespace yarp::os;
16
17TEST_CASE("dev::serialPort_nwc_yarp", "[yarp::dev]")
18{
19 YARP_REQUIRE_PLUGIN("fakeSerialPort", "device");
20 YARP_REQUIRE_PLUGIN("serialPort_nws_yarp", "device");
21 YARP_REQUIRE_PLUGIN("serialPort_nwc_yarp", "device");
22
23 Network::setLocalMode(true);
24
25 SECTION("Checking serialPort_nwc_yarp device")
26 {
31
32 {
34 pnws_cfg.put("device", "serialPort_nws_yarp");
35 pnws_cfg.put("name", "/serialPort_nws_yarp");
37
39 pdev_cfg.put("device", "fakeSerialPort");
40 pdev_cfg.put("comport", "fakePort");
41 pdev_cfg.put("baudrate", 9600);
43
46 bool result_att = ww_nws->attach(&ddfake);
48
50 pnwc_cfg.put("device", "serialPort_nwc_yarp");
51 pnwc_cfg.put("local", "/serialPort_nwc_yarp");
52 pnwc_cfg.put("remote", "/serialPort_nws_yarp/rpc");
54 REQUIRE(ddnwc.view(iser));
55 }
56
57 //tests
58 {
59 CHECK (iser->setDTR(true));
61 std::string s("fake_command");
62 CHECK (iser->send(s.c_str(),s.size()));
63 }
64
65 //"Close all polydrivers and check"
66 {
67 CHECK(ddnwc.close());
69 CHECK(ddnws.close());
72 }
73 }
74
75 Network::setLocalMode(false);
76}
A generic interface to serial port devices.
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:33
For streams capable of holding different kinds of content, check what they actually have.
void delay(double seconds)
Wait for a certain number of seconds.
Definition Time.cpp:111
An interface to the operating system, including Port based communication.
TEST_CASE("dev::serialPort_nwc_yarp", "[yarp::dev]")