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::endpoints::EndpointBuilder Class Reference

#include <EndpointBuilder.h>

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

Public Types

using EndpointAttributes = avsCommon::avs::AVSDiscoveryEndpointAttributes
 
using EndpointIdentifier = avsCommon::sdkInterfaces::endpoints::EndpointIdentifier
 
using EndpointInterface = avsCommon::sdkInterfaces::endpoints::EndpointInterface
 
using CapabilityConfiguration = avsCommon::avs::CapabilityConfiguration
 
using DirectiveHandlerInterface = avsCommon::sdkInterfaces::DirectiveHandlerInterface
 

Public Member Functions

virtual ~EndpointBuilder ()
 
void finalizeAttributes ()
 
@c EndpointBuilderInterface methods.
EndpointBuilderwithDerivedEndpointId (const std::string &suffix) override
 
EndpointBuilderwithDeviceRegistration () override
 
EndpointBuilderwithEndpointId (const EndpointIdentifier &endpointId) override
 
EndpointBuilderwithFriendlyName (const std::string &friendlyName) override
 
EndpointBuilderwithDescription (const std::string &description) override
 
EndpointBuilderwithManufacturerName (const std::string &manufacturerName) override
 
EndpointBuilderwithDisplayCategory (const std::vector< std::string > &displayCategories) override
 
EndpointBuilderwithAdditionalAttributes (const std::string &manufacturer, const std::string &model, const std::string &serialNumber, const std::string &firmwareVersion, const std::string &softwareVersion, const std::string &customIdentifier) override
 
EndpointBuilderwithConnections (const std::vector< std::map< std::string, std::string >> &connections) override
 
EndpointBuilderwithCookies (const std::map< std::string, std::string > &cookies) override
 
EndpointBuilderwithPowerController (std::shared_ptr< avsCommon::sdkInterfaces::powerController::PowerControllerInterface > powerController, bool isProactivelyReported, bool isRetrievable) override
 
EndpointBuilderwithToggleController (std::shared_ptr< avsCommon::sdkInterfaces::toggleController::ToggleControllerInterface > toggleController, const std::string &instance, const avsCommon::sdkInterfaces::toggleController::ToggleControllerAttributes &toggleControllerAttributes, bool isProactivelyReported, bool isRetrievable, bool isNonControllable=false) override
 
EndpointBuilderwithEndpointCapabilitiesBuilder (const std::shared_ptr< avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesBuilderInterface > &endpointCapabilitiesBuilder) override
 
EndpointBuilderwithModeController (std::shared_ptr< avsCommon::sdkInterfaces::modeController::ModeControllerInterface > modeController, const std::string &instance, const avsCommon::sdkInterfaces::modeController::ModeControllerAttributes &modeControllerAttributes, bool isProactivelyReported, bool isRetrievable, bool isNonControllable=false) override
 
EndpointBuilderwithRangeController (std::shared_ptr< avsCommon::sdkInterfaces::rangeController::RangeControllerInterface > rangeController, const std::string &instance, const avsCommon::sdkInterfaces::rangeController::RangeControllerAttributes &rangeControllerAttributes, bool isProactivelyReported, bool isRetrievable, bool isNonControllable=false) override
 
EndpointBuilderwithCapability (const CapabilityConfiguration &configuration, std::shared_ptr< DirectiveHandlerInterface > directiveHandler) override
 
EndpointBuilderwithCapability (const std::shared_ptr< avsCommon::sdkInterfaces::CapabilityConfigurationInterface > &configurationInterface, std::shared_ptr< DirectiveHandlerInterface > directiveHandler) override
 
EndpointBuilderwithCapabilityConfiguration (const std::shared_ptr< avsCommon::sdkInterfaces::CapabilityConfigurationInterface > &configurationInterface) override
 
std::unique_ptr< EndpointInterfacebuild () override
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointBuilderInterface
virtual ~EndpointBuilderInterface ()=default
 
virtual EndpointBuilderInterfacewithEndpointCapabilitiesBuilder (const std::shared_ptr< avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesBuilderInterface > &endpointCapabilitiesBuilder)=0
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesRegistrarInterface
virtual ~EndpointCapabilitiesRegistrarInterface ()=default
 
virtual EndpointCapabilitiesRegistrarInterfacewithCapability (const std::shared_ptr< avsCommon::sdkInterfaces::CapabilityConfigurationInterface > &configurationInterface, std::shared_ptr< DirectiveHandlerInterface > directiveHandler)=0
 
virtual EndpointCapabilitiesRegistrarInterfacewithCapabilityConfiguration (const std::shared_ptr< avsCommon::sdkInterfaces::CapabilityConfigurationInterface > &configurationInterface)=0
 

Static Public Member Functions

static std::unique_ptr< EndpointBuildercreate (const std::shared_ptr< avsCommon::utils::DeviceInfo > &deviceInfo, const std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > &contextManager, const std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > &exceptionSender, const std::shared_ptr< capabilityAgents::alexa::AlexaInterfaceMessageSenderInternalInterface > &alexaMessageSender)
 
static std::unique_ptr< EndpointBuildercreate (const avsCommon::utils::DeviceInfo &deviceInfo, std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > contextManager, std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionSender, std::shared_ptr< capabilityAgents::alexa::AlexaInterfaceMessageSenderInternalInterface > alexaMessageSender)
 

Detailed Description

Interface for an endpoint builder.

For the default endpoint, use DefaultEndpointBuilder.

The builder is responsible for configuring and building an endpoint object. Once built, EndpointRegistrationManagerInterface should be used to register the endpoint with AVS for it to be ready to use.

Member Typedef Documentation

◆ CapabilityConfiguration

Alias to improve readability.

◆ DirectiveHandlerInterface

Alias to improve readability.

◆ EndpointAttributes

Alias to improve readability.

◆ EndpointIdentifier

Alias to improve readability.

◆ EndpointInterface

Alias to improve readability.

Constructor & Destructor Documentation

◆ ~EndpointBuilder()

virtual alexaClientSDK::endpoints::EndpointBuilder::~EndpointBuilder ( )
virtual

Destructor.

Member Function Documentation

◆ build()

std::unique_ptr<EndpointInterface> alexaClientSDK::endpoints::EndpointBuilder::build ( )
overridevirtual

Builds an endpoint with the configured properties / components.

Build will fail iff the format of any attribute is invalid or if a mandatory attribute is missing.

Returns
A unique endpoint if the build succeeds; otherwise, nullptr.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointBuilderInterface.

◆ create() [1/2]

static std::unique_ptr<EndpointBuilder> alexaClientSDK::endpoints::EndpointBuilder::create ( const std::shared_ptr< avsCommon::utils::DeviceInfo > &  deviceInfo,
const std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface > &  contextManager,
const std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > &  exceptionSender,
const std::shared_ptr< capabilityAgents::alexa::AlexaInterfaceMessageSenderInternalInterface > &  alexaMessageSender 
)
static

Creates an EndpointBuilder.

Parameters
deviceInfoStructure with information about the Alexa client device.
contextManagerObject used to retrieve the current state of an endpoint.
exceptionSenderObject used to send exceptions.
alexaInterfaceMessageSenderObject used to send AlexaInterface events.
Returns
A pointer to the new builder if it succeeds; otherwise, return nullptr.

◆ create() [2/2]

static std::unique_ptr<EndpointBuilder> alexaClientSDK::endpoints::EndpointBuilder::create ( const avsCommon::utils::DeviceInfo deviceInfo,
std::shared_ptr< avsCommon::sdkInterfaces::ContextManagerInterface contextManager,
std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface exceptionSender,
std::shared_ptr< capabilityAgents::alexa::AlexaInterfaceMessageSenderInternalInterface alexaMessageSender 
)
static

Creates an EndpointBuilder.

Deprecated:
Parameters
deviceInfoStructure with information about the Alexa client device.
contextManagerObject used to retrieve the current state of an endpoint.
exceptionSenderObject used to send exceptions.
alexaInterfaceMessageSenderObject used to send AlexaInterface events.
Returns
A pointer to the new builder if it succeeds; otherwise, return nullptr.

◆ finalizeAttributes()

void alexaClientSDK::endpoints::EndpointBuilder::finalizeAttributes ( )

Finalize attributes.

Once called, this builder will no longer allow endpoint attribute related configurations to be set. This allows applications to add more capabilities to the endpoint without changing its attributes.

◆ withAdditionalAttributes()

EndpointBuilder& alexaClientSDK::endpoints::EndpointBuilder::withAdditionalAttributes ( const std::string &  manufacturer,
const std::string &  model,
const std::string &  serialNumber,
const std::string &  firmwareVersion,
const std::string &  softwareVersion,
const std::string &  customIdentifier 
)
overridevirtual

Configures builder to set additional attributes that can be used to identify an endpoint.

Note
This will override any previous additional attributes configuration.
The builder will fail if any of the additional attributes params are invalid.
Parameters
manufacturerThe name of the manufacturer of the device.
modelThe name of the model of the device.
serialNumberThe serial number of the device.
firmwareVersionThe firmware version of the device.
softwareVersionThe software version of the device.
customIdentifierYour custom identifier for the device.
Returns
This builder which can be used to nest configuration function calls.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointBuilderInterface.

◆ withCapability() [1/2]

EndpointBuilder& alexaClientSDK::endpoints::EndpointBuilder::withCapability ( const CapabilityConfiguration configuration,
std::shared_ptr< DirectiveHandlerInterface directiveHandler 
)
overridevirtual

Adds a capability.

Parameters
configurationThe capability configuration.
directiveHandlerThe handler for the directives in the given namespace.
Returns
This registrar which can be used to nest configuration function calls.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesRegistrarInterface.

◆ withCapability() [2/2]

EndpointBuilder& alexaClientSDK::endpoints::EndpointBuilder::withCapability ( const std::shared_ptr< avsCommon::sdkInterfaces::CapabilityConfigurationInterface > &  configurationInterface,
std::shared_ptr< DirectiveHandlerInterface directiveHandler 
)
override

◆ withCapabilityConfiguration()

EndpointBuilder& alexaClientSDK::endpoints::EndpointBuilder::withCapabilityConfiguration ( const std::shared_ptr< avsCommon::sdkInterfaces::CapabilityConfigurationInterface > &  configurationInterface)
override

◆ withConnections()

EndpointBuilder& alexaClientSDK::endpoints::EndpointBuilder::withConnections ( const std::vector< std::map< std::string, std::string >> &  connections)
overridevirtual

Configures builder to represent the methods that the endpoint uses to connect to the internet of smart home hub.

Note
This will override any previous connections configuration.
If the connections supplied is invalid, the builder will fail.
Parameters
connectionsThe available connection methods and their attributes.
Returns
This builder which can be used to nest configuration function calls.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointBuilderInterface.

◆ withCookies()

EndpointBuilder& alexaClientSDK::endpoints::EndpointBuilder::withCookies ( const std::map< std::string, std::string > &  cookies)
overridevirtual

Configures builder to store custom key value pair about the device.

Note
This will override any previous cookies configuration.
If the cookies supplied is invalid, the builder will fail.
Parameters
cookiesKey value pairs for additional of the endpoint.
Returns
This builder which can be used to nest configuration function calls.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointBuilderInterface.

◆ withDerivedEndpointId()

EndpointBuilder& alexaClientSDK::endpoints::EndpointBuilder::withDerivedEndpointId ( const std::string &  suffix)
overridevirtual

Configures builder to use an endpointId that is generated using the default endpoint id and the given suffix.

Note
This will override any previous endpoint identifier configuration.
This function will use the suffix to generate a unique identifier for endpoints that represent a component of the same device the client is running on. For example, if your device has a screen, you can create an endpoint to control this screen and use "screen" as a suffix. The suffix must be unique for this client and it must be consistent for every client execution.
The suffix can contain letters or numbers, spaces, and the following special characters: _ - = # ; : ? @ & and it should not exceed 10 characters.
Warning
Do not use this function if endpoint being created can be controlled by different AVS clients. The endpoint identifier must be consistent for every endpoint independently from the client that is controlling it.
Parameters
suffixA suffix that should be unique for the given client. The build() function fails if it exceeds 10 characters. If the suffix is not unique, the newly-built endpoint will replace the previous endpoint which had the same suffix when registered.
Returns
This builder which can be used to nest configuration function calls.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointBuilderInterface.

◆ withDescription()

EndpointBuilder& alexaClientSDK::endpoints::EndpointBuilder::withDescription ( const std::string &  description)
overridevirtual

Configures builder to use the given description.

Note
This will override any previous description configuration.
This value can contain up to 128 characters.
The builder will fail if the description param is invalid.
Parameters
descriptionThe description of the endpoint.
Returns
This builder which can be used to nest configuration function calls.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointBuilderInterface.

◆ withDeviceRegistration()

EndpointBuilder& alexaClientSDK::endpoints::EndpointBuilder::withDeviceRegistration ( )
overridevirtual

Includes default Registration information to the endpoint.

Note
This will include default endpoint's registration information into the endpoint. When this payload is included into the endpoint's discovery, cloud will be able to tell this endpoint represents the same device that the client is running on.
Warning
Do not use this function unless you want the new endpoint to be treated as same as the AVS endpoint that maintains HTTP2 connection. This function is added to support a legacy case and might be deprecated later. Please be aware of the risk while using this function.
Returns
This builder which can be used to nest configuration function calls.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointBuilderInterface.

◆ withDisplayCategory()

EndpointBuilder& alexaClientSDK::endpoints::EndpointBuilder::withDisplayCategory ( const std::vector< std::string > &  displayCategories)
overridevirtual

Configures builder to use the following display categories.

Note
This will override any previous display categories configuration.
The builder will fail if the displayCategories param is invalid.
Parameters
descriptionThe display category the device belongs to.
Returns
This builder which can be used to nest configuration function calls.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointBuilderInterface.

◆ withEndpointCapabilitiesBuilder()

EndpointBuilder& alexaClientSDK::endpoints::EndpointBuilder::withEndpointCapabilitiesBuilder ( const std::shared_ptr< avsCommon::sdkInterfaces::endpoints::EndpointCapabilitiesBuilderInterface > &  endpointCapabilitiesBuilder)
override

◆ withEndpointId()

EndpointBuilder& alexaClientSDK::endpoints::EndpointBuilder::withEndpointId ( const EndpointIdentifier endpointId)
overridevirtual

Configures builder to use the given identifier for the new endpoint.

Note
This will override any previous endpoint identifier configuration.
The identifier must be unique across all devices for the user. Registering an endpoint with the same identifier as an existing endpoint will replace the original endpoint. In addition, the identifier must be consistent for all discovery requests for the same device. An identifier can contain letters or numbers, spaces, and the following special characters: _ - = # ; : ? @ &. The identifier cannot exceed 256 characters.
The builder will fail if the endpointId param is invalid.
Parameters
endpointIdAn endpointId that identifies this endpoint.
Returns
This builder which can be used to nest configuration function calls.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointBuilderInterface.

◆ withFriendlyName()

EndpointBuilder& alexaClientSDK::endpoints::EndpointBuilder::withFriendlyName ( const std::string &  friendlyName)
overridevirtual

Configures builder to use the given friendly name.

Note
This will override any previous friendly name configuration.
This value can contain up to 128 characters.
Parameters
friendlyNameThe friendly name used to identify the endpoint.
Returns
This builder which can be used to nest configuration function calls.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointBuilderInterface.

◆ withManufacturerName()

EndpointBuilder& alexaClientSDK::endpoints::EndpointBuilder::withManufacturerName ( const std::string &  manufacturerName)
overridevirtual

Configures builder to use name of the device manufacturer representing the endpoint.

Note
This will override any previous manufacturer configuration.
This value can contain up to 128 characters.
The builder will fail if the manufacturer name param is invalid.
Parameters
descriptionThe manufacturer name of the device representing the endpoint.
Returns
This builder which can be used to nest configuration function calls.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointBuilderInterface.

◆ withModeController()

EndpointBuilder& alexaClientSDK::endpoints::EndpointBuilder::withModeController ( std::shared_ptr< avsCommon::sdkInterfaces::modeController::ModeControllerInterface modeController,
const std::string &  instance,
const avsCommon::sdkInterfaces::modeController::ModeControllerAttributes modeControllerAttributes,
bool  isProactivelyReported,
bool  isRetrievable,
bool  isNonControllable = false 
)
overridevirtual

Configures builder to use a ModeControllerInterface with instance identifier.

Note
The builder will fail if the instance name is already used in that endpoint.
Deprecated:
use the new withEndpointCapabilitiesBuilder() method instead.
Parameters
modeControllerAn interface that provides the mode operations.
instanceA non-empty string identifying an instance of a mode controller uniquely in a endpoint.
modeControllerAttributesThe attributes used in capability discovery message.
isProactivelyReportedWhether the property state change is proactively reported.
isRetrievableWhether the property state is retrievable.
isNonControllableWhether the property state can be controlled or not. This must be false for the property state to be controllable. Default is false.
Returns
This builder which can be used to nest configuration function calls.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointBuilderInterface.

◆ withPowerController()

EndpointBuilder& alexaClientSDK::endpoints::EndpointBuilder::withPowerController ( std::shared_ptr< avsCommon::sdkInterfaces::powerController::PowerControllerInterface powerController,
bool  isProactivelyReported,
bool  isRetrievable 
)
overridevirtual

Configures builder to use a PowerControllerInterface

Deprecated:
use the new withEndpointCapabilitiesBuilder() method instead.
Parameters
powerControllerAn interface that provides the power operations.
isProactivelyReportedWhether the property state change is proactively reported.
isRetrievableWhether the property state is retrievable.
Returns
This builder which can be used to nest configuration function calls.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointBuilderInterface.

◆ withRangeController()

EndpointBuilder& alexaClientSDK::endpoints::EndpointBuilder::withRangeController ( std::shared_ptr< avsCommon::sdkInterfaces::rangeController::RangeControllerInterface rangeController,
const std::string &  instance,
const avsCommon::sdkInterfaces::rangeController::RangeControllerAttributes rangeControllerAttributes,
bool  isProactivelyReported,
bool  isRetrievable,
bool  isNonControllable = false 
)
overridevirtual

Configures builder to use a RangeControllerInteface with instance identifier.

Note
The builder will fail if the instance name is already used in that endpoint.
Deprecated:
use the new withEndpointCapabilitiesBuilder() method instead.
Parameters
rangeControllerAn interface that provides the range operations.
instanceA non-empty string identifying an instance of a range controller uniquely in a endpoint.
rangeControllerAttributesThe attributes used in capability discovery message.
isProactivelyReportedWhether the property state change is proactively reported.
isRetrievableWhether the property state is retrievable.
isNonControllableWhether the property state can be controlled or not. This must be false for the property state to be controllable. Default is false.
Returns
This builder which can be used to nest configuration function calls.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointBuilderInterface.

◆ withToggleController()

EndpointBuilder& alexaClientSDK::endpoints::EndpointBuilder::withToggleController ( std::shared_ptr< avsCommon::sdkInterfaces::toggleController::ToggleControllerInterface toggleController,
const std::string &  instance,
const avsCommon::sdkInterfaces::toggleController::ToggleControllerAttributes toggleControllerAttributes,
bool  isProactivelyReported,
bool  isRetrievable,
bool  isNonControllable = false 
)
overridevirtual

Configures builder to use a ToggleControllerInterface with instance identifier.

Note
The builder will fail if the instance name is already used in that endpoint.
Deprecated:
use the new withEndpointCapabilitiesBuilder() method instead.
Parameters
toggleControllerAn interface that performs the toggle operations.
instanceA non-empty string identifying an instance of a toggle controller uniquely in a endpoint.
toggleControllerAttributesThe attributes used in capability discovery message.
isProactivelyReportedWhether the property state change is proactively reported.
isRetrievableWhether the property state is retrievable.
isNonControllableWhether the property state can be controlled or not. This must be false for the property state to be controllable. Default is false.
Returns
This builder which can be used to nest configuration function calls.

Implements alexaClientSDK::avsCommon::sdkInterfaces::endpoints::EndpointBuilderInterface.


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