#include <DavsHandler.h>
|
static std::shared_ptr< 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)) |
|
static std::string | parseFileFromLink (const std::string &url, const std::string &defaultValue) |
|
◆ ~DavsHandler()
alexaClientSDK::acsdkAssets::davs::DavsHandler::~DavsHandler |
( |
| ) |
|
|
override |
Destructor to terminate the thread.
◆ cancel()
void alexaClientSDK::acsdkAssets::davs::DavsHandler::cancel |
( |
| ) |
|
Cancel the current download/request and clean up.
◆ create()
Creates a Handler that will take care of the check and download requests from Davs.
- Parameters
-
artifactRequest | REQUIRED, a valid request containing information for the artifact to be downloaded. |
downloadCallback | REQUIRED, a listener that will handle what to do with the artifact when its downloaded or failed. |
checkCallback | REQUIRED, a listener that will handle checking if the artifact should be downloaded. |
baseBackOffTime | REQUIRED, the starting backoff time we should wait after a first-time failure |
maxBackOffTime | REQUIRED,the maximum value of back-off we can tolerate |
authDelegate | REQUIRED, the Authentication Delegate to generate the authentication token |
davsEndpointHandler | REQUIRED, the endpoint handler which is used to generate the proper DAVS request URL. |
powerResource | OPTIONAL, if provided, then the PowerResource will be used to acquire the wakelock |
forcedUpdateInterval | OPTIONAL, 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! |
- Returns
- a smart pointer to Davs Handler.
◆ enableUpdate()
void alexaClientSDK::acsdkAssets::davs::DavsHandler::enableUpdate |
( |
bool |
enable | ) |
|
|
inline |
Enables or disables checking for updates when the artifact's TTL is done.
- Parameters
-
enable | whether 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
- Parameters
-
prevBackOffTime | the backoff time resulting in current failure |
- Returns
◆ getDavsRequest()
◆ isRelevant()
bool alexaClientSDK::acsdkAssets::davs::DavsHandler::isRelevant |
( |
| ) |
|
|
inline |
- Returns
- if the listeners are still alive.
◆ isThrottled()
bool alexaClientSDK::acsdkAssets::davs::DavsHandler::isThrottled |
( |
| ) |
const |
◆ isUpdateEnabled()
bool alexaClientSDK::acsdkAssets::davs::DavsHandler::isUpdateEnabled |
( |
| ) |
|
|
inline |
If an artifact enabled download to perform update
- Parameters
-
◆ parseFileFromLink()
static std::string alexaClientSDK::acsdkAssets::davs::DavsHandler::parseFileFromLink |
( |
const std::string & |
url, |
|
|
const std::string & |
defaultValue |
|
) |
| |
|
static |
Takes an link and attempts to parse out the file name being provided.
- Parameters
-
url | to be parsed. |
defaultValue | that will be returned if the parsing fails. |
- Returns
- 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.
- Parameters
-
isUserInitiated | whether 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 | ) |
|
|
inline |
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:
- /workplace/avs-device-sdk/capabilities/DavsClient/acsdkDavsClient/include/acsdkDavsClient/DavsHandler.h
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0