![]() |
AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <GUIClient.h>
Public Member Functions | |
SampleAppReturnCode | run () |
GUIClientInterface Functions | |
void | setGUIManager (std::shared_ptr< gui::GUIServerInterface > guiManager) override |
bool | acquireFocus (std::string avsInterface, std::string channelName, avsCommon::avs::ContentType contentType, std::shared_ptr< avsCommon::sdkInterfaces::ChannelObserverInterface > channelObserver) override |
bool | releaseFocus (std::string avsInterface, std::string channelName, std::shared_ptr< avsCommon::sdkInterfaces::ChannelObserverInterface > channelObserver) override |
void | sendMessage (messages::MessageInterface &message) override |
bool | finalizeClientInitialization (bool errorState) override |
void | handleInitializeAPLRenderers (rapidjson::Document &payload) override |
void | handleDisplayMetrics (rapidjson::Document &payload) override |
void | handleAplEvent (rapidjson::Document &payload) override |
void | handleRenderComplete (rapidjson::Document &payload) override |
void | handleLocalRenderDocument (rapidjson::Document &payload) override |
void | handleLocalExecuteCommands (rapidjson::Document &payload) override |
void | handleLocalClearDocument (rapidjson::Document &payload) override |
void | handleOnFocusChangedReceivedConfirmation (GUIToken token) override |
void | focusAcquireRequest (const GUIToken token, const std::string &avsInterface, const std::string &channelName, avsCommon::avs::ContentType contentType) override |
Internal function to execute. More... | |
void | focusReleaseRequest (const GUIToken token, const std::string &avsInterface, const std::string &channelName) override |
Internal function to execute. More... | |
void | setLocales (const std::string &localeStr) override |
std::shared_ptr< ipc::IPCRouter > | getIPCRouter () override |
Returns a reference to m_ipcRouter . More... | |
MessagingServerInterface Functions | |
bool | start () override |
void | writeMessage (const std::string &payload) override |
void | setMessageListener (std::shared_ptr< MessageListenerInterface > messageListener) override |
void | stop () override |
bool | isReady () override |
void | setObserver (const std::shared_ptr< communication::MessagingServerObserverInterface > &observer) override |
MessagingServerObserverInterface Function | |
void | onConnectionOpened () override |
void | onConnectionClosed () override |
MessageListenerInterface Function | |
void | onMessage (const std::string &jsonMessage) override |
AuthObserverInterface Function | |
void | onAuthStateChange (AuthObserverInterface::State newState, AuthObserverInterface::Error newError) override |
CapabilitiesObserverInterface Methods | |
void | onCapabilitiesStateChange (avsCommon::sdkInterfaces::CapabilitiesObserverInterface::State newState, avsCommon::sdkInterfaces::CapabilitiesObserverInterface::Error newError, const std::vector< avsCommon::sdkInterfaces::endpoints::EndpointIdentifier > &addedOrUpdatedEndpoints, const std::vector< avsCommon::sdkInterfaces::endpoints::EndpointIdentifier > &deletedEndpoints) override |
CustomerDataHandlerInterface Function | |
} | |
void | clearData () override |
UIAuthNotifierInterface Function | |
void | notifyAuthorizationRequest (const std::string &url, const std::string &code) override |
void | notifyAuthorizationStateChange (avsCommon::sdkInterfaces::AuthObserverInterface::State state) override |
UIStateAggregatorInterface Function | |
void | notifyAlexaState (const std::string &state) override |
RegistrationObserverInterface Functions | |
void | onLogout () override |
IPCDispatcherInterface Functions | |
bool | dispatch (const std::string &message) override |
AudioFocusManagerHandlerInterface methods | |
void | acquireChannelRequest (const std::string &message) override |
void | releaseChannelRequest (const std::string &message) override |
void | focusChangedReport (const std::string &message) override |
![]() | |
virtual void | setObserver (const std::shared_ptr< MessagingServerObserverInterface > &observer)=0 |
![]() | |
virtual void | setMessageListener (std::shared_ptr< MessageListenerInterface > messageListener)=0 |
![]() | |
virtual | ~RegistrationObserverInterface ()=default |
![]() | |
virtual | ~AuthObserverInterface ()=default |
virtual void | onAuthStateChange (State newState, Error error)=0 |
![]() | |
virtual | ~CapabilitiesDelegateObserverInterface ()=default |
![]() | |
virtual | ~GUIClientInterface ()=default |
![]() | |
RequiresShutdown (const std::string &name) | |
virtual | ~RequiresShutdown () |
Destructor. More... | |
const std::string & | name () const |
void | shutdown () |
bool | isShutdown () const |
![]() | |
CustomerDataHandler (const std::shared_ptr< registrationManager::CustomerDataManagerInterface > &dataManager) | |
virtual | ~CustomerDataHandler () |
![]() | |
virtual | ~CustomerDataHandlerInterface ()=default |
![]() | |
virtual | ~UIAuthNotifierInterface ()=default |
![]() | |
virtual | ~UIStateAggregatorInterface ()=default |
![]() | |
virtual | ~AudioFocusManagerHandlerInterface ()=default |
![]() | |
virtual | ~SystemHandlerInterface ()=default |
Static Public Member Functions | |
static std::shared_ptr< GUIClient > | create (std::shared_ptr< MessagingServerInterface > serverImplementation, const std::shared_ptr< registrationManager::CustomerDataManagerInterface > customerDataManager, const std::shared_ptr< ipc::IPCVersionManager > ipcVersionManager, std::shared_ptr< avsCommon::utils::DeviceInfo > deviceInfo) |
SystemHandlerInterface methods | |
void | authorizationStateRequest (const std::string &message) override |
} More... | |
void | alexaStateRequest (const std::string &message) override |
} More... | |
void | authorizationInfoRequest (const std::string &message) override |
} More... | |
void | localesRequest (const std::string &message) override |
} More... | |
void | setAplClientBridge (std::shared_ptr< AplClientBridge > aplClientBridge, bool aplVersionChanged) |
} More... | |
void | setAPLRuntimePresentationAdapter (const std::shared_ptr< APLRuntimePresentationAdapter > &aplRuntimePresentationAdapter) |
void | addToMediaPlayerMap (const std::string &name, const std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerInterface > &mediaPlayer) |
Adds a mediaplayer to the m_mediaPlayerMap with the key as the name and value as the mediaplayer. More... | |
void | initIPCRouter () |
Initializes the IPC router. More... | |
void | sendCompleteAuthorizationMessage (const std::string &url, const std::string &code, const std::string &clientId) |
void | sendSetAlexaStateMessage (const std::string &state) |
void | sendSetAuthorizationStateMessage (const std::string &state) |
void | sendSetLocalesMessage (const std::string &localeStr) |
Manages all GUI related operations to be called from the GUI and the SDK Encapsulates APL core Client implementation and APL Core integration point.
|
overridevirtual |
IPC Client sends this event to request the SDK to acquire audio focus for the given channel.
message | Incoming IPC message from the IPC client. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::ipc::AudioFocusManagerHandlerInterface.
|
overridevirtual |
Request audio focus.
avsInterface | The AVS Interface requesting focus. |
channelName | The channel to be requested. |
contentType | The type of content acquiring focus. |
channelObserver | the channelObserver to be notified. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClientInterface.
void alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClient::addToMediaPlayerMap | ( | const std::string & | name, |
const std::shared_ptr< avsCommon::utils::mediaPlayer::MediaPlayerInterface > & | mediaPlayer | ||
) |
Adds a mediaplayer to the m_mediaPlayerMap with the key as the name and value as the mediaplayer.
|
overridevirtual |
}
Sets the APL Client Bridge
aplClientBridge | The APL Client bridge |
aplVersionChanged | True if the APL Client version has changed from last run. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::ipc::SystemHandlerInterface.
|
overridevirtual |
}
Sets the APL Client Bridge
aplClientBridge | The APL Client bridge |
aplVersionChanged | True if the APL Client version has changed from last run. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::ipc::SystemHandlerInterface.
|
overridevirtual |
}
Sets the APL Client Bridge
aplClientBridge | The APL Client bridge |
aplVersionChanged | True if the APL Client version has changed from last run. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::ipc::SystemHandlerInterface.
|
overridevirtual |
Reset any internal state that may be associated with a particular user.
Implements alexaClientSDK::registrationManager::CustomerDataHandlerInterface.
|
static |
Create a GUIClient
serverImplementation | An implementation of MessagingInterface |
customerDataManager | Object that will track the CustomerDataHandler. |
serverImplementation
should implement the start
method in a blocking fashion. deviceInfo | DeviceInfo which reflects the device setup credentials. |
|
overridevirtual |
Dispatches a message over IPC channel.
message | Message to be transmitted. |
return true if successful.
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::ipc::IPCDispatcherInterface.
|
overridevirtual |
Finalize the client initialization with the error state so far passed from the caller.
errorState | Error state of the client initialization so far passed by the caller. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClientInterface.
|
overridevirtual |
Internal function to execute.
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClientInterface.
|
overridevirtual |
IPC Client sends this event to inform the SDK that it has received the processFocusChanged directive.
message | Incoming IPC message from the IPC client. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::ipc::AudioFocusManagerHandlerInterface.
|
overridevirtual |
Internal function to execute.
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClientInterface.
|
overridevirtual |
Returns a reference to m_ipcRouter
.
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClientInterface.
|
overridevirtual |
Handle aplEvent message.
payload | The payload retrieved from message holding this event. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClientInterface.
|
overridevirtual |
Handle displayMetrics message.
payload | The payload retrieved from message holding this event. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClientInterface.
|
overridevirtual |
Handle initialization of APL Renderers based on window and supported extensions reported by GUI app
payload | The payload retrieved from message holding this event. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClientInterface.
|
overridevirtual |
Handle Local ClearDocument message.
payload | The payload holding the local clear document directive. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClientInterface.
|
overridevirtual |
Handle Local ExecuteCommands message.
payload | The payload holding the local execute commands directive. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClientInterface.
|
overridevirtual |
Handle Local RenderDocument message.
payload | The payload holding the local render document directive. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClientInterface.
|
overridevirtual |
Handle focus message received confirmation messages.
token | Token field in the focusChangedReport event. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClientInterface.
|
overridevirtual |
Handle renderComplete message.
payload | The payload retrieved from message holding this event. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClientInterface.
void alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClient::initIPCRouter | ( | ) |
Initializes the IPC router.
|
overridevirtual |
Is the medium ready for passing messages
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::MessagingServerInterface.
|
overridevirtual |
}
Sets the APL Client Bridge
aplClientBridge | The APL Client bridge |
aplVersionChanged | True if the APL Client version has changed from last run. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::ipc::SystemHandlerInterface.
|
overridevirtual |
Notify User interface about the interaction state
state | UI state mainly to display the connection and Alexa states to user. |
Implements alexaClientSDK::acsdkSampleApplicationInterfaces::UIStateAggregatorInterface.
|
overridevirtual |
Notify user interface about the authorization request. The request url and code will be used by the user to authorize.
url | The URL that the user needs to navigate to. |
code | The code that the user needs to enter once authorized. |
Implements alexaClientSDK::acsdkSampleApplicationInterfaces::UIAuthNotifierInterface.
|
overridevirtual |
Notify authorization state changes to GUI.
state | Changed authorization state. |
Implements alexaClientSDK::acsdkSampleApplicationInterfaces::UIAuthNotifierInterface.
|
override |
|
overridevirtual |
Notification that an CapabilitiesDelegate state has changed.
newState | The new state of the CapabilitiesDelegate. |
newError | The error associated to the state change. |
addedOrUpdatedEndpointIds | The endpoint identifiers of endpoints sent in the addOrUpdateReport. |
deletedEndpointIds | The endpoint identifiers of endpoints sent in the deleteReport. |
Implements alexaClientSDK::avsCommon::sdkInterfaces::CapabilitiesDelegateObserverInterface.
|
overridevirtual |
A connection to the server has been closed.
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::MessagingServerObserverInterface.
|
overridevirtual |
A new connection to the server has been opened.
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::MessagingServerObserverInterface.
|
overridevirtual |
Notification that the current customer has logged out.
Implements alexaClientSDK::registrationManager::RegistrationObserverInterface.
|
overridevirtual |
Called when a new message is available on the arbitrary source channel
jsonMessage | an arbitrary string |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::MessageListenerInterface.
|
overridevirtual |
IPC Client sends this event to request the SDK to release audio focus for the given channel.
message | Incoming IPC message from the IPC client. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::ipc::AudioFocusManagerHandlerInterface.
|
overridevirtual |
Release audio focus.
avsInterface | The AVS Interface releasing focus. |
channelName | The channel to be released. |
channelObserver | the channelObserver to be notified. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClientInterface.
SampleAppReturnCode alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClient::run | ( | ) |
Processes user input until a quit command or a device reset is triggered.
SampleAppReturnCode
. void alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClient::sendCompleteAuthorizationMessage | ( | const std::string & | url, |
const std::string & | code, | ||
const std::string & | clientId | ||
) |
Provides the IPC Client with information to complete CBL based authorization.
url | The url to use to complete CBL-based LWA authrorization. |
code | The CBL code to use to complete authorization. |
clientId | AVS Device Id. |
|
overridevirtual |
Send call state info.
callStateInfo | The call state info. Sends a GUI Message to the server. |
message | The message to be written. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClientInterface.
void alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClient::sendSetAlexaStateMessage | ( | const std::string & | state | ) |
Informs the IPC Client of changes in the state of the Alexa client connection.
state | Enumerated state of the Alexa client. |
void alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClient::sendSetAuthorizationStateMessage | ( | const std::string & | state | ) |
Informs the IPC Client of changes in Alexa Authorization status.
state | Enumerated authorization state. |
void alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClient::sendSetLocalesMessage | ( | const std::string & | localeStr | ) |
Informs the IPC Client of changes in supported locales for the SDK.
localeStr | The locale(s) for the device. In single-locale mode, contains one locale string. In multi-locale mode, the first string indicates the primary locale, and any other strings correspond to secondary locales. |
void alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClient::setAplClientBridge | ( | std::shared_ptr< AplClientBridge > | aplClientBridge, |
bool | aplVersionChanged | ||
) |
}
Sets the APL Client Bridge
aplClientBridge | The APL Client bridge |
aplVersionChanged | True if the APL Client version has changed from last run. |
void alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClient::setAPLRuntimePresentationAdapter | ( | const std::shared_ptr< APLRuntimePresentationAdapter > & | aplRuntimePresentationAdapter | ) |
Sets the APL Runtime adapter
aplRuntimePresentationAdapter | Shared pointer to APL runtime adapter |
|
overridevirtual |
Set a reference to a GUI Manager
guiManager | Client related operations. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClientInterface.
|
overridevirtual |
Informs the IPC Client of changes in supported locales for the SDK.
localeStr | The locale(s) for the device. In single-locale mode, contains one locale string. In multi-locale mode, the first string indicates the primary locale, and any other strings correspond to secondary locales. |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::gui::GUIClientInterface.
|
override |
|
override |
|
overridevirtual |
Start the implementation of the MessagingInterface
true
for success. False
otherwise. Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::MessagingServerInterface.
|
overridevirtual |
Stop the messaging implmentation
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::MessagingServerInterface.
|
overridevirtual |
Write a message into a sink
payload | an arbitrary string |
Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::MessagingInterface.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0