AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | List of all members
alexaClientSDK::capabilityAgents::aip::test::RecognizeEvent Class Reference

Public Member Functions

 RecognizeEvent (AudioProvider audioProvider, Initiator initiator, avsCommon::avs::AudioInputStream::Index begin=AudioInputProcessor::INVALID_INDEX, avsCommon::avs::AudioInputStream::Index keywordEnd=AudioInputProcessor::INVALID_INDEX, std::string keyword="", std::shared_ptr< std::string > avsInitiator=nullptr, const std::shared_ptr< std::vector< char >> KWDMetadata=nullptr, std::string expectedFormat="")
 
std::future< bool > send (std::shared_ptr< AudioInputProcessor > audioInputProcessor)
 
void verifyJsonState (const avsCommon::avs::NamespaceAndName &, const std::string &jsonState, const avsCommon::avs::StateRefreshPolicy &, const unsigned int)
 
void verifyEspMessage (std::shared_ptr< avsCommon::avs::MessageRequest > request, const std::string &dialogRequestId)
 
void verifyMetadata (const std::shared_ptr< avsCommon::avs::MessageRequest > request, const std::shared_ptr< std::vector< char >> KWDMetadata)
 
void verifyMessage (std::shared_ptr< avsCommon::avs::MessageRequest > request, const std::vector< Sample > &pattern, const std::string &dialogRequestId, const std::string &expectedFormat="")
 
std::vector< std::shared_ptr< avsCommon::avs::MessageRequest::NamedReader > > getNamedReaders ()
 

Detailed Description

Utility class which captures parameters to a Recognize event, and provides functions to send and verify the event using those parameters.

Constructor & Destructor Documentation

◆ RecognizeEvent()

alexaClientSDK::capabilityAgents::aip::test::RecognizeEvent::RecognizeEvent ( AudioProvider  audioProvider,
Initiator  initiator,
avsCommon::avs::AudioInputStream::Index  begin = AudioInputProcessor::INVALID_INDEX,
avsCommon::avs::AudioInputStream::Index  keywordEnd = AudioInputProcessor::INVALID_INDEX,
std::string  keyword = "",
std::shared_ptr< std::string >  avsInitiator = nullptr,
const std::shared_ptr< std::vector< char >>  KWDMetadata = nullptr,
std::string  expectedFormat = "" 
)

Constructs an object which captures the parameters to send in a Recognize Event. Parameters are passed through directly to AudioInputProcessor::recognize().

Member Function Documentation

◆ getNamedReaders()

std::vector< std::shared_ptr< avsCommon::avs::MessageRequest::NamedReader > > alexaClientSDK::capabilityAgents::aip::test::RecognizeEvent::getNamedReaders ( )

Accessor function to get the attachment reader for a verified message.

Returns
the attachment reader for a verified message.

◆ send()

std::future< bool > alexaClientSDK::capabilityAgents::aip::test::RecognizeEvent::send ( std::shared_ptr< AudioInputProcessor audioInputProcessor)

This function sends a recognize event using the provided AudioInputProcessor and the recognize parameters captured by this instance.

Parameters
audioInputProcessorThe AudioInputProcessor to call AudioInputProcessor::recognize() on.
Returns
A future which is true if the call succeeded, else false.

◆ verifyEspMessage()

void alexaClientSDK::capabilityAgents::aip::test::RecognizeEvent::verifyEspMessage ( std::shared_ptr< avsCommon::avs::MessageRequest request,
const std::string &  dialogRequestId 
)

◆ verifyJsonState()

void alexaClientSDK::capabilityAgents::aip::test::RecognizeEvent::verifyJsonState ( const avsCommon::avs::NamespaceAndName ,
const std::string &  jsonState,
const avsCommon::avs::StateRefreshPolicy ,
const unsigned  int 
)

This function verifies that the JSON state string is correct and matches the captured parameters. This function signature matches that of ContextManager::setState() so that an EXPECT_CALL() can Invoke() this function directly, but only the jsonState parameter is verified by this function.

Parameters
jsonStateThe JSON context state string to verify.

◆ verifyMessage()

void alexaClientSDK::capabilityAgents::aip::test::RecognizeEvent::verifyMessage ( std::shared_ptr< avsCommon::avs::MessageRequest request,
const std::vector< Sample > &  pattern,
const std::string &  dialogRequestId,
const std::string &  expectedFormat = "" 
)

This function verifies that JSON content of a recognize MessageRequest is correct, and that it has an attachment.

Parameters
requestThe MessageRequest to verify.
patternVector of samples holding a test pattern expected from the AudioInputStream.
dialogRequestIdThe expected dialogRequestId in the MessageRequest.

◆ verifyMetadata()

void alexaClientSDK::capabilityAgents::aip::test::RecognizeEvent::verifyMetadata ( const std::shared_ptr< avsCommon::avs::MessageRequest request,
const std::shared_ptr< std::vector< char >>  KWDMetadata 
)

This function verifies the metadata AttachmentReader created is correct

Parameters
requestThe MessageRequest to verify
KWDMetadataThe Wakeword engine metadata recevied by AudioInputProcessor::recognize

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

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0