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::capabilitiesDelegate::CapabilitiesDelegate Class Reference

#include <CapabilitiesDelegate.h>

Inheritance diagram for alexaClientSDK::capabilitiesDelegate::CapabilitiesDelegate:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::capabilitiesDelegate::CapabilitiesDelegate:
Collaboration graph
[legend]

Public Member Functions

void setDiscoveryEventSender (const std::shared_ptr< DiscoveryEventSenderInterface > &discoveryEventSender)
 
CapabilitiesDelegateInterface method overrides.
bool addOrUpdateEndpoint (const avsCommon::avs::AVSDiscoveryEndpointAttributes &endpointAttributes, const std::vector< avsCommon::avs::CapabilityConfiguration > &capabilities) override
 
bool deleteEndpoint (const avsCommon::avs::AVSDiscoveryEndpointAttributes &endpointAttributes, const std::vector< avsCommon::avs::CapabilityConfiguration > &capabilities) override
 
void addCapabilitiesObserver (std::shared_ptr< avsCommon::sdkInterfaces::CapabilitiesDelegateObserverInterface > observer) override
 
void removeCapabilitiesObserver (std::shared_ptr< avsCommon::sdkInterfaces::CapabilitiesDelegateObserverInterface > observer) override
 
void invalidateCapabilities () override
 
void setMessageSender (const std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > &messageSender) override
 
AlexaEventProcessedObserverInterface method overrides.
void onAlexaEventProcessedReceived (const std::string &eventCorrelationToken) override
 
RequiresShutdown Functions
void doShutdown () override
 
PostConnectOperationInterfaceProvider Functions.
std::shared_ptr< avsCommon::sdkInterfaces::PostConnectOperationInterfacecreatePostConnectOperation () override
 
DiscoveryObserverInterface methods
void onDiscoveryCompleted (const std::unordered_map< std::string, std::string > &addOrUpdateReportEndpoints, const std::unordered_map< std::string, std::string > &deleteReportEndpoints) override
 
void onDiscoveryFailure (avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status status) override
 
AVSGatewayManagerInterface methods
void onAVSGatewayChanged (const std::string &avsGateway) override
 
CustomerDataHandler Functions
void clearData () override
 
ConnectionStatusObserverInterface Functions
void onConnectionStatusChanged (const Status status, const ChangedReason reason) override
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::CapabilitiesDelegateInterface
virtual ~CapabilitiesDelegateInterface ()=default
 
virtual void addCapabilitiesObserver (std::shared_ptr< avsCommon::sdkInterfaces::CapabilitiesDelegateObserverInterface > observer)=0
 
virtual void removeCapabilitiesObserver (std::shared_ptr< avsCommon::sdkInterfaces::CapabilitiesDelegateObserverInterface > observer)=0
 
virtual void setMessageSender (const std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > &messageSender)=0
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::AlexaEventProcessedObserverInterface
virtual ~AlexaEventProcessedObserverInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::AVSGatewayObserverInterface
virtual ~AVSGatewayObserverInterface ()=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::avsCommon::sdkInterfaces::PostConnectOperationProviderInterface
virtual ~PostConnectOperationProviderInterface ()=default
 
- Public Member Functions inherited from alexaClientSDK::capabilitiesDelegate::DiscoveryStatusObserverInterface
virtual ~DiscoveryStatusObserverInterface ()=default
 
- 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< CapabilitiesDelegateInterface > createCapabilitiesDelegateInterface (const std::shared_ptr< avsCommon::sdkInterfaces::AuthDelegateInterface > &authDelegate, std::unique_ptr< storage::CapabilitiesDelegateStorageInterface > storage, const std::shared_ptr< registrationManager::CustomerDataManagerInterface > &customerDataManager, const std::shared_ptr< acsdkPostConnectOperationProviderRegistrarInterfaces::PostConnectOperationProviderRegistrarInterface > &providerRegistrar, const std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > &shutdownNotifier, const std::shared_ptr< acsdkAlexaEventProcessedNotifierInterfaces::AlexaEventProcessedNotifierInterface > &alexaEventProcessedNotifier, const std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > &metricRecorder=nullptr)
 
static std::shared_ptr< CapabilitiesDelegatecreate (const std::shared_ptr< avsCommon::sdkInterfaces::AuthDelegateInterface > &authDelegate, const std::shared_ptr< storage::CapabilitiesDelegateStorageInterface > &storage, const std::shared_ptr< registrationManager::CustomerDataManagerInterface > &customerDataManager, const std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > &metricRecorder=nullptr)
 

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
}
 

Detailed Description

CapabilitiesDelegate provides an implementation of the CapabilitiesDelegateInterface. It allows clients to register capabilities implemented by agents and publish them so that Alexa is aware of the device's capabilities.

While updating capabilities for an endpoint, the device will also send the cached capabilities of all endpoints that share the same registration information. Such endpoints are referred to as deduplicated endpoints.

Note
: The following restrictions apply to deduplicated endpoints:
  1. We can only have one set of deduplicated endpoints, and this set will include the default endpoint.
  2. All capabilities of the deduplicated endpoints will need to fit into one discovery event.
  3. Deleting a deduplicated endpoint is not permitted.

Member Function Documentation

◆ addCapabilitiesObserver()

void alexaClientSDK::capabilitiesDelegate::CapabilitiesDelegate::addCapabilitiesObserver ( std::shared_ptr< avsCommon::sdkInterfaces::CapabilitiesDelegateObserverInterface observer)
override

◆ addOrUpdateEndpoint()

bool alexaClientSDK::capabilitiesDelegate::CapabilitiesDelegate::addOrUpdateEndpoint ( const avsCommon::avs::AVSDiscoveryEndpointAttributes endpointAttributes,
const std::vector< avsCommon::avs::CapabilityConfiguration > &  capabilities 
)
overridevirtual

Updates an existing endpoint's capabilities or, if the endpoint does not already exist, registers a new endpoint.

Parameters
endpointAttributesThe EndpointAttributes for the registering endpoint.
capabilitiesThe array of CapabilityConfiguration the endpoint supports.
Returns
true if operation was successful, else false.
Note
This operation can fail at several stages before publishing the endpoint to AVS: if the capabilities are empty; if the attributes or capability configurations are invalid; if the endpoint is already pending deletion or registration. If this function returns true, the endpoint will be published to AVS. Callers can be notified of published endpoints using CapabilitiesDelegateObserverInterface.

Implements alexaClientSDK::avsCommon::sdkInterfaces::CapabilitiesDelegateInterface.

◆ clearData()

void alexaClientSDK::capabilitiesDelegate::CapabilitiesDelegate::clearData ( )
overridevirtual

Reset any internal state that may be associated with a particular user.

Warning
Object must succeed in deleting any customer data.
This method is called while CustomerDataManager is in a locked state. Do not call or wait for any CustomerDataManager operation.

Implements alexaClientSDK::registrationManager::CustomerDataHandlerInterface.

◆ create()

static std::shared_ptr<CapabilitiesDelegate> alexaClientSDK::capabilitiesDelegate::CapabilitiesDelegate::create ( const std::shared_ptr< avsCommon::sdkInterfaces::AuthDelegateInterface > &  authDelegate,
const std::shared_ptr< storage::CapabilitiesDelegateStorageInterface > &  storage,
const std::shared_ptr< registrationManager::CustomerDataManagerInterface > &  customerDataManager,
const std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > &  metricRecorder = nullptr 
)
static

Create an CapabilitiesDelegate.

Deprecated:
Parameters
authDelegateThe auth delegate instance needed for CapabilitiesDelegate.
storageThe storage instance needed for CapabilitiesDelegate.
customerDataManagerObject that will track the CustomerDataHandler.
Returns
If successful, returns a new CapabilitiesDelegate, otherwise nullptr.

◆ createCapabilitiesDelegateInterface()

static std::shared_ptr<CapabilitiesDelegateInterface> alexaClientSDK::capabilitiesDelegate::CapabilitiesDelegate::createCapabilitiesDelegateInterface ( const std::shared_ptr< avsCommon::sdkInterfaces::AuthDelegateInterface > &  authDelegate,
std::unique_ptr< storage::CapabilitiesDelegateStorageInterface storage,
const std::shared_ptr< registrationManager::CustomerDataManagerInterface > &  customerDataManager,
const std::shared_ptr< acsdkPostConnectOperationProviderRegistrarInterfaces::PostConnectOperationProviderRegistrarInterface > &  providerRegistrar,
const std::shared_ptr< acsdkShutdownManagerInterfaces::ShutdownNotifierInterface > &  shutdownNotifier,
const std::shared_ptr< acsdkAlexaEventProcessedNotifierInterfaces::AlexaEventProcessedNotifierInterface > &  alexaEventProcessedNotifier,
const std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > &  metricRecorder = nullptr 
)
static

Create an instance of CapabilitiesDelegateInterface.

Parameters
authDelegateThe auth delegate instance needed for CapabilitiesDelegate.
storageThe storage instance needed for CapabilitiesDelegate.
customerDataManagerObject that will track the CustomerDataHandler.
providerRegistrarObject with which to register the new instance as a post connect operation provider.
shutdownNotifierThe object to register with to be notified when it is time to shut down.
alexaEventProcessedNotifierThe object to register with to be notified of AlexaEventProcessed directives.
metricRecorderOptional reference to metric recorder.
Returns
If successful, returns a new CapabilitiesDelegate, otherwise nullptr.

◆ createPostConnectOperation()

std::shared_ptr<avsCommon::sdkInterfaces::PostConnectOperationInterface> alexaClientSDK::capabilitiesDelegate::CapabilitiesDelegate::createPostConnectOperation ( )
overridevirtual

Creates a post connect operation instance.

Returns
a new instance of the PostConnectOperationInterface.

Implements alexaClientSDK::avsCommon::sdkInterfaces::PostConnectOperationProviderInterface.

◆ deleteEndpoint()

bool alexaClientSDK::capabilitiesDelegate::CapabilitiesDelegate::deleteEndpoint ( const avsCommon::avs::AVSDiscoveryEndpointAttributes endpointAttributes,
const std::vector< avsCommon::avs::CapabilityConfiguration > &  capabilities 
)
overridevirtual

Deletes an existing endpoint.

Parameters
endpointAttributesThe EndpointAttributes for the deregistering endpoint.
capabilitiesThe array of CapabilityConfiguration the endpoint supports.
Returns
true if operation was successful, else false.
Note
This operation can fail at several stages before publishing the endpoint to AVS: if the endpoint is not registered; if the capabilities are empty; if the attributes or capability configurations are invalid; if the endpoint is already pending deletion or registration. If this function returns true, the endpoint will be deregistered from AVS. Callers can be notified of deregistered endpoints using CapabilitiesDelegateObserverInterface.

Implements alexaClientSDK::avsCommon::sdkInterfaces::CapabilitiesDelegateInterface.

◆ doShutdown()

void alexaClientSDK::capabilitiesDelegate::CapabilitiesDelegate::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.

◆ invalidateCapabilities()

void alexaClientSDK::capabilitiesDelegate::CapabilitiesDelegate::invalidateCapabilities ( )
overridevirtual

Invalidates the capabilities reported to the AVS last. Capabilities information should be rebuilt and reported to the AVS during the next synchronization.

Implements alexaClientSDK::avsCommon::sdkInterfaces::CapabilitiesDelegateInterface.

◆ onAlexaEventProcessedReceived()

void alexaClientSDK::capabilitiesDelegate::CapabilitiesDelegate::onAlexaEventProcessedReceived ( const std::string &  eventCorrelationToken)
overridevirtual

This function is called whenever an Alexa.EventProcessed directive is received.

Parameters
eventCorrelationTokenThe EventCorrelationToken string.

Implements alexaClientSDK::avsCommon::sdkInterfaces::AlexaEventProcessedObserverInterface.

◆ onAVSGatewayChanged()

void alexaClientSDK::capabilitiesDelegate::CapabilitiesDelegate::onAVSGatewayChanged ( const std::string &  avsGateway)
overridevirtual

Observer method to be called when the AVS Gateway is changed.

Parameters
avsGatewayThe AVS Gateway the device should be connected to.

Implements alexaClientSDK::avsCommon::sdkInterfaces::AVSGatewayObserverInterface.

◆ onConnectionStatusChanged()

void alexaClientSDK::capabilitiesDelegate::CapabilitiesDelegate::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.

◆ onDiscoveryCompleted()

void alexaClientSDK::capabilitiesDelegate::CapabilitiesDelegate::onDiscoveryCompleted ( const std::unordered_map< std::string, std::string > &  addOrUpdateReportEndpoints,
const std::unordered_map< std::string, std::string > &  deleteReportEndpoints 
)
overridevirtual

This method will be called when the discovery event has completed successfully.

Note
: This method will be called from PostConnectCapabilitiesPublisher 's execution thread and should return immediately.
: This method will be called by the PostConnectCapabilitiesPublisher to report the success state when ALL of the the discovery events are sent.
Parameters
addOrUpdateReportEndpointsThe map of addOrUpdateReport endpoints sent in the discovery events.
deleteReportEndpointsThe map of deleteReport endpoints sent in the discovery events.

Implements alexaClientSDK::capabilitiesDelegate::DiscoveryStatusObserverInterface.

◆ onDiscoveryFailure()

void alexaClientSDK::capabilitiesDelegate::CapabilitiesDelegate::onDiscoveryFailure ( avsCommon::sdkInterfaces::MessageRequestObserverInterface::Status  status)
overridevirtual

This method will be called when the discovery event has failed.

Parameters
statusThe MessageRequestObserverInterface::Status indicating the HTTP error encountered.

Implements alexaClientSDK::capabilitiesDelegate::DiscoveryStatusObserverInterface.

◆ removeCapabilitiesObserver()

void alexaClientSDK::capabilitiesDelegate::CapabilitiesDelegate::removeCapabilitiesObserver ( std::shared_ptr< avsCommon::sdkInterfaces::CapabilitiesDelegateObserverInterface observer)
override

◆ setDiscoveryEventSender()

void alexaClientSDK::capabilitiesDelegate::CapabilitiesDelegate::setDiscoveryEventSender ( const std::shared_ptr< DiscoveryEventSenderInterface > &  discoveryEventSender)

Sets the event sender used to send Discovery events.

◆ setMessageSender()

void alexaClientSDK::capabilitiesDelegate::CapabilitiesDelegate::setMessageSender ( const std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > &  messageSender)
override

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