![]() |
AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <APLDocumentSession.h>
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 ×tamp) 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 |
![]() | |
virtual | ~APLDocumentSessionInterface ()=default |
![]() | |
virtual | ~PresentationObserverInterface ()=default |
virtual void | onPresentationAvailable (PresentationRequestToken id, std::shared_ptr< PresentationInterface > presentation)=0 |
![]() | |
virtual | ~APLViewhostObserverInterface ()=default |
Static Public Member Functions | |
static std::shared_ptr< APLDocumentSession > | getDocumentSessionFromInterface (const std::shared_ptr< aplCapabilityCommonInterfaces::APLDocumentSessionInterface > &aplDocumentSessionInterface) |
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
document | APL document for this session. |
data | APL data for this session. |
supportedViewPorts | Supported viewports for this session. |
presentationSession | Presentation session for this session. |
presentationOptions | Presentation options for this session. |
observer | Observer of this document session. |
viewhost | Instance of the viewhost on which the document session will be rendered. |
hasPresentationAssociation | Boolean defining whether session has associated presentation. |
|
overridevirtual |
Dismiss APL document. No other functions can be called after this
Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.
|
overridevirtual |
Update the data source payload for a given APL document
sourceType | APL spec source type for data update |
payload | JSON string containing update payload |
Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.
|
overridevirtual |
Execute commands referenced in APL document
commands | JSON string containing APL command to execute |
Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.
void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::firstRender | ( | ) |
Inits the first render of the session
|
static |
Helper function which can be used to convert a APLDocumentSessionInterface
to an APLDocumentSession
aplDocumentSessionInterface | The interface to try to convert |
aplDocumentSessionInterface
does not represent an APLDocumentSession
|
overridevirtual |
Get presentation token of this document session. Can be used for sharing APLDocumentObserverInterface
instances across multiple documents.
Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.
|
overridevirtual |
Interrupt any active command sequence currently executing on the document
Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.
|
overridevirtual |
Check if document session is foreground focused
Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.
|
overridevirtual |
Callback when command execution is complete.
token | the presentation token corresponding to the document being executed |
event | the command execution event. |
message | the execute command completion message. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.
|
overridevirtual |
Callback when document requires a data source update
token | the presentation token corresponding to the document requiring the update |
dataSourceType | the data source type requiring update |
payload | The payload of the fetch request |
Reimplemented from alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.
|
overridevirtual |
Callback when data source update is complete.
token | the presentation token corresponding to the document being updated |
result | true if successful, false otherwise |
error | error string if available |
Reimplemented from alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.
|
overridevirtual |
Callback when a document has been cleared
token | the presentation of the cleared document |
Reimplemented from alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.
|
overridevirtual |
Callback when document is no longer displayed
token | the presentation token corresponding to the document encountering the error |
Reimplemented from alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.
|
overridevirtual |
Called by the presentation orchestrator to perform custom back navigation on a presentation if supported
id | The identifier for the presentation, as provided when the window was initially requested |
Implements alexaClientSDK::presentationOrchestratorInterfaces::PresentationObserverInterface.
|
overridevirtual |
Callback when an open URL command occurs
token | the presentation token |
url | the url to open |
Reimplemented from alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.
|
override |
|
overridevirtual |
Called when the presentation state has changed
id | The identifier for this presentation, as provided when the window was initially requested |
newState | The new presentation state |
Implements alexaClientSDK::presentationOrchestratorInterfaces::PresentationObserverInterface.
|
overridevirtual |
Callback when render document is complete.
token | the presentation token corresponding to the document being rendered |
result | true if successful, false otherwise |
timestamp | The timestamp at which the document was rendered |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.
|
overridevirtual |
Callback when document receives a runtime error
token | the presentation token corresponding to the document encountering the error |
payload | The payload of the error |
Reimplemented from alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.
|
overridevirtual |
Callback for send event request
token | the presentation token corresponding to the document sending the event |
arguments | Arguments array of SendEvent command |
components | Object containing the component of the SendEvent command |
source | Object detailing component which generated the command |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.
|
overridevirtual |
Callback when a document timeout needs to be updated
token | the presentation token |
timeout | updated timeout value |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.
|
overridevirtual |
callback when a new visual context is available
requestToken | token which was provided with the original visual context request |
token | the presentation token corresponding to the document providing the context. |
version | the version of the UI component on the device. |
visualContext | serialized visual context |
datasourceContext | serialized datasource context |
Reimplemented from alexaClientSDK::sampleApplications::ipcServerSampleApp::APLViewhostObserverInterface.
|
overridevirtual |
Provide visual context to onVisualContextAvailable observer callback
stateRequestToken | provided by StateProviderInterface call |
Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.
void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::renderDocument | ( | const std::string & | document, |
const std::string & | data, | ||
const alexaClientSDK::aplCapabilityCommonInterfaces::PresentationSession & | presentationSession, | ||
const alexaClientSDK::aplCapabilityCommonInterfaces::PresentationOptions & | presentationOptions | ||
) |
|
overridevirtual |
Request active document session to move to the foreground if not already there.
Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.
|
overridevirtual |
Reset a timeout timer based on configured timeout policy.
Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.
|
overridevirtual |
Stop any active timeout timer.
Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.
|
overridevirtual |
Update the PresentationLifespan
for document session.
lifespan | PresentationLifespan |
Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.
|
overridevirtual |
Update the timeout policy for document session. Will reset any active timeout timer.
timeout | updated timeout duration, use a value of -1 to disable the timeout |
Implements alexaClientSDK::aplCapabilityCommonInterfaces::APLDocumentSessionInterface.
void alexaClientSDK::sampleApplications::ipcServerSampleApp::APLDocumentSession::updateTimeoutType | ( | const aplCapabilityCommonInterfaces::APLTimeoutType & | timeoutType | ) |
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0