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::APLDocumentSession Class Reference

#include <APLDocumentSession.h>

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

Public Member Functions

 APLDocumentSession (const std::string &document, const std::string &data, const std::string &supportedViewPorts, const aplCapabilityCommonInterfaces::PresentationSession &presentationSession, const aplCapabilityCommonInterfaces::PresentationOptions &presentationOptions, std::shared_ptr< alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentObserverInterface > observer, APLViewhostInterfacePtr viewhost, bool hasPresentationAssociation)
 
void renderDocument (const std::string &document, const std::string &data, const alexaClientSDK::aplCapabilityCommonInterfaces::PresentationSession &presentationSession, const alexaClientSDK::aplCapabilityCommonInterfaces::PresentationOptions &presentationOptions)
 
void updateTimeoutType (const aplCapabilityCommonInterfaces::APLTimeoutType &timeoutType)
 
void firstRender ()
 
APLDocumentSessionInterface Functions

{

void clearDocument () override
 
void executeCommands (const std::string &commands) override
 
void dataSourceUpdate (const std::string &sourceType, const std::string &payload) override
 
void interruptCommandSequence () override
 
void provideDocumentContext (const unsigned int stateRequestToken) override
 
void requestForeground () override
 
void stopTimeout () override
 
void resetTimeout () override
 
void updateLifespan (presentationOrchestratorInterfaces::PresentationLifespan lifespan) override
 
void updateTimeout (std::chrono::milliseconds timeout) override
 
std::string getToken () const override
 
bool isForegroundFocused () override
 
PresentationObserverInterface functions

}

void onPresentationAvailable (presentationOrchestratorInterfaces::PresentationRequestToken id, std::shared_ptr< presentationOrchestratorInterfaces::PresentationInterface > presentation) override
 
void onPresentationStateChanged (presentationOrchestratorInterfaces::PresentationRequestToken id, presentationOrchestratorInterfaces::PresentationState newState) override
 
bool onNavigateBack (presentationOrchestratorInterfaces::PresentationRequestToken id) override
 
APLViewhostObserverInterface functions
void onCommandExecutionComplete (const std::string &token, APLClient::AplCommandExecutionEvent event, const std::string &message) override
 
void onRenderDocumentComplete (const std::string &token, bool result, const std::string &error, const std::chrono::steady_clock::time_point &timestamp) override
 
void onSendEvent (const std::string &token, const std::string &arguments, const std::string &components, const std::string &source) override
 
void onVisualContextAvailable (const unsigned int requestToken, const std::string &token, const std::string &version, const std::string &visualContext, const std::string &datasourceContext) override
 
void onDataSourceUpdateComplete (const std::string &token, bool result, const std::string &error) override
 
void onDataSourceFetch (const std::string &token, const std::string &dataSourceType, const std::string &payload) override
 
void onRuntimeError (const std::string &token, const std::string &payload) override
 
void onDocumentFinished (const std::string &token) override
 
void onOpenURL (const std::string &token, const std::string &url) override
 
void onDocumentCleared (const std::string &token) override
 
void onSetDocumentIdleTimeout (const std::string &token, const std::chrono::milliseconds &timeout) override
 
- Public Member Functions inherited from alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface
virtual ~APLDocumentSessionInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::presentationOrchestratorInterfaces::PresentationObserverInterface
virtual ~PresentationObserverInterface ()=default
 
virtual void onPresentationAvailable (PresentationRequestToken id, std::shared_ptr< PresentationInterface > presentation)=0
 
- Public Member Functions inherited from alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface
virtual ~APLViewhostObserverInterface ()=default
 

Static Public Member Functions

static std::shared_ptr< APLDocumentSessiongetDocumentSessionFromInterface (const std::shared_ptr< aplCapabilityCommonInterfaces::APLDocumentSessionInterface > &aplDocumentSessionInterface)
 

Constructor & Destructor Documentation

◆ APLDocumentSession()

alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::APLDocumentSession ( const std::string &  document,
const std::string &  data,
const std::string &  supportedViewPorts,
const aplCapabilityCommonInterfaces::PresentationSession presentationSession,
const aplCapabilityCommonInterfaces::PresentationOptions presentationOptions,
std::shared_ptr< alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentObserverInterface observer,
APLViewhostInterfacePtr  viewhost,
bool  hasPresentationAssociation 
)

Constructor

Parameters
documentAPL document for this session.
dataAPL data for this session.
supportedViewPortsSupported viewports for this session.
presentationSessionPresentation session for this session.
presentationOptionsPresentation options for this session.
observerObserver of this document session.
viewhostInstance of the viewhost on which the document session will be rendered.
hasPresentationAssociationBoolean defining whether session has associated presentation.

Member Function Documentation

◆ clearDocument()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::clearDocument ( )
overridevirtual

Dismiss APL document. No other functions can be called after this

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.

◆ dataSourceUpdate()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::dataSourceUpdate ( const std::string &  sourceType,
const std::string &  payload 
)
overridevirtual

Update the data source payload for a given APL document

Parameters
sourceTypeAPL spec source type for data update
payloadJSON string containing update payload

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.

◆ executeCommands()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::executeCommands ( const std::string &  commands)
overridevirtual

Execute commands referenced in APL document

Parameters
commandsJSON string containing APL command to execute

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.

◆ firstRender()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::firstRender ( )

Inits the first render of the session

◆ getDocumentSessionFromInterface()

static std::shared_ptr<APLDocumentSession> alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::getDocumentSessionFromInterface ( const std::shared_ptr< aplCapabilityCommonInterfaces::APLDocumentSessionInterface > &  aplDocumentSessionInterface)
static

Helper function which can be used to convert a APLDocumentSessionInterface to an APLDocumentSession

Parameters
aplDocumentSessionInterfaceThe interface to try to convert
Returns
A pointer to the APLDocumentSession, or nullptr if aplDocumentSessionInterface does not represent an APLDocumentSession

◆ getToken()

std::string alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::getToken ( ) const
overridevirtual

Get presentation token of this document session. Can be used for sharing APLDocumentObserverInterface instances across multiple documents.

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.

◆ interruptCommandSequence()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::interruptCommandSequence ( )
overridevirtual

Interrupt any active command sequence currently executing on the document

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.

◆ isForegroundFocused()

bool alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::isForegroundFocused ( )
overridevirtual

Check if document session is foreground focused

Returns
true if session is foreground focused, false otherwise

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.

◆ onCommandExecutionComplete()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::onCommandExecutionComplete ( const std::string &  token,
APLClient::AplCommandExecutionEvent  event,
const std::string &  message 
)
overridevirtual

Callback when command execution is complete.

Parameters
tokenthe presentation token corresponding to the document being executed
eventthe command execution event.
messagethe execute command completion message.

Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.

◆ onDataSourceFetch()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::onDataSourceFetch ( const std::string &  token,
const std::string &  dataSourceType,
const std::string &  payload 
)
overridevirtual

Callback when document requires a data source update

Parameters
tokenthe presentation token corresponding to the document requiring the update
dataSourceTypethe data source type requiring update
payloadThe payload of the fetch request

Reimplemented from alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.

◆ onDataSourceUpdateComplete()

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

Callback when data source update is complete.

Parameters
tokenthe presentation token corresponding to the document being updated
resulttrue if successful, false otherwise
errorerror string if available

Reimplemented from alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.

◆ onDocumentCleared()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::onDocumentCleared ( const std::string &  token)
overridevirtual

Callback when a document has been cleared

Parameters
tokenthe presentation of the cleared document

Reimplemented from alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.

◆ onDocumentFinished()

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

Callback when document is no longer displayed

Parameters
tokenthe presentation token corresponding to the document encountering the error

Reimplemented from alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.

◆ onNavigateBack()

bool alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::onNavigateBack ( presentationOrchestratorInterfaces::PresentationRequestToken  id)
overridevirtual

Called by the presentation orchestrator to perform custom back navigation on a presentation if supported

Parameters
idThe identifier for the presentation, as provided when the window was initially requested
Returns
true if the observer handled back navigation, false if the presentation orchestrator should handle back

Implements alexaClientSDK::presentationOrchestratorInterfaces::PresentationObserverInterface.

◆ onOpenURL()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::onOpenURL ( const std::string &  token,
const std::string &  url 
)
overridevirtual

Callback when an open URL command occurs

Parameters
tokenthe presentation token
urlthe url to open

Reimplemented from alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.

◆ onPresentationAvailable()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::onPresentationAvailable ( presentationOrchestratorInterfaces::PresentationRequestToken  id,
std::shared_ptr< presentationOrchestratorInterfaces::PresentationInterface presentation 
)
override

◆ onPresentationStateChanged()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::onPresentationStateChanged ( presentationOrchestratorInterfaces::PresentationRequestToken  id,
presentationOrchestratorInterfaces::PresentationState  newState 
)
overridevirtual

Called when the presentation state has changed

Parameters
idThe identifier for this presentation, as provided when the window was initially requested
newStateThe new presentation state

Implements alexaClientSDK::presentationOrchestratorInterfaces::PresentationObserverInterface.

◆ onRenderDocumentComplete()

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

Callback when render document is complete.

Parameters
tokenthe presentation token corresponding to the document being rendered
resulttrue if successful, false otherwise
timestampThe timestamp at which the document was rendered

Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.

◆ onRuntimeError()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::onRuntimeError ( const std::string &  token,
const std::string &  payload 
)
overridevirtual

Callback when document receives a runtime error

Parameters
tokenthe presentation token corresponding to the document encountering the error
payloadThe payload of the error

Reimplemented from alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.

◆ onSendEvent()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::onSendEvent ( const std::string &  token,
const std::string &  arguments,
const std::string &  components,
const std::string &  source 
)
overridevirtual

Callback for send event request

Parameters
tokenthe presentation token corresponding to the document sending the event
argumentsArguments array of SendEvent command
componentsObject containing the component of the SendEvent command
sourceObject detailing component which generated the command

Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.

◆ onSetDocumentIdleTimeout()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::onSetDocumentIdleTimeout ( const std::string &  token,
const std::chrono::milliseconds &  timeout 
)
overridevirtual

Callback when a document timeout needs to be updated

Parameters
tokenthe presentation token
timeoutupdated timeout value

Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.

◆ onVisualContextAvailable()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::onVisualContextAvailable ( const unsigned int  requestToken,
const std::string &  token,
const std::string &  version,
const std::string &  visualContext,
const std::string &  datasourceContext 
)
overridevirtual

callback when a new visual context is available

Parameters
requestTokentoken which was provided with the original visual context request
tokenthe presentation token corresponding to the document providing the context.
versionthe version of the UI component on the device.
visualContextserialized visual context
datasourceContextserialized datasource context

Reimplemented from alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.

◆ provideDocumentContext()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::provideDocumentContext ( const unsigned int  stateRequestToken)
overridevirtual

Provide visual context to onVisualContextAvailable observer callback

Parameters
stateRequestTokenprovided by StateProviderInterface call

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.

◆ renderDocument()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::renderDocument ( const std::string &  document,
const std::string &  data,
const alexaClientSDK::aplCapabilityCommonInterfaces::PresentationSession presentationSession,
const alexaClientSDK::aplCapabilityCommonInterfaces::PresentationOptions presentationOptions 
)

◆ requestForeground()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::requestForeground ( )
overridevirtual

Request active document session to move to the foreground if not already there.

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.

◆ resetTimeout()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::resetTimeout ( )
overridevirtual

Reset a timeout timer based on configured timeout policy.

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.

◆ stopTimeout()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::stopTimeout ( )
overridevirtual

◆ updateLifespan()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::updateLifespan ( presentationOrchestratorInterfaces::PresentationLifespan  lifespan)
overridevirtual

Update the PresentationLifespan for document session.

Parameters
lifespanPresentationLifespan

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.

◆ updateTimeout()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::updateTimeout ( std::chrono::milliseconds  timeout)
overridevirtual

Update the timeout policy for document session. Will reset any active timeout timer.

Parameters
timeoutupdated timeout duration, use a value of -1 to disable the timeout

Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.

◆ updateTimeoutType()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::updateTimeoutType ( const aplCapabilityCommonInterfaces::APLTimeoutType timeoutType)

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