AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
AuthRefreshedObserver.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 #ifndef ALEXA_CLIENT_SDK_AVSGATEWAYMANAGER_INCLUDE_AVSGATEWAYMANAGER_AUTHREFRESHEDOBSERVER_H_
16 #define ALEXA_CLIENT_SDK_AVSGATEWAYMANAGER_INCLUDE_AVSGATEWAYMANAGER_AUTHREFRESHEDOBSERVER_H_
17 
20 
21 #include <memory>
22 #include <mutex>
23 #include <functional>
24 
25 namespace alexaClientSDK {
26 namespace avsGatewayManager {
27 
33  , public std::enable_shared_from_this<AuthRefreshedObserver> {
34 public:
41  static std::shared_ptr<AuthRefreshedObserver> create(std::function<void()> callback);
42 
50  void onAuthStateChange(State newState, Error error) override;
51 
52 private:
57  explicit AuthRefreshedObserver(std::function<void()> afterAuthRefreshedCallback);
59  std::mutex m_mutex;
60 
62  State m_state;
63 
64  // Callback function to be called once the Authorization status is refreshed
65  std::function<void()> m_afterAuthRefreshedCallback;
66 };
67 
68 } // namespace avsGatewayManager
69 } // namespace alexaClientSDK
70 
71 #endif // ALEXA_CLIENT_SDK_AVSGATEWAYMANAGER_INCLUDE_AVSGATEWAYMANAGER_AUTHREFRESHEDOBSERVER_H_
Definition: AuthRefreshedObserver.h:31
State
The enum State describes the state of authorization.
Definition: AuthObserverInterface.h:34
static std::shared_ptr< AuthRefreshedObserver > create(std::function< void()> callback)
void onAuthStateChange(State newState, Error error) override
Error
The enum Error encodes possible errors which may occur when changing state.
Definition: AuthObserverInterface.h:48
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36

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