YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
AudioRecorder_nws_yarp.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023-2023 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6#ifndef YARP_DEV_AUDIORECORDER_NWS_YARP_H
7#define YARP_DEV_AUDIORECORDER_NWS_YARP_H
8
9#include <cstdio>
10
11
13#include <yarp/dev/PolyDriver.h>
16#include <yarp/os/Time.h>
17#include <yarp/os/Network.h>
19#include <yarp/os/Vocab.h>
20#include <yarp/os/Bottle.h>
21#include <yarp/os/Stamp.h>
22#include <yarp/os/Log.h>
23
24#include <list>
25
28
44{
45private:
48
49 yarp::dev::PolyDriver m_driver;
50 yarp::dev::IAudioGrabberSound* m_mic = nullptr; //The microphone device
51 yarp::os::Property m_config;
52 yarp::os::Port m_rpcPort;
53 yarp::os::Port m_streamingPort;
54 yarp::os::Port m_statusPort;
55 yarp::os::Stamp m_stamp;
56 std::unique_ptr<AudioRecorderStatusThread> m_statusThread;
57 std::unique_ptr<AudioRecorderDataThread> m_dataThread;
58 const bool m_debug_enabled = false;
59 std::list <yarp::sig::Sound> m_listofsnds;
60
61private:
62 double m_debug_last_time=0;
63
64private:
65 //thrift
67
68public:
77
78 ~AudioRecorder_nws_yarp() override;
79
80 bool open(yarp::os::Searchable& config) override;
81 bool close() override;
82
83 bool attach(yarp::dev::PolyDriver* driver) override;
84 bool detach() override;
85
86 bool read(yarp::os::ConnectionReader& connection) override;
89};
90
91//----------------------------------------------------------------
93{
94public:
96
97public:
99
100 bool threadInit() override { return true; }
101 void threadRelease() override { return; }
102 void run() override;
103};
104
105//----------------------------------------------------------------
107{
108public:
110
111public:
113
114 bool threadInit() override { return true; }
115 void threadRelease() override { return; }
116 void run() override;
117
119};
120
121#endif // YARP_DEV_AUDIORECORDER_NWS_YARP_H
bool threadInit() override
Initialization method.
This class is the parameters parser for class AudioRecorder_nws_yarp.
AudioRecorder_nws_yarp: A Wrapper which streams audio over the network, after grabbing it from a devi...
bool close() override
Close the DeviceDriver.
bool detach() override
Detach the object (you must have first called attach).
AudioRecorder_nws_yarp & operator=(AudioRecorder_nws_yarp &&)=delete
bool attach(yarp::dev::PolyDriver *driver) override
Attach to another object.
AudioRecorder_nws_yarp(const AudioRecorder_nws_yarp &)=delete
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
AudioRecorder_nws_yarp & operator=(const AudioRecorder_nws_yarp &)=delete
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
AudioRecorder_nws_yarp(AudioRecorder_nws_yarp &&)=delete
Interface implemented by all device drivers.
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.
An interface for reading from a network connection.
An abstraction for a periodic thread.
PeriodicThread(double period, ShouldUseSystemClock useSystemClock=ShouldUseSystemClock::No, PeriodicThreadClock clockAccuracy=PeriodicThreadClock::Relative)
Constructor.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition PortReader.h:24
A mini-server for network communication.
Definition Port.h:46
A class for storing options and configuration information.
Definition Property.h:33
A base class for nested structures that can be searched.
Definition Searchable.h:31
An abstraction for a time stamp and/or sequence number.
Definition Stamp.h:21
Class for storing sounds See Audio in YARP for additional documentation on YARP audio.
Definition Sound.h:25