16 #ifndef ALEXA_CLIENT_SDK_LIBIPCSERVERSAMPLEAPP_INCLUDE_IPCSERVERSAMPLEAPP_ALEXAPRESENTATION_APLRUNTIMEPRESENTATIONADAPTER_H_ 17 #define ALEXA_CLIENT_SDK_LIBIPCSERVERSAMPLEAPP_INCLUDE_IPCSERVERSAMPLEAPP_ALEXAPRESENTATION_APLRUNTIMEPRESENTATIONADAPTER_H_ 21 #include <rapidjson/document.h> 22 #include <rapidjson/writer.h> 43 namespace sampleApplications {
44 namespace ipcServerSampleApp {
52 ,
public std::enable_shared_from_this<APLRuntimePresentationAdapter> {
60 static std::shared_ptr<APLRuntimePresentationAdapter>
create(
61 const std::shared_ptr<APLRuntimeInterfaceImpl>& runtimeInterface,
62 std::shared_ptr<gui::GUIActivityEventNotifierInterface> activityEventNotifier);
69 std::shared_ptr<alexaPresentationInterfaces::AlexaPresentationCapabilityAgentInterface> alexaPresentationCA);
95 const std::chrono::steady_clock::time_point& receiveTime,
96 std::shared_ptr<aplCapabilityCommonInterfaces::APLCapabilityAgentInterface> agent)
override;
114 std::unique_ptr<aplCapabilityCommonInterfaces::APLDocumentSessionInterface>&& session)
override;
125 const std::chrono::steady_clock::time_point& timestamp)
override;
177 void setExecutor(std::shared_ptr<avsCommon::utils::threading::Executor>);
199 const std::chrono::steady_clock::time_point& receiveTime,
201 std::shared_ptr<aplCapabilityCommonInterfaces::APLCapabilityAgentInterface> agent);
211 const std::shared_ptr<APLRuntimeInterfaceImpl>& runtimeInterface,
212 std::unique_ptr<APLDocumentSessionManager> sessionManager,
213 std::shared_ptr<gui::GUIActivityEventNotifierInterface> activityEventNotifier);
215 void executeRenderDocument(
224 const std::chrono::steady_clock::time_point& receiveTime,
225 std::shared_ptr<aplCapabilityCommonInterfaces::APLCapabilityAgentInterface> agent,
226 bool trackAsPresentation);
227 void executeClearDocument(
const std::string& token);
228 void executeExecuteCommands(
231 void executeDataSourceUpdate(
235 void executeRequestForeground(
const std::string& token);
236 void executeOnCommandExecutionComplete(
240 void executeOnRenderDocumentComplete(
244 const std::chrono::steady_clock::time_point& timestamp);
246 void executeOnVisualContextAvailable(
250 void executeOnDataSourceFetch(
253 void executeOnDocumentFinished(
const std::string& token);
254 void executeProvideState(
const std::string& aplToken,
const unsigned int stateRequestToken);
263 struct PresentationAgentDocumentTracker {
270 explicit PresentationAgentDocumentTracker(
272 std::weak_ptr<aplCapabilityCommonInterfaces::APLCapabilityAgentInterface> presentationAgent,
273 bool trackAsPresentation) :
275 presentationAgent{
std::move(presentationAgent)} {
276 handleOnPresentationDismissed = trackAsPresentation;
284 std::weak_ptr<aplCapabilityCommonInterfaces::APLCapabilityAgentInterface> presentationAgent;
290 bool handleOnPresentationDismissed;
298 std::shared_ptr<PresentationAgentDocumentTracker> executeGetPresentationAgentTrackerFromToken(
306 std::shared_ptr<aplCapabilityCommonInterfaces::APLCapabilityAgentInterface> executeGetPresentationAgentFromToken(
315 void executeRemoveTokenFromPresentationAgentTracker(
const std::string& token);
322 void executeUpdateTimeoutType(
326 const std::shared_ptr<APLRuntimeInterfaceImpl> m_runtimeInterface;
328 std::unique_ptr<APLDocumentSessionManager> m_sessionManager;
330 std::shared_ptr<gui::GUIActivityEventNotifierInterface> m_activityEventNotifier;
333 bool m_isSpeakingOrListening;
336 std::shared_ptr<alexaPresentationInterfaces::AlexaPresentationCapabilityAgentInterface> m_alexaPresentationCA;
339 std::unordered_map<std::string, std::shared_ptr<PresentationAgentDocumentTracker>> m_presentationAgentTrackers;
342 std::unordered_map<std::shared_ptr<aplCapabilityCommonInterfaces::APLCapabilityAgentInterface>,
unsigned int>
343 m_presentationTrackersPerCA;
346 std::shared_ptr<avsCommon::utils::threading::Executor> m_executor;
351 #endif // ALEXA_CLIENT_SDK_LIBIPCSERVERSAMPLEAPP_INCLUDE_IPCSERVERSAMPLEAPP_ALEXAPRESENTATION_APLRUNTIMEPRESENTATIONADAPTER_H_
Definition: APLEventPayload.h:137
Definition: APLEventPayload.h:86
Definition: PresentationSession.h:40
void setExecutor(std::shared_ptr< avsCommon::utils::threading::Executor >)
void onShowDocument(const aplCapabilityCommonInterfaces::PresentationToken &token) override
Definition: APLEventPayload.h:178
void onRenderDocumentComplete(const aplCapabilityCommonInterfaces::PresentationToken &token, bool result, const std::string &error, const std::chrono::steady_clock::time_point ×tamp) override
void onPlayerActivityChanged(avsCommon::avs::PlayerActivity state)
APLTimeoutType
Definition: APLTimeoutType.h:30
void onDataSourceUpdate(const std::string &sourceType, const std::string &jsonPayload, const aplCapabilityCommonInterfaces::PresentationToken &token) override
::std::string string
Definition: gtest-port.h:1097
void onActivityEvent(const aplCapabilityCommonInterfaces::PresentationToken &token, const avsCommon::sdkInterfaces::GUIActivityEvent &event) override
unsigned int ContextRequestToken
Alias for the token used to identify a context request.
Definition: ContextRequestToken.h:23
void onRuntimeError(const aplCapabilityCommonInterfaces::aplEventPayload::RuntimeError &payload) override
void onDocumentFinished(const std::string &token) override
void onDataSourceUpdateComplete(const std::string &token, bool result, const std::string &error) override
void clearDocument(const std::string &token)
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)
DialogUXState
The different dialog specific AVS UX states.
Definition: DialogUXStateObserverInterface.h:32
void onActiveDocumentChanged(const aplCapabilityCommonInterfaces::PresentationToken &token, const aplCapabilityCommonInterfaces::PresentationSession &session) override
std::string PresentationToken
Alias for the token used by APL directives.
Definition: PresentationToken.h:22
Definition: APLRuntimePresentationAdapter.h:46
void provideState(const aplCapabilityCommonInterfaces::PresentationToken &token, const avsCommon::sdkInterfaces::ContextRequestToken stateRequestToken) override
void onDataSourceFetch(const aplCapabilityCommonInterfaces::aplEventPayload::DataSourceFetch &payload) override
void onGUIActivityEventReceived(const std::string &source, const avsCommon::sdkInterfaces::GUIActivityEvent &activityEvent) override
Definition: APLCapabilityAgentObserverInterface.h:31
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
void onVisualContextAvailable(const avsCommon::sdkInterfaces::ContextRequestToken requestToken, const aplCapabilityCommonInterfaces::aplEventPayload::VisualContext &context) override
GUIActivityEvent
Enumeration of activity events used to indicate the state of a GUI.
Definition: GUIActivityEvent.h:27
void onAPLDocumentSessionAvailable(const aplCapabilityCommonInterfaces::PresentationSession &presentationSession, const aplCapabilityCommonInterfaces::PresentationToken &token, std::unique_ptr< aplCapabilityCommonInterfaces::APLDocumentSessionInterface > &&session) override
void onSendEvent(const aplCapabilityCommonInterfaces::aplEventPayload::UserEvent &payload) override
Definition: APLDocumentObserverInterface.h:36
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
Definition: VisualStateProviderInterface.h:29
Definition: APLEventPayload.h:31
static std::shared_ptr< APLRuntimePresentationAdapter > create(const std::shared_ptr< APLRuntimeInterfaceImpl > &runtimeInterface, std::shared_ptr< gui::GUIActivityEventNotifierInterface > activityEventNotifier)
void onSessionEnded(const aplCapabilityCommonInterfaces::PresentationSession &presentationSession) override
APLCommandExecutionEvent
Enumeration of APL Command Execution Events that can be reported to the APL capability agent...
Definition: APLCommandExecutionEvent.h:27
PlayerActivity
Identifies the player state.
Definition: PlayerActivity.h:27
Definition: GUIActivityEventObserverInterface.h:28
void onExecuteCommands(const std::string &sourceType, const aplCapabilityCommonInterfaces::PresentationToken &token) override
tuple message
Definition: gtest_output_test.py:331
const T & move(const T &t)
Definition: gtest-port.h:1317
void setDefaultWindowId(const std::string &windowId)
void onDialogUXStateChanged(avsCommon::sdkInterfaces::DialogUXStateObserverInterface::DialogUXState newState) override
void onCommandExecutionComplete(const aplCapabilityCommonInterfaces::PresentationToken &token, alexaClientSDK::aplCapabilityCommonInterfaces::APLCommandExecutionEvent event, const std::string &error) override
std::string getAPLRuntimeVersion()
A dialog specific UX state observer.
Definition: DialogUXStateObserverInterface.h:29
void setAlexaPresentationCA(std::shared_ptr< alexaPresentationInterfaces::AlexaPresentationCapabilityAgentInterface > alexaPresentationCA)