AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
DavsRequester.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef ACSDKASSETMANAGER_SRC_DAVSREQUESTER_H_
17 #define ACSDKASSETMANAGER_SRC_DAVSREQUESTER_H_
18 
19 #include "Requester.h"
24 
25 namespace alexaClientSDK {
26 namespace acsdkAssets {
27 namespace manager {
28 
30  : public Requester
33 public:
37  ~DavsRequester() override {
38  m_davsClient->deregisterArtifact(m_davsRequestId);
39  };
40 
43  bool download() override;
44  bool validateWriteRequest(const std::string& name, int newValue) override;
46 
50  std::shared_ptr<commonInterfaces::VendableArtifact> availableArtifact,
51  size_t freeSpaceNeeded) override;
52  void onCheckFailure(commonInterfaces::ResultCode errorCode) override;
54 
57  void onStart() override;
59  std::shared_ptr<commonInterfaces::VendableArtifact> downloadedArtifact,
60  const std::string& path) override;
61  void onDownloadFailure(commonInterfaces::ResultCode errorCode) override;
62  void onProgressUpdate(int progress) override;
64 
65 private:
67  std::shared_ptr<StorageManager> storageManager,
68  std::shared_ptr<commonInterfaces::AmdCommunicationInterface> communicationHandler,
69  std::shared_ptr<RequesterMetadata> metadata,
70  const std::string& metadataFilePath,
71  std::shared_ptr<davsInterfaces::ArtifactHandlerInterface> davsClient) :
72  Requester(
73  std::move(storageManager),
74  std::move(communicationHandler),
75  std::move(metadata),
76  std::move(metadataFilePath)),
77  m_davsClient(std::move(davsClient)) {
78  }
81  size_t deleteAndCleanupLocked(std::unique_lock<std::mutex>& lock) override;
83 
85  void adjustAutoUpdateBasedOnPriority(commonInterfaces::Priority newPriority);
86 
87 private:
88  // DAVS Client that will be used to download/update the artifacts.
89  const std::shared_ptr<davsInterfaces::ArtifactHandlerInterface> m_davsClient;
90  // Request ID from DAVS Client after registration.
91  std::string m_davsRequestId;
92 
93  friend RequesterFactory;
94 };
95 
96 } // namespace manager
97 } // namespace acsdkAssets
98 } // namespace alexaClientSDK
99 
100 #endif // ACSDKASSETMANAGER_SRC_DAVSREQUESTER_H_
alexaClientSDK::acsdkAssets::davsInterfaces::DavsCheckCallbackInterface
Definition: DavsCheckCallbackInterface.h:26
alexaClientSDK::acsdkAssets::manager::DavsRequester::download
bool download() override
Definition: DavsRequester.cpp:48
alexaClientSDK::acsdkAssets::manager::DavsRequester::onStart
void onStart() override
Definition: DavsRequester.cpp:178
DavsDownloadCallbackInterface.h
Requester.h
alexaClientSDK::acsdkAssets::manager::DavsRequester::onArtifactDownloaded
void onArtifactDownloaded(std::shared_ptr< commonInterfaces::VendableArtifact > downloadedArtifact, const std::string &path) override
Definition: DavsRequester.cpp:188
alexaClientSDK::acsdkAssets::manager::DavsRequester::onDownloadFailure
void onDownloadFailure(commonInterfaces::ResultCode errorCode) override
Definition: DavsRequester.cpp:214
ArtifactHandlerInterface.h
alexaClientSDK
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
alexaClientSDK::acsdkAssets::manager::DavsRequester::onProgressUpdate
void onProgressUpdate(int progress) override
Definition: DavsRequester.cpp:221
DavsCheckCallbackInterface.h
alexaClientSDK::acsdkAssets::davsInterfaces::DavsDownloadCallbackInterface
Definition: DavsDownloadCallbackInterface.h:26
alexaClientSDK::acsdkAssets::manager::DavsRequester::validateWriteRequest
bool validateWriteRequest(const std::string &name, int newValue) override
Definition: DavsRequester.cpp:225
alexaClientSDK::acsdkAssets::commonInterfaces::Priority
Priority
Definition: Priority.h:27
std
Definition: CapabilityConfiguration.h:190
alexaClientSDK::acsdkAssets::manager::DavsRequester
Definition: DavsRequester.h:29
alexaClientSDK::acsdkAssets::manager::Requester::name
std::string name() const
Definition: Requester.h:83
alexaClientSDK::acsdkAssets::commonInterfaces::ResultCode
ResultCode
Definition: ResultCode.h:24
alexaClientSDK::acsdkAssets::manager::DavsRequester::~DavsRequester
~DavsRequester() override
Definition: DavsRequester.h:37
alexaClientSDK::acsdkAssets::manager::Requester
Definition: Requester.h:41
AmdCommunicationInterface.h
alexaClientSDK::acsdkAssets::manager::DavsRequester::onCheckFailure
void onCheckFailure(commonInterfaces::ResultCode errorCode) override
Definition: DavsRequester.cpp:171
alexaClientSDK::acsdkAssets::manager::DavsRequester::checkIfOkToDownload
bool checkIfOkToDownload(std::shared_ptr< commonInterfaces::VendableArtifact > availableArtifact, size_t freeSpaceNeeded) override
Definition: DavsRequester.cpp:119

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