AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
SoftwareInfoSender.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 ALEXA_CLIENT_SDK_CAPABILITYAGENTS_SYSTEM_INCLUDE_SYSTEM_SOFTWAREINFOSENDER_H_
17 #define ALEXA_CLIENT_SDK_CAPABILITYAGENTS_SYSTEM_INCLUDE_SYSTEM_SOFTWAREINFOSENDER_H_
18 
19 #include <cstdint>
20 #include <future>
21 #include <memory>
22 #include <string>
30 
31 namespace alexaClientSDK {
32 namespace capabilityAgents {
33 namespace system {
34 
35 class SoftwareInfoSendRequest;
36 
47  , public std::enable_shared_from_this<SoftwareInfoSender>
50 public:
62  static std::shared_ptr<SoftwareInfoSender> create(
64  bool sendSoftwareInfoUponConnect,
65  std::unordered_set<std::shared_ptr<avsCommon::sdkInterfaces::SoftwareInfoSenderObserverInterface>> observers,
66  std::shared_ptr<avsCommon::sdkInterfaces::AVSConnectionManagerInterface> connection,
67  std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender,
68  std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface> exceptionEncounteredSender);
69 
81 
85  void handleDirectiveImmediately(std::shared_ptr<avsCommon::avs::AVSDirective> directive) override;
86  void preHandleDirective(std::shared_ptr<avsCommon::avs::CapabilityAgent::DirectiveInfo> info) override;
87  void handleDirective(std::shared_ptr<avsCommon::avs::CapabilityAgent::DirectiveInfo> info) override;
88  void cancelDirective(std::shared_ptr<avsCommon::avs::CapabilityAgent::DirectiveInfo> info) override;
90 
93  void doShutdown() override;
95 
102 
107 
108 private:
121  bool sendSoftwareInfoUponConnect,
122  std::unordered_set<std::shared_ptr<avsCommon::sdkInterfaces::SoftwareInfoSenderObserverInterface>> observers,
123  std::shared_ptr<avsCommon::sdkInterfaces::AVSConnectionManagerInterface> connection,
124  std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> messageSender,
125  std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface> exceptionEncounteredSender);
126 
132  void removeDirective(std::shared_ptr<DirectiveInfo> info);
133 
136 
138  bool m_sendSoftwareInfoUponConnect;
139 
141  std::unordered_set<std::shared_ptr<avsCommon::sdkInterfaces::SoftwareInfoSenderObserverInterface>> m_observers;
142 
144  std::shared_ptr<avsCommon::sdkInterfaces::AVSConnectionManagerInterface> m_connection;
145 
147  std::shared_ptr<avsCommon::sdkInterfaces::MessageSenderInterface> m_messageSender;
148 
150  std::shared_ptr<avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface> m_exceptionEncounteredSender;
151 
153  std::mutex m_mutex;
154 
157 
160  std::shared_ptr<capabilityAgents::system::SoftwareInfoSendRequest> m_clientInitiatedSendRequest;
161 
164  std::shared_ptr<capabilityAgents::system::SoftwareInfoSendRequest> m_handleDirectiveSendRequest;
165 };
166 
167 } // namespace system
168 } // namespace capabilityAgents
169 } // namespace alexaClientSDK
170 
171 #endif // ALEXA_CLIENT_SDK_CAPABILITYAGENTS_SYSTEM_INCLUDE_SYSTEM_SOFTWAREINFOSENDER_H_
Definition: CapabilityAgent.h:47
ChangedReason
Definition: ConnectionStatusObserverInterface.h:50
void handleDirectiveImmediately(std::shared_ptr< avsCommon::avs::AVSDirective > directive) override
avsCommon::avs::DirectiveHandlerConfiguration getConfiguration() const override
Definition: ConnectionStatusObserverInterface.h:31
static std::shared_ptr< SoftwareInfoSender > create(avsCommon::sdkInterfaces::softwareInfo::FirmwareVersion firmwareVersion, bool sendSoftwareInfoUponConnect, std::unordered_set< std::shared_ptr< avsCommon::sdkInterfaces::SoftwareInfoSenderObserverInterface >> observers, std::shared_ptr< avsCommon::sdkInterfaces::AVSConnectionManagerInterface > connection, std::shared_ptr< avsCommon::sdkInterfaces::MessageSenderInterface > messageSender, std::shared_ptr< avsCommon::sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionEncounteredSender)
bool setFirmwareVersion(avsCommon::sdkInterfaces::softwareInfo::FirmwareVersion firmwareVersion)
std::unordered_map< directiveRoutingRule::DirectiveRoutingRule, BlockingPolicy > DirectiveHandlerConfiguration
Definition: DirectiveHandlerConfiguration.h:32
void cancelDirective(std::shared_ptr< avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
void onFirmwareVersionAccepted(avsCommon::sdkInterfaces::softwareInfo::FirmwareVersion firmwareVersion) override
void handleDirective(std::shared_ptr< avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
void preHandleDirective(std::shared_ptr< avsCommon::avs::CapabilityAgent::DirectiveInfo > info) override
int32_t FirmwareVersion
Type to use to communicate a firmware version.
Definition: SoftwareInfoSenderObserverInterface.h:29
void onConnectionStatusChanged(avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::Status status, avsCommon::sdkInterfaces::ConnectionStatusObserverInterface::ChangedReason reason) override
Status
Definition: ConnectionStatusObserverInterface.h:36
Definition: SoftwareInfoSenderObserverInterface.h:51

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