AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
SQLiteNotificationsStorage.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 ACSDKNOTIFICATIONS_SQLITENOTIFICATIONSSTORAGE_H_
17 #define ACSDKNOTIFICATIONS_SQLITENOTIFICATIONSSTORAGE_H_
18 
20 
21 #include <mutex>
22 
25 
26 namespace alexaClientSDK {
27 namespace acsdkNotifications {
28 
35 public:
42  static std::shared_ptr<acsdkNotificationsInterfaces::NotificationsStorageInterface>
44  const std::shared_ptr<avsCommon::utils::configuration::ConfigurationNode>& configurationRoot);
45 
53  static std::unique_ptr<SQLiteNotificationsStorage> create(
55 
61  SQLiteNotificationsStorage(const std::string& databaseFilePath);
62 
64 
65  bool createDatabase() override;
66 
67  bool open() override;
68 
69  void close() override;
70 
71  bool enqueue(const NotificationIndicator& notificationIndicator) override;
72 
73  bool dequeue() override;
74 
75  bool peek(NotificationIndicator* notificationIndicator) override;
76 
77  bool setIndicatorState(IndicatorState state) override;
78 
79  bool getIndicatorState(IndicatorState* state) override;
80 
81  bool checkForEmptyQueue(bool* empty) override;
82 
83  bool clearNotificationIndicators() override;
84 
85  bool getQueueSize(int* size) override;
86 
87 private:
95  bool getNextNotificationIndicatorLocked(NotificationIndicator* notificationIndicator);
96 
102  bool createNotificationIndicatorsTable();
103 
109  bool createIndicatorStateTable();
110 
112  std::mutex m_databaseMutex;
113 
116 };
117 
118 } // namespace acsdkNotifications
119 } // namespace alexaClientSDK
120 
121 #endif // ACSDKNOTIFICATIONS_SQLITENOTIFICATIONSSTORAGE_H_
bool dequeue() override
Definition: SQLiteNotificationsStorage.cpp:231
bool checkForEmptyQueue(bool *empty) override
Definition: SQLiteNotificationsStorage.cpp:370
void close() override
Definition: SQLiteNotificationsStorage.cpp:155
~SQLiteNotificationsStorage()
Definition: SQLiteNotificationsStorage.cpp:420
bool setIndicatorState(IndicatorState state) override
Definition: SQLiteNotificationsStorage.cpp:259
bool enqueue(const NotificationIndicator &notificationIndicator) override
Definition: SQLiteNotificationsStorage.cpp:159
bool getQueueSize(int *size) override
Definition: SQLiteNotificationsStorage.cpp:477
Definition: SQLiteNotificationsStorage.h:34
bool peek(NotificationIndicator *notificationIndicator) override
Definition: SQLiteNotificationsStorage.cpp:250
bool clearNotificationIndicators() override
Definition: SQLiteNotificationsStorage.cpp:401
SQLiteNotificationsStorage(const std::string &databaseFilePath)
Definition: SQLiteNotificationsStorage.cpp:100
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
bool createDatabase() override
Definition: SQLiteNotificationsStorage.cpp:104
IndicatorState
Definition: IndicatorState.h:30
bool open() override
Definition: SQLiteNotificationsStorage.cpp:130
static std::unique_ptr< SQLiteNotificationsStorage > create(const avsCommon::utils::configuration::ConfigurationNode &configurationRoot)
Definition: SQLiteNotificationsStorage.cpp:79
bool getIndicatorState(IndicatorState *state) override
Definition: SQLiteNotificationsStorage.cpp:314
Definition: NotificationIndicator.h:29
static std::shared_ptr< acsdkNotificationsInterfaces::NotificationsStorageInterface > createNotificationsStorageInterface(const std::shared_ptr< avsCommon::utils::configuration::ConfigurationNode > &configurationRoot)
Definition: SQLiteNotificationsStorage.cpp:72

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