AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::acsdkNotifications::SQLiteNotificationsStorage Class Reference

#include <SQLiteNotificationsStorage.h>

Inheritance diagram for alexaClientSDK::acsdkNotifications::SQLiteNotificationsStorage:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::acsdkNotifications::SQLiteNotificationsStorage:
Collaboration graph
[legend]

Public Member Functions

 SQLiteNotificationsStorage (const std::string &databaseFilePath)
 
 ~SQLiteNotificationsStorage ()
 
bool createDatabase () override
 
bool open () override
 
void close () override
 
bool enqueue (const NotificationIndicator &notificationIndicator) override
 
bool dequeue () override
 
bool peek (NotificationIndicator *notificationIndicator) override
 
bool setIndicatorState (IndicatorState state) override
 
bool getIndicatorState (IndicatorState *state) override
 
bool checkForEmptyQueue (bool *empty) override
 
bool clearNotificationIndicators () override
 
bool getQueueSize (int *size) override
 
- Public Member Functions inherited from alexaClientSDK::acsdkNotificationsInterfaces::NotificationsStorageInterface
virtual ~NotificationsStorageInterface ()=default
 

Static Public Member Functions

static std::shared_ptr< acsdkNotificationsInterfaces::NotificationsStorageInterfacecreateNotificationsStorageInterface (const std::shared_ptr< avsCommon::utils::configuration::ConfigurationNode > &configurationRoot)
 
static std::unique_ptr< SQLiteNotificationsStoragecreate (const avsCommon::utils::configuration::ConfigurationNode &configurationRoot)
 

Additional Inherited Members

- Public Types inherited from alexaClientSDK::acsdkNotificationsInterfaces::NotificationsStorageInterface
using IndicatorState = avsCommon::avs::IndicatorState
 Some useful shorthand. More...
 

Detailed Description

An implementation that allows us to store NotificationIndicators using SQLite.

Constructor & Destructor Documentation

◆ SQLiteNotificationsStorage()

alexaClientSDK::acsdkNotifications::SQLiteNotificationsStorage::SQLiteNotificationsStorage ( const std::string &  databaseFilePath)

Constructor.

Parameters
dbFilePathThe location of the SQLite database file.

◆ ~SQLiteNotificationsStorage()

alexaClientSDK::acsdkNotifications::SQLiteNotificationsStorage::~SQLiteNotificationsStorage ( )

Member Function Documentation

◆ checkForEmptyQueue()

bool alexaClientSDK::acsdkNotifications::SQLiteNotificationsStorage::checkForEmptyQueue ( bool *  empty)
overridevirtual

Checks if there are any NotificationIndicator records in the database.

Parameters
[out]emptyWhether there were any records in the database.
Returns
Whether the operation was successful.

Implements alexaClientSDK::acsdkNotificationsInterfaces::NotificationsStorageInterface.

◆ clearNotificationIndicators()

bool alexaClientSDK::acsdkNotifications::SQLiteNotificationsStorage::clearNotificationIndicators ( )
overridevirtual

Clears the database of all NotificationIndicators.

Returns
Whether the clear operation was successful.

Implements alexaClientSDK::acsdkNotificationsInterfaces::NotificationsStorageInterface.

◆ close()

void alexaClientSDK::acsdkNotifications::SQLiteNotificationsStorage::close ( )
overridevirtual

Close the currently open database, if one is open.

Implements alexaClientSDK::acsdkNotificationsInterfaces::NotificationsStorageInterface.

◆ create()

std::unique_ptr< SQLiteNotificationsStorage > alexaClientSDK::acsdkNotifications::SQLiteNotificationsStorage::create ( const avsCommon::utils::configuration::ConfigurationNode configurationRoot)
static

Factory method for creating a storage object for Notifications based on an SQLite database.

Parameters
configurationRootThe global config object.
Returns
Pointer to the SQLiteMessagetStorge object, nullptr if there's an error creating it.

◆ createDatabase()

bool alexaClientSDK::acsdkNotifications::SQLiteNotificationsStorage::createDatabase ( )
overridevirtual

Creates a new database. If a database is already being handled by this object or there is another internal error, then this function returns false.

Returns
true If the database is created ok, or false if a database is already being handled by this object or there is a problem creating the database.

Implements alexaClientSDK::acsdkNotificationsInterfaces::NotificationsStorageInterface.

◆ createNotificationsStorageInterface()

std::shared_ptr< acsdkNotificationsInterfaces::NotificationsStorageInterface > alexaClientSDK::acsdkNotifications::SQLiteNotificationsStorage::createNotificationsStorageInterface ( const std::shared_ptr< avsCommon::utils::configuration::ConfigurationNode > &  configurationRoot)
static

Factory method for creating a storage object for Notifications based on an SQLite database.

Parameters
configurationRootThe global config object.
Returns
Pointer to the NotificationsStorageInterface object, nullptr if there's an error creating it.

◆ dequeue()

bool alexaClientSDK::acsdkNotifications::SQLiteNotificationsStorage::dequeue ( )
overridevirtual

Dequeues the next NotificationIndicator in the database.

Returns
Whether the dequeue operation was successful.

Implements alexaClientSDK::acsdkNotificationsInterfaces::NotificationsStorageInterface.

◆ enqueue()

bool alexaClientSDK::acsdkNotifications::SQLiteNotificationsStorage::enqueue ( const NotificationIndicator notificationIndicator)
overridevirtual

Enqueues a single NotificationIndicator in the database.

Parameters
notificationIndicatorThe NotificationIndicator to enqueue.
Returns
Whether the NotificationIndicator was successfully enqueued.

Implements alexaClientSDK::acsdkNotificationsInterfaces::NotificationsStorageInterface.

◆ getIndicatorState()

bool alexaClientSDK::acsdkNotifications::SQLiteNotificationsStorage::getIndicatorState ( IndicatorState state)
overridevirtual

Retrieves the currently stored IndicatorState.

Parameters
[out]stateA pointer to receive the currently stored IndicatorState
Returns
Whether the get operation was successful.
Note
The default IndicatorState for a new database is IndicatorState::OFF.

Implements alexaClientSDK::acsdkNotificationsInterfaces::NotificationsStorageInterface.

◆ getQueueSize()

bool alexaClientSDK::acsdkNotifications::SQLiteNotificationsStorage::getQueueSize ( int *  size)
overridevirtual

Gets the size of the queue (number of records in the queue table).

Parameters
[out]sizeA pointer to receive the calculated size.
Returns
Whether the size operation was successful.

Implements alexaClientSDK::acsdkNotificationsInterfaces::NotificationsStorageInterface.

◆ open()

bool alexaClientSDK::acsdkNotifications::SQLiteNotificationsStorage::open ( )
overridevirtual

Open an existing database. If this object is already managing an open database, or there is a problem opening the database, this function returns false.

Returns
true If the database is opened ok, false if this object is already managing an open database, or if there is another internal reason the database could not be opened.

Implements alexaClientSDK::acsdkNotificationsInterfaces::NotificationsStorageInterface.

◆ peek()

bool alexaClientSDK::acsdkNotifications::SQLiteNotificationsStorage::peek ( NotificationIndicator notificationIndicator)
overridevirtual

Peeks at the next NotificationIndicator in the database.

Parameters
[out]notificationIndicatorA pointer to receive the peeked NotificationIndicator
Returns
Whether the peek operation was successful.

Implements alexaClientSDK::acsdkNotificationsInterfaces::NotificationsStorageInterface.

◆ setIndicatorState()

bool alexaClientSDK::acsdkNotifications::SQLiteNotificationsStorage::setIndicatorState ( IndicatorState  state)
overridevirtual

Stores the current IndicatorState.

Returns
Whether the store operation was successful.

Implements alexaClientSDK::acsdkNotificationsInterfaces::NotificationsStorageInterface.


The documentation for this class was generated from the following files:

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