#include <NotificationsCapabilityAgent.h>
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.
◆ addObserver()
Adds a NotificationsObserver to the set of observers. This observer will be notified when a SetIndicator directive arrives.
- Parameters
-
observer | The observer to add. |
◆ cancelDirective()
void alexaClientSDK::capabilityAgents::notifications::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
-
info | The DirectiveInfo instance for the AVSDirective to process. |
Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.
◆ clearData()
void alexaClientSDK::capabilityAgents::notifications::NotificationsCapabilityAgent::clearData |
( |
| ) |
|
|
overridevirtual |
◆ create()
Creates a new NotificationsCapabilityAgent
instance.
- Parameters
-
notificationsStorage | The storage interface to the NotificationIndicator database. |
renderer | The instance of the NotificationRendererInterface used to play assets associated with notifications. |
contextManager | The AVS Context manager used to generate system context for events. |
exceptionSender | The object to use for sending AVS Exception messages. |
notificationsAudioFactory | The audio factory object to produce the default notification sound. |
observers | The set of observers that will be notified of IndicatorState changes. |
dataManager | A dataManager object that will track the CustomerDataHandler. |
metricRecorder | The metric recorder. |
- Returns
- A
std::shared_ptr
to the new NotificationsCapabilityAgent
instance.
◆ getCapabilityConfigurations()
◆ getConfiguration()
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.
◆ handleDirective()
void alexaClientSDK::capabilityAgents::notifications::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
-
info | The DirectiveInfo instance for the AVSDirective to process. |
Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.
◆ handleDirectiveImmediately()
void alexaClientSDK::capabilityAgents::notifications::NotificationsCapabilityAgent::handleDirectiveImmediately |
( |
std::shared_ptr< avsCommon::avs::AVSDirective > |
directive | ) |
|
|
override |
◆ onNotificationRenderingFinished()
void alexaClientSDK::capabilityAgents::notifications::NotificationsCapabilityAgent::onNotificationRenderingFinished |
( |
| ) |
|
|
overridevirtual |
◆ preHandleDirective()
void alexaClientSDK::capabilityAgents::notifications::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
-
info | The DirectiveInfo instance for the AVSDirective to process. |
Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.
◆ provideState()
void alexaClientSDK::capabilityAgents::notifications::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
-
stateProviderName | The name of the state provider. |
stateRequestToken | The token to use in the setState call. |
- Deprecated:
NamespaceAndName
is being deprecated. Use the CapabilityMessageIdentifier version instead.
Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::StateProviderInterface.
◆ removeObserver()
Removes a NotificationsObserver from the set of observers.
- Parameters
-
observer | The observer to remove. |
The documentation for this class was generated from the following files:
AlexaClientSDK 1.19.0 - Copyright 2016-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0