AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | List of all members
alexaClientSDK::acsdkAlerts::test::StubAlertStorage Class Reference
Inheritance diagram for alexaClientSDK::acsdkAlerts::test::StubAlertStorage:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::acsdkAlerts::test::StubAlertStorage:
Collaboration graph
[legend]

Public Member Functions

bool createDatabase () override
 
bool open () override
 
void close () override
 
bool store (std::shared_ptr< Alert >) override
 
bool storeOfflineAlert (const std::string &, const std::string &, const std::string &) override
 
bool load (std::vector< std::shared_ptr< Alert >> *, std::shared_ptr< settings::DeviceSettingsManager >) override
 
bool loadOfflineAlerts (rapidjson::Value *, rapidjson::Document::AllocatorType &) override
 
bool modify (std::shared_ptr< Alert >) override
 
bool erase (std::shared_ptr< Alert >) override
 
bool eraseOffline (const std::string &, int) override
 
bool clearDatabase () override
 
bool bulkErase (const std::list< std::shared_ptr< Alert >> &) override
 
- Public Member Functions inherited from alexaClientSDK::acsdkAlerts::storage::AlertStorageInterface
virtual ~AlertStorageInterface ()=default
 

Detailed Description

Test AlertStorageInterface implementation to provide a valid instance for the initialization of other components.

Member Function Documentation

◆ bulkErase()

bool alexaClientSDK::acsdkAlerts::test::StubAlertStorage::bulkErase ( const std::list< std::shared_ptr< Alert >> &  alertList)
inlineoverridevirtual

Erases multiple alerts from the database. This function must be atomic, no alert is to be deleted if there was an error deleting one.

Note
It is not an error if an alert in the parameter list is not present in the database. This accommodates the race condition between an local alert deletion and a request from AVS.
Parameters
alertListThe list of alerts to be erased.
Returns
Whether all alerts were successfully erased.

Implements alexaClientSDK::acsdkAlerts::storage::AlertStorageInterface.

◆ clearDatabase()

bool alexaClientSDK::acsdkAlerts::test::StubAlertStorage::clearDatabase ( )
inlineoverridevirtual

A utility function to clear the database of all records. Note that the database will still exist, as will the tables. Only the rows will be erased.

Returns
Whether the database was successfully cleared.

Implements alexaClientSDK::acsdkAlerts::storage::AlertStorageInterface.

◆ close()

void alexaClientSDK::acsdkAlerts::test::StubAlertStorage::close ( )
inlineoverridevirtual

Close the currently open database, if one is open.

Implements alexaClientSDK::acsdkAlerts::storage::AlertStorageInterface.

◆ createDatabase()

bool alexaClientSDK::acsdkAlerts::test::StubAlertStorage::createDatabase ( )
inlineoverridevirtual

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::acsdkAlerts::storage::AlertStorageInterface.

◆ erase()

bool alexaClientSDK::acsdkAlerts::test::StubAlertStorage::erase ( std::shared_ptr< Alert alert)
inlineoverridevirtual

Erases a single alert from the database.

Parameters
alertThe Alert to be erased.
Returns
Whether the Alert was successfully erased.

Implements alexaClientSDK::acsdkAlerts::storage::AlertStorageInterface.

◆ eraseOffline()

bool alexaClientSDK::acsdkAlerts::test::StubAlertStorage::eraseOffline ( const std::string &  token,
int  id 
)
inlineoverridevirtual

Erases a single alert from the offline database.

Parameters
tokenThe alertToken of the alert to be erased.
idThe id of the alert to be erased
Returns
Whether the alert was successfully erased.

Implements alexaClientSDK::acsdkAlerts::storage::AlertStorageInterface.

◆ load()

bool alexaClientSDK::acsdkAlerts::test::StubAlertStorage::load ( std::vector< std::shared_ptr< Alert >> *  alertContainer,
std::shared_ptr< settings::DeviceSettingsManager settingsManager 
)
inlineoverridevirtual

Loads all alerts in the database.

Parameters
[out]alertContainerThe container where alerts should be stored.
settingsManagerA settingsManager object that manages alarm volume ramp setting.
Returns
Whether the Alerts were successfully loaded.

Implements alexaClientSDK::acsdkAlerts::storage::AlertStorageInterface.

◆ loadOfflineAlerts()

bool alexaClientSDK::acsdkAlerts::test::StubAlertStorage::loadOfflineAlerts ( rapidjson::Value *  alertContainer,
rapidjson::Document::AllocatorType &  allocator 
)
inlineoverridevirtual

Loads all alerts in the offline database.

Parameters
[out]alertContainerThe container where alerts should be stored.
allocatorThe rapidjson allocator, required for the results of this function to be mergable with other rapidjson::Value objects.

Implements alexaClientSDK::acsdkAlerts::storage::AlertStorageInterface.

◆ modify()

bool alexaClientSDK::acsdkAlerts::test::StubAlertStorage::modify ( std::shared_ptr< Alert alert)
inlineoverridevirtual

Updates a database record of the Alert parameter. The fields which are updated by this operation are the state and scheduled times of the alert. All other fields of an alert do not change over time, and so will not be captured in the database when calling this function.

Parameters
alertThe Alert to be modified.
Returns
Whether the Alert was successfully modified.

Implements alexaClientSDK::acsdkAlerts::storage::AlertStorageInterface.

◆ open()

bool alexaClientSDK::acsdkAlerts::test::StubAlertStorage::open ( )
inlineoverridevirtual

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::acsdkAlerts::storage::AlertStorageInterface.

◆ store()

bool alexaClientSDK::acsdkAlerts::test::StubAlertStorage::store ( std::shared_ptr< Alert alert)
inlineoverridevirtual

Stores a single Alert in the database.

Parameters
TheAlert to store.
Returns
Whether the Alert was successfully stored.

Implements alexaClientSDK::acsdkAlerts::storage::AlertStorageInterface.

◆ storeOfflineAlert()

bool alexaClientSDK::acsdkAlerts::test::StubAlertStorage::storeOfflineAlert ( const std::string &  token,
const std::string &  scheduledTime,
const std::string &  eventTime 
)
inlineoverridevirtual

Stores a single Alert in the offline alerts database.

Parameters
tokenThe alertToken of the alert to be erased.
scheduledTimeThe scheduled time of the alert
eventTimethe time the alert stopped
Returns
Whether the Alert was successfully stored.

Implements alexaClientSDK::acsdkAlerts::storage::AlertStorageInterface.


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

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