NUGU SDK Linux  1.7.6
NuguCapability::IASRHandler Class Referenceabstract

ASR handler interface. More...

#include <asr_interface.hh>

+ Inheritance diagram for NuguCapability::IASRHandler:
+ Collaboration diagram for NuguCapability::IASRHandler:

Public Types

using AsrRecognizeCallback = std::function< void(const std::string &dialog_id)>
 ASR recognize callback for user request and response mapping. More...
 
- Public Types inherited from NuguClientKit::ICapabilityInterface
using EventResultCallback = std::function< void(const std::string &, const std::string &, const std::string &, int, int)>
 Event result callback for error handling. More...
 
enum class  SuspendPolicy { STOP , PAUSE }
 Capability suspend policy. More...
 

Public Member Functions

virtual void addListener (IASRListener *listener)=0
 Add the Listener object. More...
 
virtual void finishRecognition ()=0
 Finish audio recording and request recognition by a user.
 
virtual EpdAttribute getEpdAttribute ()=0
 Get EPD attribute. More...
 
virtual void removeListener (IASRListener *listener)=0
 Remove the Listener object. More...
 
virtual void setAttribute (ASRAttribute &&attribute)=0
 Set attribute about speech recognition. More...
 
virtual void setEpdAttribute (EpdAttribute &&attribute)=0
 Set EPD attribute. More...
 
virtual void startRecognition (ASRInitiator initiator=ASRInitiator::TAP, AsrRecognizeCallback callback=nullptr)=0
 Turn on the microphone and start speech recognition. More...
 
virtual void startRecognition (float power_noise, float power_speech, ASRInitiator initiator=ASRInitiator::TAP, AsrRecognizeCallback callback=nullptr)=0
 Turn on the microphone and start speech recognition (support multi-wakeup) More...
 
virtual void stopRecognition (bool cancel=false)=0
 Turn off the microphone and stop speech recognition. More...
 
- Public Member Functions inherited from NuguClientKit::ICapabilityInterface
virtual void addEventResultCallback (const std::string &ename, EventResultCallback callback)=0
 Add event result callback for error handling. More...
 
virtual void cancelDirective (NuguDirective *ndir)=0
 Receive a directive cancellation from the Directive sequencer. More...
 
virtual void deInitialize ()=0
 Deinitialize the current object.
 
virtual std::string getName ()=0
 Get the capability name of the current object. More...
 
virtual bool getProperties (const std::string &property, std::list< std::string > &values)=0
 It is possible to share own property values among objects. More...
 
virtual bool getProperty (const std::string &property, std::string &value)=0
 It is possible to share own property value among objects. More...
 
virtual std::string getVersion ()=0
 Get the capability version of the current object. More...
 
virtual void initialize ()=0
 Initialize the current object.
 
virtual void notifyEventResponse (const std::string &msg_id, const std::string &data, bool success)=0
 Notify event response info. More...
 
virtual void notifyEventResult (const std::string &event_desc)=0
 Notify event result. More...
 
virtual void preprocessDirective (NuguDirective *ndir)=0
 Receive a directive preprocessing request from Directive sequencer. More...
 
virtual void processDirective (NuguDirective *ndir)=0
 Receive a directive processing request from Directive sequencer. More...
 
virtual bool receiveCommand (const std::string &from, const std::string &command, const std::string &param)=0
 Process command from other objects. More...
 
virtual void receiveCommandAll (const std::string &command, const std::string &param)=0
 Process command received from capability manager. More...
 
virtual void removeEventResultCallback (const std::string &ename)=0
 Remove event result callback. More...
 
virtual void restore ()=0
 Restore previous suspended action.
 
virtual void setCancelPolicy (bool cancel_previous_dialog, DirectiveCancelPolicy &&cancel_policy={ true })=0
 Set directive cancel policy. More...
 
virtual void setCapabilityListener (ICapabilityListener *clistener)=0
 Set the listener object. More...
 
virtual void setNuguCoreContainer (INuguCoreContainer *core_container)=0
 Set INuguCoreContainer for using functions in NuguCore. More...
 
virtual void setSuspendPolicy (SuspendPolicy policy=SuspendPolicy::STOP)=0
 Set capability suspend policy. More...
 
virtual void suspend ()=0
 Suspend current action.
 
virtual void updateCompactContext (NJson::Value &ctx)=0
 Update the compact context information of the capability agent. More...
 
virtual void updateInfoForContext (NJson::Value &ctx)=0
 Update the current context information of the capability agent. More...
 

Detailed Description

ASR handler interface.

See also
IASRListener

Member Typedef Documentation

◆ AsrRecognizeCallback

using NuguCapability::IASRHandler::AsrRecognizeCallback = std::function<void(const std::string& dialog_id)>

ASR recognize callback for user request and response mapping.

Parameters
[in]dialog_idevent request dialog id

Member Function Documentation

◆ startRecognition() [1/2]

virtual void NuguCapability::IASRHandler::startRecognition ( float  power_noise,
float  power_speech,
ASRInitiator  initiator = ASRInitiator::TAP,
AsrRecognizeCallback  callback = nullptr 
)
pure virtual

Turn on the microphone and start speech recognition (support multi-wakeup)

Parameters
[in]power_noisemin wakeup power value
[in]power_speechmax wakeup power value
[in]initiatorasr initiator
[in]callbackasr recognize callback

◆ startRecognition() [2/2]

virtual void NuguCapability::IASRHandler::startRecognition ( ASRInitiator  initiator = ASRInitiator::TAP,
AsrRecognizeCallback  callback = nullptr 
)
pure virtual

Turn on the microphone and start speech recognition.

Parameters
[in]initiatorasr initiator
[in]callbackasr recognize callback

◆ stopRecognition()

virtual void NuguCapability::IASRHandler::stopRecognition ( bool  cancel = false)
pure virtual

Turn off the microphone and stop speech recognition.

Parameters
[in]cancelIf true, cancel the directives to be received for current dialog

◆ addListener()

virtual void NuguCapability::IASRHandler::addListener ( IASRListener listener)
pure virtual

Add the Listener object.

Parameters
[in]listenerlistener object

◆ removeListener()

virtual void NuguCapability::IASRHandler::removeListener ( IASRListener listener)
pure virtual

Remove the Listener object.

Parameters
[in]listenerlistener object

◆ setAttribute()

virtual void NuguCapability::IASRHandler::setAttribute ( ASRAttribute &&  attribute)
pure virtual

Set attribute about speech recognition.

Parameters
[in]attributeattribute object

◆ setEpdAttribute()

virtual void NuguCapability::IASRHandler::setEpdAttribute ( EpdAttribute &&  attribute)
pure virtual

Set EPD attribute.

Parameters
[in]attributeEPD attribute

◆ getEpdAttribute()

virtual EpdAttribute NuguCapability::IASRHandler::getEpdAttribute ( )
pure virtual

Get EPD attribute.

Returns
EPD attribute

The documentation for this class was generated from the following file: