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

#include <EndpointRegistrationManager.h>

Inheritance diagram for alexaClientSDK::endpoints::EndpointRegistrationManager:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::endpoints::EndpointRegistrationManager:
Collaboration graph
[legend]

Public Types

Aliases to improve readability.
using EndpointIdentifier = avsCommon::sdkInterfaces::endpoints::EndpointIdentifier
 
using EndpointInterface = avsCommon::sdkInterfaces::endpoints::EndpointInterface
 
using EndpointModificationData = avsCommon::sdkInterfaces::endpoints::EndpointModificationData
 
using EndpointRegistrationObserverInterface = avsCommon::sdkInterfaces::endpoints::EndpointRegistrationObserverInterface
 
- Public Types inherited from alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointRegistrationManagerInterface
using RegistrationResult = EndpointRegistrationObserverInterface::RegistrationResult
 Aliases. More...
 
using DeregistrationResult = EndpointRegistrationObserverInterface::DeregistrationResult
 
using UpdateResult = EndpointRegistrationObserverInterface::UpdateResult
 

Public Member Functions

 ~EndpointRegistrationManager ()
 
void waitForPendingRegistrationsToEnqueue ()
 
@c EndpointRegistrationManagerInterface methods.
std::future< RegistrationResultregisterEndpoint (std::shared_ptr< EndpointInterface > endpoint) override
 
std::future< UpdateResultupdateEndpoint (const EndpointIdentifier &endpointId, const std::shared_ptr< EndpointModificationData > &endpointModificationData) override
 
std::future< DeregistrationResultderegisterEndpoint (const EndpointIdentifier &endpointId) override
 
void addObserver (std::shared_ptr< EndpointRegistrationObserverInterface > observer) override
 
void removeObserver (const std::shared_ptr< EndpointRegistrationObserverInterface > &observer) override
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointRegistrationManagerInterface
virtual ~EndpointRegistrationManagerInterface ()=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
 

Static Public Member Functions

static std::unique_ptr< EndpointRegistrationManagercreate (std::shared_ptr< avsCommon::sdkInterfaces::DirectiveSequencerInterface > directiveSequencer, std::shared_ptr< avsCommon::sdkInterfaces::CapabilitiesDelegateInterface > capabilitiesDelegate, const EndpointIdentifier &defaultEndpointId)
 

Protected Member Functions

@c RequiresShutdown methods.
void doShutdown () override
 

Detailed Description

Class responsible for managing endpoints that are registered with AVS and that can be controlled by this client.

Member Typedef Documentation

◆ EndpointIdentifier

◆ EndpointInterface

◆ EndpointModificationData

◆ EndpointRegistrationObserverInterface

Constructor & Destructor Documentation

◆ ~EndpointRegistrationManager()

alexaClientSDK::endpoints::EndpointRegistrationManager::~EndpointRegistrationManager ( )

Destructor.

Member Function Documentation

◆ addObserver()

void alexaClientSDK::endpoints::EndpointRegistrationManager::addObserver ( std::shared_ptr< EndpointRegistrationObserverInterface observer)
overridevirtual

Adds a registration manager observer to be notified when a registration has succeeded.

Parameters
observerThe observer to add.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointRegistrationManagerInterface.

◆ create()

std::unique_ptr< EndpointRegistrationManager > alexaClientSDK::endpoints::EndpointRegistrationManager::create ( std::shared_ptr< avsCommon::sdkInterfaces::DirectiveSequencerInterface directiveSequencer,
std::shared_ptr< avsCommon::sdkInterfaces::CapabilitiesDelegateInterface capabilitiesDelegate,
const EndpointIdentifier defaultEndpointId 
)
static

Create an EndpointRegistrationManager.

Parameters
directiveSequencerObject used to route directives sent to this device.
capabilitiesDelegateObject used to register an endpoint and its capabilities.
defaultEndpointIdThe EndpointIdentifier of the default endpoint.
Returns
A pointer to a new EndpointRegistrationManager if it succeeds; otherwise, return nullptr.

◆ deregisterEndpoint()

std::future< EndpointRegistrationManager::DeregistrationResult > alexaClientSDK::endpoints::EndpointRegistrationManager::deregisterEndpoint ( const EndpointIdentifier endpointId)
overridevirtual

Deregisters an endpoint.

Parameters
endpointThe EndpointIdentifier of the endpoint to be deregistered.
Returns
A future that is set to true when the endpoint has been deregistered, or that is set to false if the operation failed.
Note
This operation is asynchronous. You can also use EndpointRegistrationObserverInterface to get notified whenever the operation succeeds or fails.

Deleting the default endpoint is not permitted.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointRegistrationManagerInterface.

◆ doShutdown()

void alexaClientSDK::endpoints::EndpointRegistrationManager::doShutdown ( )
overrideprotectedvirtual

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.

Set promises for pending registrations and deregistrations.

Notify observers.

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

◆ registerEndpoint()

std::future< EndpointRegistrationManager::RegistrationResult > alexaClientSDK::endpoints::EndpointRegistrationManager::registerEndpoint ( std::shared_ptr< EndpointInterface endpoint)
overridevirtual

Registers an endpoint.

Note
endpointIds are unique. An endpoint is not allowed to be registered with an existing endpointId.
Parameters
endpointA pointer to the EndpointInterface to be registered.
Returns
A future that is set to true when the endpoint has been registered and enabled, or that is set to false if the operation failed.
Note
This operation is asynchronous. You can also use EndpointRegistrationObserverInterface to get notified whenever the operation succeeds or fails.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointRegistrationManagerInterface.

◆ removeObserver()

void alexaClientSDK::endpoints::EndpointRegistrationManager::removeObserver ( const std::shared_ptr< EndpointRegistrationObserverInterface > &  observer)
overridevirtual

Remove a previously registered observer.

Parameters
observerThe observer to be removed.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointRegistrationManagerInterface.

◆ updateEndpoint()

std::future< EndpointRegistrationManager::UpdateResult > alexaClientSDK::endpoints::EndpointRegistrationManager::updateEndpoint ( const EndpointIdentifier endpointId,
const std::shared_ptr< EndpointModificationData > &  endpointModificationData 
)
overridevirtual

Update an existing endpoint.

Parameters
endpointIdThe EndpointIdentifier of the endpoint to be updated.
endpointModificationDataA pointer to the EndpointModificationData used to update the endpoint.
Returns
A future that is set to true when the endpoint has been updated, or that is set to false if the operation failed.
Note
This operation is asynchronous. You can also use EndpointRegistrationObserverInterface to get notified whenever the operation succeeds or fails.
Warning
If the default endpoint fails to update due to the invalid endpointModificationData, the desync of capabilities between AVS and the device would happen. Applications should treat failure to update the default endpoint as a critical error.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointRegistrationManagerInterface.

◆ waitForPendingRegistrationsToEnqueue()

void alexaClientSDK::endpoints::EndpointRegistrationManager::waitForPendingRegistrationsToEnqueue ( )

Wait for all pending registrations and deregistrations to be enqueued for publishing.


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

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