Configurable SDKClient


The SDKClient consists of the SDKClientBuilder and the SDKClientRegistry. Together they provide a configurable method that enables you to add AVS Device SDK features to your device.

The AVS Device SDK provides a few feature clients to conveniently add functionality to your applications. The feature clients add functionality on top of the functionality provided by the DefaultClient. You can use the SDKClientBuilder to construct these features in an appropriate order and make them available in the SDKClientRegistry. The DefaultClient is provided as one of the feature clients.

Feature clients

Feature client Description Depends on
AlexaPresentationFeatureClient Provides support for APL directives through the use of Alexa.Presentation and Alexa.Presentation.APL components DefaultClient
PresentationOrchestratorFeatureClient Provides functionality to manage and track the lifecycle of presentations across multiple windows through the use of the PresentationOrchestrator, PresentationOrchestratorClient, and VisualTimeoutManager components VisualStateTrackerFeatureClient
VisualCharacteristicsFeatureClient Provides functionality to report the visual characteristics of a device through the use of the VisualCharacteristics and VisualCharacteristicsSerializer components DefaultClient
VisualStateTrackerFeatureClient (optional)
VisualStateTrackerFeatureClient Provides visual state tracking functionality through the use of the VisualActivityTracker and PresentationOrchestratorStateTracker components DefaultClient

The following example shows how the IPCServerSampleApp uses all these feature clients to create a Smart Screen Sample Application.

/*
 * Creating the various feature clients, which adds all the features that are used by the application.
 * The FeatureClientBuilder connects them together and builds a single client that can access them.
 */
sdkClient::SDKClientBuilder sdkClientBuilder;

/*
 * Creating the DefaultClient builder. This client builds most of the core functionality required by the
 * application.
 */
auto defaultClientBuilder = defaultClient::DefaultClientBuilder::create(...);
sdkClientBuilder.withFeature(std::move(defaultClientBuilder));

/**
 * Creating the VisualCharacteristicsFeatureClientBuilder, which adds visual characteristics features to the
 * application.
 */
auto visualCharacteristicsFeatureBuilder = featureClient::VisualCharacteristicsFeatureClientBuilder::create();
sdkClientBuilder.withFeature(std::move(visualCharacteristicsFeatureBuilder));

/**
 * Creating the VisualStateTrackerFeatureClientBuilder, which adds visual state tracking features to the
 * application.
 */
auto visualStateTrackerFeatureBuilder = featureClient::VisualStateTrackerFeatureClientBuilder::create();
sdkClientBuilder.withFeature(std::move(visualStateTrackerFeatureBuilder));

/**
 * Creating the PresentationOrchestratorFeatureClientBuilder, which adds presentation orchestrator features to
 * the application.
 */
auto presentationOrchestratorFeatureBuilder = featureClient::PresentationOrchestratorFeatureClientBuilder::create();
sdkClientBuilder.withFeature(std::move(presentationOrchestratorFeatureBuilder));

/**
 * Creating the AlexaPresentationFeatureClientBuilder, which adds APL features to the application.
 */
auto alexaPresentationFeatureBuilder =
    featureClient::AlexaPresentationFeatureClientBuilder::create(APLVersion, aplRuntimePresentationAdapter);
sdkClientBuilder.withFeature(std::move(alexaPresentationFeatureBuilder));

m_clientRegistry = sdkClientBuilder.build();
if (!m_clientRegistry) {
    ACSDK_CRITICAL(LX("Failed to build SDK Client!"));
    return false;
}

auto defaultClient = m_clientRegistry->get<defaultClient::DefaultClient>();
auto poFeatureClient = m_clientRegistry->get<featureClient::PresentationOrchestratorFeatureClient>();
auto aplFeatureClient = m_clientRegistry->get<featureClient::AlexaPresentationFeatureClient>();

Was this page helpful?

Last updated: Nov 30, 2022