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

#include <NotificationsCapabilityAgent.h>

Inheritance diagram for alexaClientSDK::acsdkNotifications::NotificationsCapabilityAgent:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::acsdkNotifications::NotificationsCapabilityAgent:
Collaboration graph
[legend]

Public Member Functions

 ~NotificationsCapabilityAgent () override
 
std::shared_ptr< acsdkNotificationsInterfaces::NotificationsNotifierInterfacegetNotificationsNotifierInterface ()
 
void clearData () override
 
CapabilityAgent/DirectiveHandlerInterface Functions
void handleDirectiveImmediately (std::shared_ptr< avsCommon::avs::AVSDirective > directive) override
 
void preHandleDirective (std::shared_ptr< DirectiveInfo > info) override
 
void handleDirective (std::shared_ptr< DirectiveInfo > info) override
 
void cancelDirective (std::shared_ptr< DirectiveInfo > info) override
 
avsCommon::avs::DirectiveHandlerConfiguration getConfiguration () const override
 
StateProviderInterface Functions
void provideState (const avsCommon::avs::NamespaceAndName &stateProviderName, unsigned int stateRequestToken) override
 
NotificationRendererObserverInterface Functions
void onNotificationRenderingFinished () override
 
CapabilityConfigurationInterface Functions
std::unordered_set< std::shared_ptr< avsCommon::avs::CapabilityConfiguration > > getCapabilityConfigurations () override
 
- Public Member Functions inherited from alexaClientSDK::acsdkNotificationsInterfaces::NotificationRendererObserverInterface
virtual ~NotificationRendererObserverInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent
virtual ~CapabilityAgent ()=default
 
void preHandleDirective (std::shared_ptr< AVSDirective > directive, std::unique_ptr< sdkInterfaces::DirectiveHandlerResultInterface > result) override final
 
bool handleDirective (const std::string &messageId) override final
 
void cancelDirective (const std::string &messageId) override final
 
void onDeregistered () override
 
void onFocusChanged (FocusState newFocus, MixingBehavior behavior) override
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface
virtual ~DirectiveHandlerInterface ()=default
 
virtual void preHandleDirective (std::shared_ptr< avsCommon::avs::AVSDirective > directive, std::unique_ptr< DirectiveHandlerResultInterface > result)=0
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::ChannelObserverInterface
virtual ~ChannelObserverInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::StateProviderInterface
virtual ~StateProviderInterface ()=default
 
virtual void provideState (const avs::CapabilityTag &stateProviderName, const ContextRequestToken stateRequestToken)
 
virtual bool canStateBeRetrieved ()
 
virtual bool hasReportableStateProperties ()
 
virtual bool shouldQueryState ()
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::ContextRequesterInterface
virtual ~ContextRequesterInterface ()=default
 
virtual void onContextAvailable (const std::string &jsonContext)
 
virtual void onContextAvailable (const endpoints::EndpointIdentifier &endpointId, const avs::AVSContext &endpointContext, ContextRequestToken requestToken)
 
virtual void onContextFailure (const ContextRequestError error)
 
virtual void onContextFailure (const ContextRequestError error, ContextRequestToken token)
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::CapabilityConfigurationInterface
virtual ~CapabilityConfigurationInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::utils::RequiresShutdown
 RequiresShutdown (const std::string &name)
 
virtual ~RequiresShutdown ()
 Destructor. More...
 
const std::string & name () const
 
void shutdown ()
 
bool isShutdown () const
 
- Public Member Functions inherited from alexaClientSDK::registrationManager::CustomerDataHandler
 CustomerDataHandler (const std::shared_ptr< registrationManager::CustomerDataManagerInterface > &dataManager)
 
virtual ~CustomerDataHandler ()
 
- Public Member Functions inherited from alexaClientSDK::registrationManager::CustomerDataHandlerInterface
virtual ~CustomerDataHandlerInterface ()=default
 

Static Public Member Functions

static std::shared_ptr< NotificationsCapabilityAgentcreateNotificationsCapabilityAgent (const std::shared_ptr< acsdkNotificationsInterfaces::NotificationsStorageInterface > &notificationsStorage, const std::shared_ptr< acsdkNotificationsInterfaces::NotificationRendererInterface > &renderer, const std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > &contextManager, const std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > &exceptionSender, const std::shared_ptr< avsCommon::sdkInterfaces::audio::AudioFactoryInterface > &audioFactory, const std::shared_ptr< registrationManager::CustomerDataManagerInterface > &dataManager, const std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > &shutdownNotifier, acsdkManufactory::Annotated< avsCommon::sdkInterfaces::endpoints::DefaultEndpointAnnotation, avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesRegistrarInterface > endpointCapabilitiesRegistrar, const std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > &metricRecorder)
 
static std::shared_ptr< NotificationsCapabilityAgentcreate (std::shared_ptr< acsdkNotificationsInterfaces::NotificationsStorageInterface > notificationsStorage, std::shared_ptr< acsdkNotificationsInterfaces::NotificationRendererInterface > renderer, std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > contextManager, std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionSender, std::shared_ptr< avsCommon::sdkInterfaces::audio::NotificationsAudioFactoryInterface > notificationsAudioFactory, std::shared_ptr< registrationManager::CustomerDataManagerInterface > dataManager, std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > metricRecorder=nullptr)
 

Additional Inherited Members

- Protected Member Functions inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent
 CapabilityAgent (const std::string &nameSpace, std::shared_ptr< sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionEncounteredSender)
 
virtual std::shared_ptr< DirectiveInfocreateDirectiveInfo (std::shared_ptr< AVSDirective > directive, std::unique_ptr< sdkInterfaces::DirectiveHandlerResultInterface > result)
 
void removeDirective (const std::string &messageId)
 
void sendExceptionEncounteredAndReportFailed (std::shared_ptr< DirectiveInfo > info, const std::string &message, avsCommon::avs::ExceptionErrorType type=avsCommon::avs::ExceptionErrorType::INTERNAL_ERROR)
 
const std::pair< std::string, std::string > buildJsonEventString (const std::string &eventName, const std::string &dialogRequestIdString="", const std::string &payload="{}", const std::string &context="") const
 
- Protected Attributes inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent
const std::string m_namespace
 The namespace of the capability agent. More...
 
std::shared_ptr< sdkInterfaces::ExceptionEncounteredSenderInterfacem_exceptionEncounteredSender
 Object to use to send exceptionEncountered messages. More...
 

Detailed Description

This class implements the Notifications capability agent.

See also
https://developer.amazon.com/docs/alexa/alexa-voice-service/notifications.html
Note
For instances of this class to be cleaned up correctly, shutdown() must be called.
This class makes use of a global configuration to a database file, meaning that it is best used as a singleton.

Constructor & Destructor Documentation

◆ ~NotificationsCapabilityAgent()

alexaClientSDK::acsdkNotifications::NotificationsCapabilityAgent::~NotificationsCapabilityAgent ( )
override

Destructor.

Member Function Documentation

◆ cancelDirective()

void alexaClientSDK::acsdkNotifications::NotificationsCapabilityAgent::cancelDirective ( std::shared_ptr< DirectiveInfo info)
overridevirtual

Cancel an ongoing preHandleDirective() or handleDirective() operation for the AVSDirective in . Once this has been called the CapabilityAgent should not expect to receive further calls regarding this directive.

Note
The implementation of this method MUST be thread-safe.
The implementation of this method MUST return quickly. Failure to do so blocks the processing of subsequent AVSDirectives.
Parameters
infoThe DirectiveInfo instance for the AVSDirective to process.

Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.

◆ clearData()

void alexaClientSDK::acsdkNotifications::NotificationsCapabilityAgent::clearData ( )
overridevirtual

Clear all notifications saved in the device

Implements alexaClientSDK::registrationManager::CustomerDataHandlerInterface.

◆ create()

static std::shared_ptr<NotificationsCapabilityAgent> alexaClientSDK::acsdkNotifications::NotificationsCapabilityAgent::create ( std::shared_ptr< acsdkNotificationsInterfaces::NotificationsStorageInterface notificationsStorage,
std::shared_ptr< acsdkNotificationsInterfaces::NotificationRendererInterface renderer,
std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface contextManager,
std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface exceptionSender,
std::shared_ptr< avsCommon::sdkInterfaces::audio::NotificationsAudioFactoryInterface notificationsAudioFactory,
std::shared_ptr< registrationManager::CustomerDataManagerInterface dataManager,
std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface metricRecorder = nullptr 
)
static

Creates a new NotificationsCapabilityAgent instance

Note
This method does not depend on manufactory.
Parameters
notificationsStorageThe storage interface to the NotificationIndicator database.
rendererThe instance of the NotificationRendererInterface used to play assets associated with notifications.
contextManagerThe AVS Context manager used to generate system context for events.
exceptionSenderThe object to use for sending AVS Exception messages.
notificationsAudioFactoryThe audio factory object to produce the default notification sound.
dataManagerA dataManager object that will track the CustomerDataHandler.
metricRecorderThe metric recorder.
Returns
A std::shared_ptr to the new NotificationsCapabilityAgent instance.

◆ createNotificationsCapabilityAgent()

static std::shared_ptr<NotificationsCapabilityAgent> alexaClientSDK::acsdkNotifications::NotificationsCapabilityAgent::createNotificationsCapabilityAgent ( const std::shared_ptr< acsdkNotificationsInterfaces::NotificationsStorageInterface > &  notificationsStorage,
const std::shared_ptr< acsdkNotificationsInterfaces::NotificationRendererInterface > &  renderer,
const std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > &  contextManager,
const std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > &  exceptionSender,
const std::shared_ptr< avsCommon::sdkInterfaces::audio::AudioFactoryInterface > &  audioFactory,
const std::shared_ptr< registrationManager::CustomerDataManagerInterface > &  dataManager,
const std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > &  shutdownNotifier,
acsdkManufactory::Annotated< avsCommon::sdkInterfaces::endpoints::DefaultEndpointAnnotation, avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesRegistrarInterface endpointCapabilitiesRegistrar,
const std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > &  metricRecorder 
)
static

Creates a new NotificationsCapabilityAgent instance.

Parameters
notificationsStorageThe storage interface to the NotificationIndicator database.
rendererThe instance of the NotificationRendererInterface used to play assets associated with notifications.
contextManagerThe AVS Context manager used to generate system context for events.
exceptionSenderThe object to use for sending AVS Exception messages.
audioFactoryThe audio factory object to produce the default notification sound.
dataManagerA dataManager object that will track the CustomerDataHandler.
shutdownNotifierThe object with which to register to know when it is time to shut down.
endpointCapabilitiesRegistrarThe object with which to register this agent's capabilities with the default endpoint.
metricRecorderThe metric recorder.
Returns
A std::shared_ptr to the new instance of NotificationsCapabilityAgent.

◆ getCapabilityConfigurations()

std::unordered_set<std::shared_ptr<avsCommon::avs::CapabilityConfiguration> > alexaClientSDK::acsdkNotifications::NotificationsCapabilityAgent::getCapabilityConfigurations ( )
overridevirtual

Returns the configurations of the capability interfaces being implemented.

Returns
A set of CapabilityConfigurations

Implements alexaClientSDK::avsCommon::sdkInterfaces::CapabilityConfigurationInterface.

◆ getConfiguration()

avsCommon::avs::DirectiveHandlerConfiguration alexaClientSDK::acsdkNotifications::NotificationsCapabilityAgent::getConfiguration ( ) const
overridevirtual

Returns the configuration of the directive handler.

The configuration consists of multiple directive routing rules and their respective blocking policy. The directives will be matched from the most specific rule (with all fields defined) to the least specific rule (which only matches the directive endpointId).

Returns
The avs::DirectiveHandlerConfiguration of the handler.

Implements alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface.

◆ getNotificationsNotifierInterface()

std::shared_ptr<acsdkNotificationsInterfaces::NotificationsNotifierInterface> alexaClientSDK::acsdkNotifications::NotificationsCapabilityAgent::getNotificationsNotifierInterface ( )

Gets the NotificationsNotifierInterface that can relay notification changes to observers.

Returns
The NotificationsNotifierInterface that this capability agent will notify.

◆ handleDirective()

void alexaClientSDK::acsdkNotifications::NotificationsCapabilityAgent::handleDirective ( std::shared_ptr< DirectiveInfo info)
overridevirtual

Handle the action specified by the AVSDirective in info. The handling of subsequent directives with the same DialogRequestId may be blocked until the DirectiveHandler calls the setSucceeded() method of the DirectiveHandlingResult present in info. If handling of this directive fails setFailed() should be called to indicate a failure.

Note
The implementation of this method MUST be thread-safe.
The implementation of this method MUST return quickly. Failure to do so blocks the processing of subsequent AVSDirectives.
Parameters
infoThe DirectiveInfo instance for the AVSDirective to process.

Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.

◆ handleDirectiveImmediately()

void alexaClientSDK::acsdkNotifications::NotificationsCapabilityAgent::handleDirectiveImmediately ( std::shared_ptr< avsCommon::avs::AVSDirective directive)
overridevirtual

Handle the action specified AVSDirective. Once this has been called the DirectiveHandler should not expect to receive further calls regarding this directive.

Note
The implementation of this method MUST be thread-safe.
The implementation of this method MUST return quickly. Failure to do so blocks the processing of subsequent AVSDirectives.
If this operation fails, an ExceptionEncountered message should be sent to AVS.
Parameters
directiveThe directive to handle.

Implements alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface.

◆ onNotificationRenderingFinished()

void alexaClientSDK::acsdkNotifications::NotificationsCapabilityAgent::onNotificationRenderingFinished ( )
overridevirtual

This function sets off logic to handle a Notification having been completely rendered.

Implements alexaClientSDK::acsdkNotificationsInterfaces::NotificationRendererObserverInterface.

◆ preHandleDirective()

void alexaClientSDK::acsdkNotifications::NotificationsCapabilityAgent::preHandleDirective ( std::shared_ptr< DirectiveInfo info)
overridevirtual

Notification that a directive has arrived. This notification gives the DirectiveHandler a chance to prepare for handling of an AVSDirective. If an error occurs during the pre-Handling phase and that error should cancel the handling of subsequent AVSDirectives with the same DialogRequestId, the DirectiveHandler should call the setFailed method on the result instance passed in to this call.

Note
The implementation of this method MUST be thread-safe.
The implementation of this method MUST return quickly. Failure to do so blocks the processing of subsequent AVSDirectives.
Parameters
infoThe DirectiveInfo instance for the AVSDirective to process.

Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.

◆ provideState()

void alexaClientSDK::acsdkNotifications::NotificationsCapabilityAgent::provideState ( const avsCommon::avs::NamespaceAndName stateProviderName,
unsigned int  stateRequestToken 
)
overridevirtual

A request to a StateProvider to provide the state. The StateProvider should perform minimum processing and return quickly, otherwise it will block the processing of updating the states of other StateProviders. The ContextManager specifies a token which it uses to track the getContext request associated with this provideState request. The stateProviderInterface must use the same token when it updates its state via the setState call.

: The setState method MUST be called from a different thread from where the provideState method is being called from.

Parameters
stateProviderNameThe name of the state provider.
stateRequestTokenThe token to use in the setState call.
Deprecated:
NamespaceAndName is being deprecated. Use the CapabilityMessageIdentifier version instead.

Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::StateProviderInterface.


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