![]() |
AlexaClientSDK
1.22.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <CapabilitiesDelegate.h>
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::CapabilitiesObserverInterface > observer) override |
void | removeCapabilitiesObserver (std::shared_ptr< avsCommon::sdkInterfaces::CapabilitiesObserverInterface > 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::PostConnectOperationInterface > | createPostConnectOperation () 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 |
![]() | |
virtual | ~CapabilitiesDelegateInterface ()=default |
virtual bool | addOrUpdateEndpoint (const avsCommon::avs::AVSDiscoveryEndpointAttributes &endpointAttributes, const std::vector< avsCommon::avs::CapabilityConfiguration > &capabilities)=0 |
virtual bool | deleteEndpoint (const avsCommon::avs::AVSDiscoveryEndpointAttributes &endpointAttributes, const std::vector< avsCommon::avs::CapabilityConfiguration > &capabilities)=0 |
![]() | |
virtual | ~AlexaEventProcessedObserverInterface ()=default |
![]() | |
virtual | ~AVSGatewayObserverInterface ()=default |
![]() | |
virtual | ~ConnectionStatusObserverInterface ()=default |
virtual void | onConnectionStatusChanged (const Status status, const std::vector< EngineConnectionStatus > &engineStatuses) |
![]() | |
RequiresShutdown (const std::string &name) | |
virtual | ~RequiresShutdown () |
Destructor. More... | |
const std::string & | name () const |
void | shutdown () |
bool | isShutdown () const |
![]() | |
virtual | ~PostConnectOperationProviderInterface ()=default |
![]() | |
virtual | ~DiscoveryStatusObserverInterface ()=default |
![]() | |
CustomerDataHandler (std::shared_ptr< CustomerDataManager > customerDataManager) | |
virtual | ~CustomerDataHandler () |
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.
|
overridevirtual |
Specify an object to observe changes to the state of this CapabilitiesDelegate. During the call to this setter the observers onCapabilitiesStateChange() method will be called back with the current capabilities state.
observer | The object to observe the state of this CapabilitiesDelegate. |
Implements alexaClientSDK::avsCommon::sdkInterfaces::CapabilitiesDelegateInterface.
|
override |
|
overridevirtual |
Reset any internal state that may be associated with a particular user.
Implements alexaClientSDK::registrationManager::CustomerDataHandler.
|
static |
Create an CapabilitiesDelegate.
authDelegate | The auth delegate instance needed for CapabilitiesDelegate. |
storage | The storage instance needed for CapabilitiesDelegate. |
customerDataManager | Object that will track the CustomerDataHandler. |
nullptr
.
|
static |
Create an instance of CapabilitiesDelegateInterface.
authDelegate | The auth delegate instance needed for CapabilitiesDelegate. |
storage | The storage instance needed for CapabilitiesDelegate. |
customerDataManager | Object that will track the CustomerDataHandler. |
providerRegistrar | Object with which to register the new instance as a post connect operation provider. |
shutdownNotifier | The object to register with to be notified when it is time to shut down. |
alexaEventProcessedNotifier | The object to register with to be notified of AlexaEventProcessed directives. |
nullptr
.
|
overridevirtual |
Creates a post connect operation instance.
PostConnectOperationInterface
. We track the original pending endpoints in order to notify observers of their registration, even if CapabilitiesDelegate does not need to actually send the events since they are already registered with AVS.
The endpoints that need to be sent to AVS.
If any endpoints were in-flight at the time of creating a post-connect operation, move them back to pending to be re-filtered and sent as part of the post-connect operation.
If the database is empty, send any cached endpoints as part of this post-connect operation.
If the stored endpoint is pending deletion, do not include it in the addOrUpdateReport.
If the registered endpoint does not have a pending change, add the stored configuration to the addOrUpdateReport. Otherwise, prefer the pending change as it's more recent.
Move endpoints from pending to in-flight, since they will now be sent.
Sometimes pending add/update endpoints do not need to be sent to AVS as they are already stored and registered with AVS. In this case, we should still notify observers that registration succeeded even though no Discovery event was sent. This logic is not required for pending delete endpoints, since calls to CapabilitiesDelegate.deleteEndpoint fail when the endpoint is not already cached with CapabilitiesDelegate.
Implements alexaClientSDK::avsCommon::sdkInterfaces::PostConnectOperationProviderInterface.
|
override |
|
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.
Implements alexaClientSDK::avsCommon::utils::RequiresShutdown.
|
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.
|
overridevirtual |
This function is called whenever an Alexa.EventProcessed directive is received.
eventCorrelationToken | The EventCorrelationToken string. |
Implements alexaClientSDK::avsCommon::sdkInterfaces::AlexaEventProcessedObserverInterface.
|
overridevirtual |
Observer method to be called when the AVS Gateway is changed.
avsGateway | The AVS Gateway the device should be connected to. |
Implements alexaClientSDK::avsCommon::sdkInterfaces::AVSGatewayObserverInterface.
|
overridevirtual |
Called when the AVS connection state changes.
status | The current connection status. |
reason | The reason the status change occurred. |
If newly connected, send Discovery events for any endpoints that may have been added or deleted during the post-connect stage.
Implements alexaClientSDK::avsCommon::sdkInterfaces::ConnectionStatusObserverInterface.
|
overridevirtual |
This method will be called when the discovery event has completed successfully.
PostConnectCapabilitiesPublisher
's execution thread and should return immediately.PostConnectCapabilitiesPublisher
to report the success state when ALL of the the discovery events are sent.addOrUpdateReportEndpoints | The map of addOrUpdateReport endpoints sent in the discovery events. |
deleteReportEndpoints | The map of deleteReport endpoints sent in the discovery events. |
Implements alexaClientSDK::capabilitiesDelegate::DiscoveryStatusObserverInterface.
|
overridevirtual |
This method will be called when the discovery event has failed.
status | The MessageRequestObserverInterface::Status indicating the HTTP error encountered. |
Implements alexaClientSDK::capabilitiesDelegate::DiscoveryStatusObserverInterface.
|
overridevirtual |
Remove an observer.
observer | The observer to remove. |
Implements alexaClientSDK::avsCommon::sdkInterfaces::CapabilitiesDelegateInterface.
void alexaClientSDK::capabilitiesDelegate::CapabilitiesDelegate::setDiscoveryEventSender | ( | const std::shared_ptr< DiscoveryEventSenderInterface > & | discoveryEventSender | ) |
Sets the event sender used to send Discovery events.
|
overridevirtual |
Set the message sender to use for sending Discovery events to AVS when connected.
messageSender | The message sender. |
Implements alexaClientSDK::avsCommon::sdkInterfaces::CapabilitiesDelegateInterface.
AlexaClientSDK 1.22.0 - Copyright 2016-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0