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::acsdkAssets::davs::DavsHandler Class Reference

#include <DavsHandler.h>

Inheritance diagram for alexaClientSDK::acsdkAssets::davs::DavsHandler:
Inheritance graph
Collaboration diagram for alexaClientSDK::acsdkAssets::davs::DavsHandler:
Collaboration graph

Public Member Functions

 ~DavsHandler () override
bool isRelevant ()
void requestAndDownload (bool isUserInitiated)
void cancel ()
void enableUpdate (bool enable)
bool isUpdateEnabled ()
std::shared_ptr< commonInterfaces::DavsRequestgetDavsRequest ()
void setFirstBackOff (std::chrono::milliseconds firstBackOffTime)
std::chrono::milliseconds getBackOffTime (std::chrono::milliseconds prevBackOffTime)
bool isThrottled () const
void setThrottled (bool throttle)
void setConnectionState (bool connected)
- Public Member Functions inherited from alexaClientSDK::acsdkAssets::common::CurlProgressCallbackInterface
virtual ~CurlProgressCallbackInterface ()=default

Static Public Member Functions

static std::shared_ptr< DavsHandlercreate (std::shared_ptr< commonInterfaces::DavsRequest > artifactRequest, const std::shared_ptr< davsInterfaces::DavsDownloadCallbackInterface > &downloadRequester, const std::shared_ptr< davsInterfaces::DavsCheckCallbackInterface > &checkRequester, std::string workingDirectory, std::chrono::milliseconds baseBackOffTime, std::chrono::milliseconds maxBackOffTime, std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::AuthDelegateInterface > authDelegate, std::shared_ptr< davsInterfaces::DavsEndpointHandlerInterface > davsEndpointHandler, std::shared_ptr< alexaClientSDK::avsCommon::utils::power::PowerResource > powerResource=nullptr, std::chrono::seconds forcedUpdateInterval=std::chrono::seconds(0))
static std::string parseFileFromLink (const std::string &url, const std::string &defaultValue)

Constructor & Destructor Documentation

◆ ~DavsHandler()

alexaClientSDK::acsdkAssets::davs::DavsHandler::~DavsHandler ( )

Destructor to terminate the thread.

Member Function Documentation

◆ cancel()

void alexaClientSDK::acsdkAssets::davs::DavsHandler::cancel ( )

Cancel the current download/request and clean up.

◆ create()

static std::shared_ptr<DavsHandler> alexaClientSDK::acsdkAssets::davs::DavsHandler::create ( std::shared_ptr< commonInterfaces::DavsRequest artifactRequest,
const std::shared_ptr< davsInterfaces::DavsDownloadCallbackInterface > &  downloadRequester,
const std::shared_ptr< davsInterfaces::DavsCheckCallbackInterface > &  checkRequester,
std::string  workingDirectory,
std::chrono::milliseconds  baseBackOffTime,
std::chrono::milliseconds  maxBackOffTime,
std::shared_ptr< alexaClientSDK::avsCommon::sdkInterfaces::AuthDelegateInterface authDelegate,
std::shared_ptr< davsInterfaces::DavsEndpointHandlerInterface davsEndpointHandler,
std::shared_ptr< alexaClientSDK::avsCommon::utils::power::PowerResource powerResource = nullptr,
std::chrono::seconds  forcedUpdateInterval = std::chrono::seconds(0) 

Creates a Handler that will take care of the check and download requests from Davs.

artifactRequestREQUIRED, a valid request containing information for the artifact to be downloaded.
downloadCallbackREQUIRED, a listener that will handle what to do with the artifact when its downloaded or failed.
checkCallbackREQUIRED, a listener that will handle checking if the artifact should be downloaded.
baseBackOffTimeREQUIRED, the starting backoff time we should wait after a first-time failure
maxBackOffTimeREQUIRED,the maximum value of back-off we can tolerate
authDelegateREQUIRED, the Authentication Delegate to generate the authentication token
davsEndpointHandlerREQUIRED, the endpoint handler which is used to generate the proper DAVS request URL.
powerResourceOPTIONAL, if provided, then the PowerResource will be used to acquire the wakelock
forcedUpdateIntervalOPTIONAL, sets the update interval for all artifact to a specific value. This is to be use only for testing! your devices will be throttled if used in production!
a smart pointer to Davs Handler.

◆ enableUpdate()

void alexaClientSDK::acsdkAssets::davs::DavsHandler::enableUpdate ( bool  enable)

Enables or disables checking for updates when the artifact's TTL is done.

enablewhether update is enabled when the artifact's TTL is done

◆ getBackOffTime()

std::chrono::milliseconds alexaClientSDK::acsdkAssets::davs::DavsHandler::getBackOffTime ( std::chrono::milliseconds  prevBackOffTime)

Gets an exponentially growing time to backoff before another download

prevBackOffTimethe backoff time resulting in current failure

◆ getDavsRequest()

std::shared_ptr<commonInterfaces::DavsRequest> alexaClientSDK::acsdkAssets::davs::DavsHandler::getDavsRequest ( )

◆ isRelevant()

bool alexaClientSDK::acsdkAssets::davs::DavsHandler::isRelevant ( )
if the listeners are still alive.

◆ isThrottled()

bool alexaClientSDK::acsdkAssets::davs::DavsHandler::isThrottled ( ) const

◆ isUpdateEnabled()

bool alexaClientSDK::acsdkAssets::davs::DavsHandler::isUpdateEnabled ( )

If an artifact enabled download to perform update


◆ parseFileFromLink()

static std::string alexaClientSDK::acsdkAssets::davs::DavsHandler::parseFileFromLink ( const std::string &  url,
const std::string &  defaultValue 

Takes an link and attempts to parse out the file name being provided.

urlto be parsed.
defaultValuethat will be returned if the parsing fails.
filename if the parsing was successful, defaultValue otherwise.

◆ requestAndDownload()

void alexaClientSDK::acsdkAssets::davs::DavsHandler::requestAndDownload ( bool  isUserInitiated)

Performs a check and download operation to get and store the artifact.

isUserInitiatedwhether download is initiated by user, throttle or not

◆ setConnectionState()

void alexaClientSDK::acsdkAssets::davs::DavsHandler::setConnectionState ( bool  connected)

◆ setFirstBackOff()

void alexaClientSDK::acsdkAssets::davs::DavsHandler::setFirstBackOff ( std::chrono::milliseconds  firstBackOffTime)

If the first download needs to back off, set this. Otherwise its default is 0ms;

◆ setThrottled()

void alexaClientSDK::acsdkAssets::davs::DavsHandler::setThrottled ( bool  throttle)

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

AlexaClientSDK 3.0.0 - Copyright 2016-2022, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0