AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter Class Reference

#include <APLRuntimePresentationAdapter.h>

Inheritance diagram for alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter:
Collaboration graph
[legend]

Public Member Functions

void setAlexaPresentationCA (std::shared_ptr< alexaPresentationInterfaces::AlexaPresentationCapabilityAgentInterface > alexaPresentationCA)
 
void setDefaultWindowId (const std::string &windowId)
 
std::string getAPLRuntimeVersion ()
 
void onPlayerActivityChanged (avsCommon::avs::PlayerActivity state)
 
void setExecutor (std::shared_ptr< avsCommon::utils::threading::Executor >)
 
void renderDocumentWithoutPresentation (const std::string &jsonPayload, const std::string &token, const std::string &windowId, const std::chrono::steady_clock::time_point &receiveTime, const std::string &interface, std::shared_ptr< aplCapabilityCommonInterfaces::APLCapabilityAgentInterface > agent)
 
void clearDocument (const std::string &token)
 
AlexaPresentationObserverInterface functions
void onRenderDocument (const std::string &document, const std::string &datasource, const aplCapabilityCommonInterfaces::PresentationToken &token, const std::string &windowId, const aplCapabilityCommonInterfaces::APLTimeoutType timeoutType, const std::string &interfaceName, const std::string &supportedViewports, const aplCapabilityCommonInterfaces::PresentationSession &presentationSession, const std::chrono::steady_clock::time_point &receiveTime, std::shared_ptr< aplCapabilityCommonInterfaces::APLCapabilityAgentInterface > agent) override
 
void onExecuteCommands (const std::string &sourceType, const aplCapabilityCommonInterfaces::PresentationToken &token) override
 
void onDataSourceUpdate (const std::string &sourceType, const std::string &jsonPayload, const aplCapabilityCommonInterfaces::PresentationToken &token) override
 
void onShowDocument (const aplCapabilityCommonInterfaces::PresentationToken &token) override
 
APLDocumentObserverInterface functions
void onAPLDocumentSessionAvailable (const aplCapabilityCommonInterfaces::PresentationSession &presentationSession, const aplCapabilityCommonInterfaces::PresentationToken &token, std::unique_ptr< aplCapabilityCommonInterfaces::APLDocumentSessionInterface > &&session) override
 
void onCommandExecutionComplete (const aplCapabilityCommonInterfaces::PresentationToken &token, alexaClientSDK::aplCapabilityCommonInterfaces::APLCommandExecutionEvent event, const std::string &error) override
 
void onRenderDocumentComplete (const aplCapabilityCommonInterfaces::PresentationToken &token, bool result, const std::string &error, const std::chrono::steady_clock::time_point &timestamp) override
 
void onSendEvent (const aplCapabilityCommonInterfaces::aplEventPayload::UserEvent &payload) override
 
void onVisualContextAvailable (const avsCommon::sdkInterfaces::ContextRequestToken requestToken, const aplCapabilityCommonInterfaces::aplEventPayload::VisualContext &context) override
 
void onDataSourceUpdateComplete (const std::string &token, bool result, const std::string &error) override
 
void onDataSourceFetch (const aplCapabilityCommonInterfaces::aplEventPayload::DataSourceFetch &payload) override
 
void onRuntimeError (const aplCapabilityCommonInterfaces::aplEventPayload::RuntimeError &payload) override
 
void onDocumentFinished (const std::string &token) override
 
void onActiveDocumentChanged (const aplCapabilityCommonInterfaces::PresentationToken &token, const aplCapabilityCommonInterfaces::PresentationSession &session) override
 
void onSessionEnded (const aplCapabilityCommonInterfaces::PresentationSession &presentationSession) override
 
void onActivityEvent (const aplCapabilityCommonInterfaces::PresentationToken &token, const avsCommon::sdkInterfaces::GUIActivityEvent &event) override
 
VisualStateProviderInterface functions
void provideState (const aplCapabilityCommonInterfaces::PresentationToken &token, const avsCommon::sdkInterfaces::ContextRequestToken stateRequestToken) override
 
ActivityEventObserverInterface functions
void onGUIActivityEventReceived (const std::string &source, const avsCommon::sdkInterfaces::GUIActivityEvent &activityEvent) override
 
DialogUXStateObserverInterface Functions
void onDialogUXStateChanged (avsCommon::sdkInterfaces::DialogUXStateObserverInterface::DialogUXState newState) override
 
- Public Member Functions inherited from alexaClientSDK::aplCapabilityCommonInterfaces::APLCapabilityAgentObserverInterface
virtual ~APLCapabilityAgentObserverInterface ()=default
 
virtual void onRenderDocument (const std::string &document, const std::string &datasource, const PresentationToken &token, const std::string &windowId, const APLTimeoutType timeoutType, const std::string &interfaceName, const std::string &supportedViewports, const PresentationSession &presentationSession, const std::chrono::steady_clock::time_point &receiveTime, std::shared_ptr< APLCapabilityAgentInterface > agent)=0
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::DialogUXStateObserverInterface
virtual ~DialogUXStateObserverInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::GUIActivityEventObserverInterface
virtual ~GUIActivityEventObserverInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::aplCapabilityCommonInterfaces::VisualStateProviderInterface
virtual ~VisualStateProviderInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentObserverInterface
virtual ~APLDocumentObserverInterface ()=default
 
virtual void onAPLDocumentSessionAvailable (const PresentationSession &presentationSession, const PresentationToken &token, std::unique_ptr< APLDocumentSessionInterface > &&session)=0
 

Static Public Member Functions

static std::shared_ptr< APLRuntimePresentationAdaptercreate (const std::shared_ptr< APLRuntimeInterfaceImpl > &runtimeInterface, std::shared_ptr< gui::GUIActivityEventNotifierInterface > activityEventNotifier)
 
- Static Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::DialogUXStateObserverInterface
static std::string stateToString (DialogUXState state)
 

Additional Inherited Members

- Public Types inherited from alexaClientSDK::avsCommon::sdkInterfaces::DialogUXStateObserverInterface
enum  DialogUXState {
  DialogUXState::IDLE, DialogUXState::LISTENING, DialogUXState::EXPECTING, DialogUXState::THINKING,
  DialogUXState::SPEAKING, DialogUXState::FINISHED
}
 The different dialog specific AVS UX states. More...
 

Member Function Documentation

◆ clearDocument()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::clearDocument ( const std::string &  token)

Clears the associated document from the tracked sessions.

Parameters
tokenThe toke for the APL document.

◆ create()

static std::shared_ptr<APLRuntimePresentationAdapter> alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::create ( const std::shared_ptr< APLRuntimeInterfaceImpl > &  runtimeInterface,
std::shared_ptr< gui::GUIActivityEventNotifierInterface activityEventNotifier 
)
static

Create an instance of APL runtime presentation adaptor.

Parameters
runtimeInterfaceAn instance of a APL runtime implementation.
activityEventNotifierNotifier to GUI activity events.
Returns
Instance of APL runtime presentation adaptor if successful, else nullptr.

◆ getAPLRuntimeVersion()

std::string alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::getAPLRuntimeVersion ( )

Returns the APL version implemented by the runtime. https://developer.amazon.com/en-US/docs/alexa/alexa-presentation-language/apl-latest-version.html

Returns
apl version.

◆ onActiveDocumentChanged()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::onActiveDocumentChanged ( const aplCapabilityCommonInterfaces::PresentationToken token,
const aplCapabilityCommonInterfaces::PresentationSession session 
)
overridevirtual

Callback when the active document has changed

Parameters
tokenAPL Token for the new active document
sessionThe PresentationSession for the new active document

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentObserverInterface.

◆ onActivityEvent()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::onActivityEvent ( const aplCapabilityCommonInterfaces::PresentationToken token,
const avsCommon::sdkInterfaces::GUIActivityEvent event 
)
overridevirtual

Callback when a document receives a GUI activity

Parameters
tokenpresentationToken of document
eventThe GUIActivityEvent event

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentObserverInterface.

◆ onAPLDocumentSessionAvailable()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::onAPLDocumentSessionAvailable ( const aplCapabilityCommonInterfaces::PresentationSession presentationSession,
const aplCapabilityCommonInterfaces::PresentationToken token,
std::unique_ptr< aplCapabilityCommonInterfaces::APLDocumentSessionInterface > &&  session 
)
override

◆ onCommandExecutionComplete()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::onCommandExecutionComplete ( const aplCapabilityCommonInterfaces::PresentationToken token,
alexaClientSDK::aplCapabilityCommonInterfaces::APLCommandExecutionEvent  result,
const std::string &  error 
)
overridevirtual

Callback when execute command is complete

Parameters
tokenpresentationToken of document
resultthe command result as defined in APLCommandExecutionEvent
errorerror string if available

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentObserverInterface.

◆ onDataSourceFetch()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::onDataSourceFetch ( const aplCapabilityCommonInterfaces::aplEventPayload::DataSourceFetch payload)
overridevirtual

Callback for data source fetch request

Parameters
payloadThe DataSourceFetchRequest event payload. The caller of this function is responsible to pass the payload as it defined in aplEventPayload::DataSourceFetch.

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentObserverInterface.

◆ onDataSourceUpdate()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::onDataSourceUpdate ( const std::string &  sourceType,
const std::string &  jsonPayload,
const aplCapabilityCommonInterfaces::PresentationToken token 
)
overridevirtual

Used to notify observer when Alexa.Presentation.APL directives related to DataSource updates received.

Parameters
sourceTypeDataSource type.
jsonPayloadThe payload of the directive in structured JSON format.
tokenpresentation token used in renderdocument

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLCapabilityAgentObserverInterface.

◆ onDataSourceUpdateComplete()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::onDataSourceUpdateComplete ( const std::string &  token,
bool  result,
const std::string &  error 
)
overridevirtual

Callback when data source update is complete

Parameters
tokenpresentationToken of document
resulttrue if successful, false otherwise
errorerror string if availabled

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentObserverInterface.

◆ onDialogUXStateChanged()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::onDialogUXStateChanged ( avsCommon::sdkInterfaces::DialogUXStateObserverInterface::DialogUXState  newState)
overridevirtual

This function is called whenever the AVS UX dialog state of the system changes. This function will block processing of other state changes, so any implementation of this should return quickly.

Parameters
newStateThe new dialog specific AVS UX state.

Implements alexaClientSDK::avsCommon::sdkInterfaces::DialogUXStateObserverInterface.

◆ onDocumentFinished()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::onDocumentFinished ( const std::string &  token)
overridevirtual

Callback when document has finished displaying

Parameters
tokenpresentationToken of document

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentObserverInterface.

◆ onExecuteCommands()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::onExecuteCommands ( const std::string &  jsonPayload,
const aplCapabilityCommonInterfaces::PresentationToken token 
)
overridevirtual

Used to notify observer when Alexa.Presentation.APL.ExecuteCommands directive has been received.

Parameters
jsonPayloadThe payload of the Alexa.Presentation.APL.ExecuteCommands directive in structured JSON format.
tokenpresentation token used in renderdocument

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLCapabilityAgentObserverInterface.

◆ onGUIActivityEventReceived()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::onGUIActivityEventReceived ( const std::string &  source,
const avsCommon::sdkInterfaces::GUIActivityEvent activityEvent 
)
overridevirtual

Observer method to be notified of activity event

Parameters
sourceThe source of the activity event.
eventThe activity event.

Implements alexaClientSDK::avsCommon::sdkInterfaces::GUIActivityEventObserverInterface.

◆ onPlayerActivityChanged()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::onPlayerActivityChanged ( avsCommon::avs::PlayerActivity  state)

◆ onRenderDocument()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::onRenderDocument ( const std::string &  document,
const std::string &  datasource,
const aplCapabilityCommonInterfaces::PresentationToken token,
const std::string &  windowId,
const aplCapabilityCommonInterfaces::APLTimeoutType  timeoutType,
const std::string &  interfaceName,
const std::string &  supportedViewports,
const aplCapabilityCommonInterfaces::PresentationSession presentationSession,
const std::chrono::steady_clock::time_point &  receiveTime,
std::shared_ptr< aplCapabilityCommonInterfaces::APLCapabilityAgentInterface agent 
)
override

◆ onRenderDocumentComplete()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::onRenderDocumentComplete ( const aplCapabilityCommonInterfaces::PresentationToken token,
bool  result,
const std::string &  error,
const std::chrono::steady_clock::time_point &  timestamp 
)
overridevirtual

Callback when document rendering is complete

Parameters
tokenpresentationToken of document
resulttrue if rendering was successful, false otherwise
errorerror string if available
timestampThe timestamp at which the document was rendered

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentObserverInterface.

◆ onRuntimeError()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::onRuntimeError ( const aplCapabilityCommonInterfaces::aplEventPayload::RuntimeError payload)
overridevirtual

Callback when runtime error occurs in document

Parameters
payloadThe RuntimeError event payload. The caller of this function is responsible to pass the payload as it defined in aplEventPayload::RuntimeError.

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentObserverInterface.

◆ onSendEvent()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::onSendEvent ( const aplCapabilityCommonInterfaces::aplEventPayload::UserEvent payload)
overridevirtual

Callback for send event request

Parameters
payloadThe UserEvent event payload. The caller of this function is responsible to pass the payload as it defined in aplEventPayload::UserEvent.

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentObserverInterface.

◆ onSessionEnded()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::onSessionEnded ( const aplCapabilityCommonInterfaces::PresentationSession presentationSession)
overridevirtual

Callback when a document session has ended

Parameters
presentationSessionThe session that was associated with this document session

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentObserverInterface.

◆ onShowDocument()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::onShowDocument ( const aplCapabilityCommonInterfaces::PresentationToken token)
overridevirtual

Used to notify observer when a show document directive has been received for an existing presentation.

Parameters
tokenpresentation token used in renderdocument

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLCapabilityAgentObserverInterface.

◆ onVisualContextAvailable()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::onVisualContextAvailable ( const avsCommon::sdkInterfaces::ContextRequestToken  requestToken,
const aplCapabilityCommonInterfaces::aplEventPayload::VisualContext context 
)
overridevirtual

Callback to provide information about what is currently displayed on screen. Should be provided to ContextManagerInterface in response to provideState calls.

Parameters
requestTokentoken correlating context to provideState request
contextThe visual state to be passed to AVS. The caller of this function is responsible to pass the payload as it defined in aplEventPayload::VisualContext

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentObserverInterface.

◆ provideState()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::provideState ( const aplCapabilityCommonInterfaces::PresentationToken token,
const avsCommon::sdkInterfaces::ContextRequestToken  stateRequestToken 
)
overridevirtual

A request to a VisualStateProvider to provide the state. The requester specifies a token which the VisualStateProvider must use when it updates the state via the onVisualContextAvailable call to APL Capability Agent.

Parameters
tokenThe token of the last displaying document to get the correct context in the onVisualContextAvailable call.
stateRequestTokenThe token to use in the onVisualContextAvailable call.

Implements alexaClientSDK::aplCapabilityCommonInterfaces::VisualStateProviderInterface.

◆ renderDocumentWithoutPresentation()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::renderDocumentWithoutPresentation ( const std::string &  jsonPayload,
const std::string &  token,
const std::string &  windowId,
const std::chrono::steady_clock::time_point &  receiveTime,
const std::string &  interface,
std::shared_ptr< aplCapabilityCommonInterfaces::APLCapabilityAgentInterface agent 
)

Used to request the rendering af an APL document that has no presentation lifecycle association. Once called, the client should render the document based on the APL specification in the payload in structured JSON format.

Note
The payload may contain customer sensitive information and should be used with utmost care. Failure to do so may result in exposing or mishandling of customer data.
Parameters
jsonPayloadA JSON payload that maps to the schema of the Alexa.Presentation.APL.RenderDocument directive and follows the APL specification.
tokenThe APL presentation token associated with this payload.
windowIdThe target windowId.
receiveTimeThe time at which the document request was initiated, for more accurate telemetry.
interfaceThe interface (namespace) which is associated with this document.
agentPointer to the AlexaPresentationCAInterface requesting the render.

◆ setAlexaPresentationCA()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::setAlexaPresentationCA ( std::shared_ptr< alexaPresentationInterfaces::AlexaPresentationCapabilityAgentInterface alexaPresentationCA)

Sets the Alexa Presentation Capability Agent to the APLRuntimePresentationAdapter.

Parameters
alexaPresentationCAInstance of the Alexa Presentation Capability Agent.

◆ setDefaultWindowId()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::setDefaultWindowId ( const std::string &  windowId)

Sets the default window id to use for rendering documents that do not provide one.

Parameters
windowIdThe default window id.

◆ setExecutor()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLRuntimePresentationAdapter::setExecutor ( std::shared_ptr< avsCommon::utils::threading::Executor )

TEST ONLY


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