AlexaClientSDK  1.25.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::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent Class Reference

#include <DoNotDisturbCapabilityAgent.h>

Inheritance diagram for alexaClientSDK::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent:
Collaboration graph
[legend]

Public Member Functions

 ~DoNotDisturbCapabilityAgent () override=default
 
std::shared_ptr< settings::DoNotDisturbSettinggetDoNotDisturbSetting () const
 
CapabilityAgent Functions
alexaClientSDK::avsCommon::avs::DirectiveHandlerConfiguration getConfiguration () const override
 
void handleDirectiveImmediately (std::shared_ptr< alexaClientSDK::avsCommon::avs::AVSDirective > directive) override
 
void preHandleDirective (std::shared_ptr< alexaClientSDK::avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
 
void handleDirective (std::shared_ptr< alexaClientSDK::avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
 
void cancelDirective (std::shared_ptr< alexaClientSDK::avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
 
CapabilityConfigurationInterface Functions
std::unordered_set< std::shared_ptr< alexaClientSDK::avsCommon::avs::CapabilityConfiguration > > getCapabilityConfigurations () override
 
void doShutdown () override
 
SettingEventSenderInterface Functions
std::shared_future< bool > sendChangedEvent (const std::string &value) override
 
std::shared_future< bool > sendReportEvent (const std::string &value) override
 
std::shared_future< bool > sendStateReportEvent (const std::string &payload) override
 
void cancel () override
 
ConnectionStatusObserverInterface Functions
void onConnectionStatusChanged (const Status status, const ChangedReason reason) override
 
- 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 handleDirectiveImmediately (std::shared_ptr< avsCommon::avs::AVSDirective > directive)=0
 
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::NamespaceAndName &stateProviderName, const ContextRequestToken stateRequestToken)
 
virtual void provideState (const avs::CapabilityTag &stateProviderName, const ContextRequestToken stateRequestToken)
 
virtual bool canStateBeRetrieved ()
 
virtual bool hasReportableStateProperties ()
 
- 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::sdkInterfaces::ConnectionStatusObserverInterface
virtual ~ConnectionStatusObserverInterface ()=default
 
virtual void onConnectionStatusChanged (const Status status, const std::vector< EngineConnectionStatus > &engineStatuses)
 
- 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::settings::SettingEventSenderInterface
virtual ~SettingEventSenderInterface ()=default
 

Static Public Member Functions

static std::shared_ptr< DoNotDisturbCapabilityAgentcreateDoNotDisturbCapabilityAgent (const std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::MessageSenderInterface > &messageSender, const std::shared_ptr< alexaClientSDK::settings::storage::DeviceSettingStorageInterface > &settingsStorage, const std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > &exceptionSender, const std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > &shutdownNotifier, const acsdkManufactory::Annotated< alexaClientSDK::avsCommon::sdkInterfaces::endpoints::DefaultEndpointAnnotation, alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesRegistrarInterface > &endpointCapabilitiesRegistrar, const std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::AVSConnectionManagerInterface > &connectionManager, const std::shared_ptr< alexaClientSDK::avsCommon::utils::metrics::MetricRecorderInterface > &metricRecorder)
 
static std::shared_ptr< DoNotDisturbCapabilityAgentcreate (std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionEncounteredSender, std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::MessageSenderInterface > messageSender, std::shared_ptr< settings::storage::DeviceSettingStorageInterface > settingsStorage)
 
static settings::SettingEventMetadata getDoNotDisturbEventsMetadata ()
 

Additional Inherited Members

- Public Types inherited from alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface
enum  Status { Status::DISCONNECTED, Status::PENDING, Status::CONNECTED }
 
enum  ChangedReason {
  ChangedReason::NONE, ChangedReason::SUCCESS, ChangedReason::UNRECOVERABLE_ERROR, ChangedReason::ACL_CLIENT_REQUEST,
  ChangedReason::ACL_DISABLED, ChangedReason::DNS_TIMEDOUT, ChangedReason::CONNECTION_TIMEDOUT, ChangedReason::CONNECTION_THROTTLED,
  ChangedReason::INVALID_AUTH, ChangedReason::PING_TIMEDOUT, ChangedReason::WRITE_TIMEDOUT, ChangedReason::READ_TIMEDOUT,
  ChangedReason::FAILURE_PROTOCOL_ERROR, ChangedReason::INTERNAL_ERROR, ChangedReason::SERVER_INTERNAL_ERROR, ChangedReason::SERVER_SIDE_DISCONNECT,
  ChangedReason::SERVER_ENDPOINT_CHANGED
}
 
- 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)
 
virtual void preHandleDirective (std::shared_ptr< DirectiveInfo > info)=0
 
virtual void handleDirective (std::shared_ptr< DirectiveInfo > info)=0
 
virtual void cancelDirective (std::shared_ptr< DirectiveInfo > info)=0
 
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

Capability Agent to handle Alexa.DoNotDisturb AVS Interface.

When DoNotDisturb mode is on AVS blocks some interactions from reaching the device so the customer won't be disturbed. Locally SDK provides only the way to get immediate state of the DND mode, track its changes coming from any source and update it making sure that it will be synchronized with AVS. No other customer experience is affected.

Constructor & Destructor Documentation

◆ ~DoNotDisturbCapabilityAgent()

alexaClientSDK::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent::~DoNotDisturbCapabilityAgent ( )
overridedefault

Destructor.

Member Function Documentation

◆ cancel()

void alexaClientSDK::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent::cancel ( )
overridevirtual

Cancels an ongoing event transmission to AVS.

Implements alexaClientSDK::settings::SettingEventSenderInterface.

◆ cancelDirective()

void alexaClientSDK::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent::cancelDirective ( std::shared_ptr< alexaClientSDK::avsCommon::avs::CapabilityAgent::DirectiveInfo info)
override

◆ create()

static std::shared_ptr<DoNotDisturbCapabilityAgent> alexaClientSDK::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent::create ( std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface exceptionEncounteredSender,
std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::MessageSenderInterface messageSender,
std::shared_ptr< settings::storage::DeviceSettingStorageInterface settingsStorage 
)
static

Factory method to create a capability agent instance.

Deprecated:
Use createDoNotDisturbCapabilityAgent
Parameters
exceptionEncounteredSenderInterface to report exceptions to AVS.
messageSenderInterface to send events to AVS.
settingsStorageThe storage interface that will be used to store device settings.
Returns
A new instance of DoNotDisturbCapabilityAgent on success, nullptr otherwise.

◆ createDoNotDisturbCapabilityAgent()

std::shared_ptr< DoNotDisturbCapabilityAgent > alexaClientSDK::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent::createDoNotDisturbCapabilityAgent ( const std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::MessageSenderInterface > &  messageSender,
const std::shared_ptr< alexaClientSDK::settings::storage::DeviceSettingStorageInterface > &  settingsStorage,
const std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > &  exceptionSender,
const std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > &  shutdownNotifier,
const acsdkManufactory::Annotated< alexaClientSDK::avsCommon::sdkInterfaces::endpoints::DefaultEndpointAnnotation, alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesRegistrarInterface > &  endpointCapabilitiesRegistrar,
const std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::AVSConnectionManagerInterface > &  connectionManager,
const std::shared_ptr< alexaClientSDK::avsCommon::utils::metrics::MetricRecorderInterface > &  metricRecorder 
)
static

Factory method to create a capability agent instance.

Parameters
messageSenderInterface to send events to AVS.
settingsStorageThe storage interface that will be used to store device settings.
exceptionSenderThe object to use for sending AVS Exception messages.
shutdownNotifierThe object to notify this AudioPlayer when to shut down.
endpointCapabilitiesRegistrarThe object with which to register this AudioPlayer's capabilities for the default endpoint.
connectionManagerThe object to notify this CA of connection status changes.
metricRecorderThe MetricRecorderInterface instance to record metrics.
Returns
A new instance of DoNotDisturbCapabilityAgent on success, nullptr otherwise.

◆ doShutdown()

void alexaClientSDK::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent::doShutdown ( )
overridevirtual

Prepares/enables this object to be deleted. This should be the last function called on this object prior to deleting (or resetting) its shared_ptr.

Warning
  • Attempting to call functions on this object after calling shutdown() can result in undefined behavior.
  • Neglecting to call shutdown() on this object can result in resource leaks or other undefined behavior.

Implements alexaClientSDK::avsCommon::utils::RequiresShutdown.

◆ getCapabilityConfigurations()

std::unordered_set< std::shared_ptr< avsCommon::avs::CapabilityConfiguration > > alexaClientSDK::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent::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::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent::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.

◆ getDoNotDisturbEventsMetadata()

settings::SettingEventMetadata alexaClientSDK::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent::getDoNotDisturbEventsMetadata ( )
static

Gets the do not disturb events metadata.

Returns
The do not disturb events metadata.

◆ getDoNotDisturbSetting()

std::shared_ptr< settings::DoNotDisturbSetting > alexaClientSDK::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent::getDoNotDisturbSetting ( ) const

Get DND Setting.

Todo:
ACSDK-2279: Change DND to use a setting protocol. For now, expose the setting.

◆ handleDirective()

void alexaClientSDK::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent::handleDirective ( std::shared_ptr< alexaClientSDK::avsCommon::avs::CapabilityAgent::DirectiveInfo info)
override

◆ handleDirectiveImmediately()

void alexaClientSDK::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent::handleDirectiveImmediately ( std::shared_ptr< alexaClientSDK::avsCommon::avs::AVSDirective directive)
override

◆ onConnectionStatusChanged()

void alexaClientSDK::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent::onConnectionStatusChanged ( const Status  status,
const ChangedReason  reason 
)
overridevirtual

Called when the AVS connection state changes.

Parameters
statusThe current connection status.
reasonThe reason the status change occurred.

Implements alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface.

◆ preHandleDirective()

void alexaClientSDK::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent::preHandleDirective ( std::shared_ptr< alexaClientSDK::avsCommon::avs::CapabilityAgent::DirectiveInfo info)
override

◆ sendChangedEvent()

std::shared_future< bool > alexaClientSDK::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent::sendChangedEvent ( const std::string &  value)
overridevirtual

Sends a setting changed event to AVS. This event follows the format:

{
"event": {
"header": {
"namespace": "{eventNamespace}",
"name": "{eventChangedName}",
"messageId": "xxxxx"
},
"payload": {
"{settingName}": yyyyy
}
}
}

The setting specific fields should be specified in a SettingEventMetadata passed as an argument on creation this object.

Parameters
valueThe value of the setting. It should be a valid JSON string value.
Returns
A future expressing if the event has been guaranteed to be sent to AVS.

Implements alexaClientSDK::settings::SettingEventSenderInterface.

◆ sendReportEvent()

std::shared_future< bool > alexaClientSDK::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent::sendReportEvent ( const std::string &  value)
overridevirtual

Sends a report setting event to AVS.

The setting report event follows the format:

{
"event": {
"header": {
"namespace": "{eventNamespace}",
"name": "{eventReportName}",
"messageId": "xxxxx"
},
"payload": {
"{settingName}": yyyyy
}
}
}

The setting specific fields should be specified in a SettingEventMetadata passed as an argument on creation this object.

Parameters
valueThe value of the setting. It should be a valid JSON string value.
Returns
A future expressing if the event has been guaranteed to be sent to AVS.

Implements alexaClientSDK::settings::SettingEventSenderInterface.

◆ sendStateReportEvent()

std::shared_future< bool > alexaClientSDK::capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent::sendStateReportEvent ( const std::string &  payload)
overridevirtual

Sends a state report event to AVS.

The setting state report event follows the format:

{
"event": {
"header": {
"namespace": "{eventNamespace}",
"name": "{eventReportName}",
"messageId": "xxxxx"
},
"payload": {payload}
}
}

The setting specific fields should be specified in a SettingEventMetadata passed as an argument on creation this object.

Parameters
payloadThe report payload. It should be a valid JSON element.
Returns
A future expressing if the event has been guaranteed to be sent to AVS.

Implements alexaClientSDK::settings::SettingEventSenderInterface.


The documentation for this class was generated from the following files:

AlexaClientSDK 1.25.0 - Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0