29 input_buffer.
attach(m_inputPort);
63 if (
nullptr == m_isptr)
71 callback_impl = std::make_unique<SpeechTranscription_CallbackHelper>(m_isptr,&m_outputPort);
80bool SpeechTranscription_nws_yarp::detach()
86bool SpeechTranscription_nws_yarp::closeMain()
101 if (!connection.
isValid()) {
return false;}
103 bool b = m_rpc.
read(connection);
119 std::lock_guard <std::mutex>
lg(m_mutex);
126 ret.ret = ReturnValue::return_code::return_value_error_generic;
132 std::lock_guard <std::mutex>
lg(m_mutex);
136 std::string language;
139 ret.language = language;
143 ret.ret = ReturnValue::return_code::return_value_error_generic;
149 std::lock_guard <std::mutex>
lg(m_mutex);
153 std::string transcription;
157 ret.transcription = transcription;
165 m_output_port->
write(bot);
171 ret.ret = ReturnValue::return_code::return_value_error_generic;
179 if (x ==
nullptr || p==
nullptr)
192 std::string transcription;
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
virtual return_set_language set_language(const std::string &language) override
virtual return_transcribe transcribe(const yarp::sig::Sound &sound) override
void setInterfaces(yarp::dev::ISpeechTranscription *iser)
virtual return_get_language get_language() override
void setOutputPort(yarp::os::Port *port)
yarp::dev::ISpeechTranscription * m_isptr
SpeechTranscription_CallbackHelper()=delete
yarp::os::Port * m_output_port
void onRead(yarp::sig::Sound &b) override
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool close() override
Close the DeviceDriver.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
virtual ~SpeechTranscription_nws_yarp() override
void run() override
Main body of the new thread.
A generic interface for speech transcription.
virtual yarp::dev::ReturnValue transcribe(const yarp::sig::Sound &sound, std::string &transcription, double &score)=0
Performs the speech transcription.
virtual yarp::dev::ReturnValue getLanguage(std::string &language)=0
Gets the current language set for speech transcription.
virtual yarp::dev::ReturnValue setLanguage(const std::string &language="auto")=0
Sets the language for speech transcription.
A container for a device driver.
A simple collection of objects that can be described and transmitted in a portable way.
void addFloat64(yarp::conf::float64_t x)
Places a 64-bit floating point number in the bottle, at the end of the list.
void addString(const char *str)
Places a string in the bottle, at the end of the list.
A mini-server for performing network communication in the background.
An interface for reading from a network connection.
virtual bool isValid() const =0
void attach(Port &port)
Attach this buffer to a particular port.
void useCallback(TypedReaderCallback< T > &callback) override
Set an object whose onRead method will be called when data is available.
void disableCallback() override
Remove a callback set up with useCallback()
A mini-server for network communication.
int getOutputCount() override
Determine how many output connections this port has.
bool write(const PortWriter &writer, const PortWriter *callback=nullptr) const override
Write an object to the port.
void setReader(PortReader &reader) override
Set an external reader for port data.
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 base class for nested structures that can be searched.
static void delaySystem(double seconds)
bool stop()
Stop the thread.
bool isStopping()
Returns true if the thread is stopping (Thread::stop has been called).
bool isRunning()
Returns true if the thread is running (Thread::start has been called successfully and the thread has ...
bool start()
Start the new thread running.
Class for storing sounds See Audio in YARP for additional documentation on YARP audio.
#define yCInfo(component,...)
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)