AlexaClientSDK  1.19.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::capabilityAgents::notifications::SQLiteNotificationsStorage Class Reference

#include <SQLiteNotificationsStorage.h>

Inheritance diagram for alexaClientSDK::capabilityAgents::notifications::SQLiteNotificationsStorage:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::capabilityAgents::notifications::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::capabilityAgents::notifications::NotificationsStorageInterface
virtual ~NotificationsStorageInterface ()=default
 

Static Public Member Functions

static std::unique_ptr< SQLiteNotificationsStoragecreate (const avsCommon::utils::configuration::ConfigurationNode &configurationRoot)
 

Additional Inherited Members

- Public Types inherited from alexaClientSDK::capabilityAgents::notifications::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::capabilityAgents::notifications::SQLiteNotificationsStorage::SQLiteNotificationsStorage ( const std::string &  databaseFilePath)

Constructor.

Parameters
dbFilePathThe location of the SQLite database file.

◆ ~SQLiteNotificationsStorage()

alexaClientSDK::capabilityAgents::notifications::SQLiteNotificationsStorage::~SQLiteNotificationsStorage ( )

Member Function Documentation

◆ checkForEmptyQueue()

bool alexaClientSDK::capabilityAgents::notifications::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::capabilityAgents::notifications::NotificationsStorageInterface.

◆ clearNotificationIndicators()

bool alexaClientSDK::capabilityAgents::notifications::SQLiteNotificationsStorage::clearNotificationIndicators ( )
overridevirtual

Clears the database of all NotificationIndicators.

Returns
Whether the clear operation was successful.

Implements alexaClientSDK::capabilityAgents::notifications::NotificationsStorageInterface.

◆ close()

void alexaClientSDK::capabilityAgents::notifications::SQLiteNotificationsStorage::close ( )
overridevirtual

Close the currently open database, if one is open.

Implements alexaClientSDK::capabilityAgents::notifications::NotificationsStorageInterface.

◆ create()

std::unique_ptr< SQLiteNotificationsStorage > alexaClientSDK::capabilityAgents::notifications::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::capabilityAgents::notifications::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::capabilityAgents::notifications::NotificationsStorageInterface.

◆ dequeue()

bool alexaClientSDK::capabilityAgents::notifications::SQLiteNotificationsStorage::dequeue ( )
overridevirtual

Dequeues the next NotificationIndicator in the database.

Returns
Whether the dequeue operation was successful.

Implements alexaClientSDK::capabilityAgents::notifications::NotificationsStorageInterface.

◆ enqueue()

bool alexaClientSDK::capabilityAgents::notifications::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::capabilityAgents::notifications::NotificationsStorageInterface.

◆ getIndicatorState()

bool alexaClientSDK::capabilityAgents::notifications::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::capabilityAgents::notifications::NotificationsStorageInterface.

◆ getQueueSize()

bool alexaClientSDK::capabilityAgents::notifications::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::capabilityAgents::notifications::NotificationsStorageInterface.

◆ open()

bool alexaClientSDK::capabilityAgents::notifications::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::capabilityAgents::notifications::NotificationsStorageInterface.

◆ peek()

bool alexaClientSDK::capabilityAgents::notifications::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::capabilityAgents::notifications::NotificationsStorageInterface.

◆ setIndicatorState()

bool alexaClientSDK::capabilityAgents::notifications::SQLiteNotificationsStorage::setIndicatorState ( IndicatorState  state)
overridevirtual

Stores the current IndicatorState.

Returns
Whether the store operation was successful.

Implements alexaClientSDK::capabilityAgents::notifications::NotificationsStorageInterface.


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

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