AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <TestableAttachmentManager.h>
Public Member Functions | |
TestableAttachmentManager () | |
std::string | generateAttachmentId (const std::string &contextId, const std::string &contentId) const override |
bool | setAttachmentTimeoutMinutes (std::chrono::minutes timeoutMinutes) override |
std::unique_ptr< avsCommon::avs::attachment::AttachmentWriter > | createWriter (const std::string &attachmentId, avsCommon::utils::sds::WriterPolicy policy) override |
std::unique_ptr< avsCommon::avs::attachment::AttachmentReader > | createReader (const std::string &attachmentId, avsCommon::utils::sds::ReaderPolicy policy) override |
Public Member Functions inherited from alexaClientSDK::avsCommon::avs::attachment::AttachmentManager | |
AttachmentManager (AttachmentType attachmentType) | |
Public Member Functions inherited from alexaClientSDK::avsCommon::avs::attachment::AttachmentManagerInterface | |
virtual | ~AttachmentManagerInterface ()=default |
Additional Inherited Members | |
Public Types inherited from alexaClientSDK::avsCommon::avs::attachment::AttachmentManager | |
enum | AttachmentType { AttachmentType::IN_PROCESS } |
Static Public Member Functions inherited from alexaClientSDK::avsCommon::avs::attachment::AttachmentManager | |
static std::shared_ptr< AttachmentManagerInterface > | createInProcessAttachmentManagerInterface () |
Static Public Attributes inherited from alexaClientSDK::avsCommon::avs::attachment::AttachmentManager | |
static constexpr std::chrono::minutes | ATTACHMENT_MANAGER_TIMOUT_MINUTES_DEFAULT = std::chrono::hours(12) |
static constexpr std::chrono::minutes | ATTACHMENT_MANAGER_TIMOUT_MINUTES_MINIMUM = std::chrono::minutes(1) |
A version of the Decorator Pattern, this class allows us to return a special AttachmentWriter class to calling code, while routing all other functionality to a normal encapsulated AttachmentManager object.
alexaClientSDK::avsCommon::utils::TestableAttachmentManager::TestableAttachmentManager | ( | ) |
Constructor.
|
overridevirtual |
Returns a pointer to an AttachmentReader
.
createReader
and createWriter
may occur in any order.attachmentId | The id of the Attachment . |
policy | The AttachmentReader policy, which determines the semantics of the AttachmentReader.read() . |
AttachmentReader
. Reimplemented from alexaClientSDK::avsCommon::avs::attachment::AttachmentManager.
|
overridevirtual |
Returns a pointer to an AttachmentWriter
.
createReader
and createWriter
may occur in any order.attachmentId | The id of the Attachment . |
policy | The WriterPolicy that the AttachmentWriter should adhere to. |
AttachmentWriter
. Reimplemented from alexaClientSDK::avsCommon::avs::attachment::AttachmentManager.
|
overridevirtual |
Creates an attachmentId given two particular strings
- the contextId and the contentId. Generally, contextId allows disambiguation when two attachment contentIds are not guaranteed to be unique. This function provides a consistent way for different parts of application code to combine contextId and contentId into a single string. Clearly, both the reader and writer of a given attachment need to call this function with the same two strings.
As an example of usage, if an application has several sources of attachments, for example two audio providers, then one pair of contextId / contentId strings might be: { "AudioProvider1", "Attachment1" }. If the other audio provider creates an attachment, then the pair: { "AudioProvider2", "Attachment1" } allows the contextId to disambiguate what happens to be identical contentIds.
If this function is called with one or both strings being empty, then the combine will not be performed. In the case of both strings being empty, an empty string will be returned. If only one string is non-empty, then that string will be returned.
contextId | The contextId, which generally reflects the source of the Attachment . |
contentId | The contentId, which is considered unique when paired with a particular contextId. |
Reimplemented from alexaClientSDK::avsCommon::avs::attachment::AttachmentManager.
|
overridevirtual |
Sets the timeout parameter which is used to ensure unused attachments are eventually cleaned up. This time is specified in minutes. An unused attachment is defined as an attachment for which only a reader or writer was created. Such an Attachment is waiting to be either produced or consumed.
If this function is not called, then the timeout is set to a default value specified by the implementation.
The timeout cannot be set lower than an implementation specific minimum, since too low a timeout could cause attachments to be removed before both reader and writer have had time to request it.
timeoutMinutes | The timeout, expressed in minutes. If this is less than the minimum, then the setting will not be updated, and the function will return false. |
Reimplemented from alexaClientSDK::avsCommon::avs::attachment::AttachmentManager.
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0