AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
DeviceSettingsManagerBuilder.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 ACSDKDEVICESETTINGSMANAGER_DEVICESETTINGSMANAGERBUILDER_H_
17 #define ACSDKDEVICESETTINGSMANAGER_DEVICESETTINGSMANAGERBUILDER_H_
18 
19 #include <cstdint>
20 #include <functional>
21 #include <memory>
22 #include <tuple>
23 
34 #include <Settings/Setting.h>
40 
41 namespace alexaClientSDK {
42 namespace acsdkDeviceSettingsManager {
43 
47 class DeviceSettingsManagerBuilder : public settings::SettingsManagerBuilderBase<settings::DeviceSettingsManager> {
48 public:
64  static std::shared_ptr<settings::DeviceSettingsManager> createDeviceSettingsManager(
65  std::shared_ptr<settings::storage::DeviceSettingStorageInterface> settingStorage,
66  std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender,
67  std::shared_ptr<avsCommon::sdkInterfaces::AVSConnectionManagerInterface> connectionManager,
68  std::shared_ptr<registrationManager::CustomerDataManagerInterface> dataManager,
69  std::shared_ptr<avsCommon::sdkInterfaces::LocaleAssetsManagerInterface> localeAssetsManager,
70  std::shared_ptr<capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent> doNotDisturbCapabilityAgent,
71  const std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface>& metricRecorder,
72  std::shared_ptr<avsCommon::sdkInterfaces::SystemTimeZoneInterface> systemTimezone = nullptr);
73 
84  std::shared_ptr<settings::storage::DeviceSettingStorageInterface> settingStorage,
85  std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender,
86  std::shared_ptr<avsCommon::sdkInterfaces::AVSConnectionManagerInterface> connectionManager,
87  std::shared_ptr<registrationManager::CustomerDataManagerInterface> dataManager,
88  const std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface>& metricRecorder);
89 
98  const std::shared_ptr<capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent>& dndCA);
99 
106 
113 
120 
129  std::shared_ptr<avsCommon::sdkInterfaces::SystemTimeZoneInterface> systemTimeZone = nullptr);
130 
138  std::shared_ptr<avsCommon::sdkInterfaces::LocaleAssetsManagerInterface> localeAssetsManager);
139 
148  std::shared_ptr<avsCommon::sdkInterfaces::LocaleAssetsManagerInterface> localeAssetsManager);
149 
156 
164  template <size_t index>
165  std::shared_ptr<SettingType<index>> getSetting() const;
166 
174  template <size_t index>
176 
182  std::unique_ptr<settings::DeviceSettingsManager> build() override;
183 
184 private:
195  template <size_t index, class ProtocolT>
196  DeviceSettingsManagerBuilder& withSynchronizedSetting(
197  const settings::SettingEventMetadata& metadata,
198  const ValueType<index>& defaultValue,
199  std::function<bool(const ValueType<index>&)> applyFn = std::function<bool(const ValueType<index>&)>());
200 
202  std::shared_ptr<settings::storage::DeviceSettingStorageInterface> m_settingStorage;
203 
205  std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> m_messageSender;
206 
208  std::shared_ptr<avsCommon::sdkInterfaces::AVSConnectionManagerInterface> m_connectionManager;
209 
211  std::shared_ptr<registrationManager::CustomerDataManagerInterface> m_dataManager;
212 
214  std::shared_ptr<avsCommon::utils::metrics::MetricRecorderInterface> m_metricRecorder;
215 
217  bool m_foundError;
218 };
219 
220 template <size_t index>
223  return std::get<index>(m_settingConfigs);
224 }
225 
226 template <size_t index>
227 std::shared_ptr<DeviceSettingsManagerBuilder::SettingType<index>> DeviceSettingsManagerBuilder::getSetting() const {
228  return std::get<index>(m_settingConfigs).setting;
229 }
230 
231 } // namespace acsdkDeviceSettingsManager
232 } // namespace alexaClientSDK
233 
234 #endif // ACSDKDEVICESETTINGSMANAGER_DEVICESETTINGSMANAGERBUILDER_H_
Definition: SettingEventMetadata.h:27
DeviceSettingsManagerBuilder & withLocaleAndWakeWordsSettings(std::shared_ptr< avsCommon::sdkInterfaces::LocaleAssetsManagerInterface > localeAssetsManager)
std::shared_ptr< SettingType< index > > getSetting() const
Definition: DeviceSettingsManagerBuilder.h:227
DeviceSettingsManagerBuilder(std::shared_ptr< settings::storage::DeviceSettingStorageInterface > settingStorage, std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > messageSender, std::shared_ptr< avsCommon::sdkInterfaces::AVSConnectionManagerInterface > connectionManager, std::shared_ptr< registrationManager::CustomerDataManagerInterface > dataManager, const std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > &metricRecorder)
Definition: SettingsManagerBuilderBase.h:35
DeviceSettingsManagerBuilder & withDoNotDisturbSetting(const std::shared_ptr< capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent > &dndCA)
static std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > metricRecorder
Metric recorder shared ptr.
Definition: BaseAPLCapabilityAgentTest.cpp:261
DeviceSettingsManagerBuilder & withLocaleSetting(std::shared_ptr< avsCommon::sdkInterfaces::LocaleAssetsManagerInterface > localeAssetsManager)
static std::shared_ptr< settings::DeviceSettingsManager > createDeviceSettingsManager(std::shared_ptr< settings::storage::DeviceSettingStorageInterface > settingStorage, std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > messageSender, std::shared_ptr< avsCommon::sdkInterfaces::AVSConnectionManagerInterface > connectionManager, std::shared_ptr< registrationManager::CustomerDataManagerInterface > dataManager, std::shared_ptr< avsCommon::sdkInterfaces::LocaleAssetsManagerInterface > localeAssetsManager, std::shared_ptr< capabilityAgents::doNotDisturb::DoNotDisturbCapabilityAgent > doNotDisturbCapabilityAgent, const std::shared_ptr< avsCommon::utils::metrics::MetricRecorderInterface > &metricRecorder, std::shared_ptr< avsCommon::sdkInterfaces::SystemTimeZoneInterface > systemTimezone=nullptr)
Definition: SettingsManager.h:43
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
settings::SettingConfiguration< SettingType< index > > getConfiguration() const
Definition: DeviceSettingsManagerBuilder.h:222
std::unique_ptr< settings::DeviceSettingsManager > build() override
DeviceSettingsManagerBuilder & withTimeZoneSetting(std::shared_ptr< avsCommon::sdkInterfaces::SystemTimeZoneInterface > systemTimeZone=nullptr)

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