AlexaClientSDK  1.25.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Types | Public Member Functions | List of all members
alexaClientSDK::settings::storage::DeviceSettingStorageInterface Class Referenceabstract

#include <DeviceSettingStorageInterface.h>

Inheritance diagram for alexaClientSDK::settings::storage::DeviceSettingStorageInterface:
Inheritance graph
[legend]

Public Types

using SettingStatusAndValue = std::pair< SettingStatus, std::string >
 

Public Member Functions

virtual ~DeviceSettingStorageInterface ()=default
 
virtual bool open ()=0
 
virtual void close ()=0
 
virtual bool storeSetting (const std::string &key, const std::string &value, SettingStatus status)=0
 
virtual bool storeSettings (const std::vector< std::tuple< std::string, std::string, SettingStatus >> &data)=0
 
virtual SettingStatusAndValue loadSetting (const std::string &key)=0
 
virtual bool deleteSetting (const std::string &key)=0
 
virtual bool updateSettingStatus (const std::string &key, SettingStatus status)=0
 

Detailed Description

An Interface class which defines APIs for interacting with a database used for storing, loading, and modifying settings.

Note
: This class does not provide any setting level sanity testing. It is expected that the logic and SettingStatus transitions are managed by the caller. This class simply manages the persistence of settings data and status.

Member Typedef Documentation

◆ SettingStatusAndValue

The type holding the status and string value of a setting. If the status is NOT_AVAILABLE the value will contain the reason or error message why the setting value can not be retrieved.

Constructor & Destructor Documentation

◆ ~DeviceSettingStorageInterface()

virtual alexaClientSDK::settings::storage::DeviceSettingStorageInterface::~DeviceSettingStorageInterface ( )
virtualdefault

Destructor.

Member Function Documentation

◆ close()

virtual void alexaClientSDK::settings::storage::DeviceSettingStorageInterface::close ( )
pure virtual

Close the currently open database, if one is open.

Implemented in alexaClientSDK::settings::storage::SQLiteDeviceSettingStorage.

◆ deleteSetting()

virtual bool alexaClientSDK::settings::storage::DeviceSettingStorageInterface::deleteSetting ( const std::string &  key)
pure virtual

Removes the entry for a particular setting in the database.

Parameters
keyThe string identifier for the setting.
Returns
true if deletion is successful, false otherwise

Implemented in alexaClientSDK::settings::storage::SQLiteDeviceSettingStorage.

◆ loadSetting()

virtual SettingStatusAndValue alexaClientSDK::settings::storage::DeviceSettingStorageInterface::loadSetting ( const std::string &  key)
pure virtual

Retrieves the setting status and value from the database.

Parameters
keyThe string identifier for the setting.
Returns
The status and value of the setting. The value will contain the reason or error message if the status is NOT_AVAILABLE.

Implemented in alexaClientSDK::settings::storage::SQLiteDeviceSettingStorage.

◆ open()

virtual bool alexaClientSDK::settings::storage::DeviceSettingStorageInterface::open ( )
pure virtual

Open an existing database.

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

Implemented in alexaClientSDK::settings::storage::SQLiteDeviceSettingStorage.

◆ storeSetting()

virtual bool alexaClientSDK::settings::storage::DeviceSettingStorageInterface::storeSetting ( const std::string &  key,
const std::string &  value,
SettingStatus  status 
)
pure virtual

Stores a single setting in the database.

Parameters
keyThe string identifier for the setting.
valueThe string value of the setting.
statusThe status of the setting.
Returns
Whether the setting was successfully stored.

Implemented in alexaClientSDK::settings::storage::SQLiteDeviceSettingStorage.

◆ storeSettings()

virtual bool alexaClientSDK::settings::storage::DeviceSettingStorageInterface::storeSettings ( const std::vector< std::tuple< std::string, std::string, SettingStatus >> &  data)
pure virtual

Stores multiple setting in the database.

Parameters
dataA collection of key-value-status entries to store.
Returns
Whether the setting was successfully stored.

Implemented in alexaClientSDK::settings::storage::SQLiteDeviceSettingStorage.

◆ updateSettingStatus()

virtual bool alexaClientSDK::settings::storage::DeviceSettingStorageInterface::updateSettingStatus ( const std::string &  key,
SettingStatus  status 
)
pure virtual

Update the status of a setting in the database. The update will fail if the setting does not exist.

Parameters
keyThe string identifier for the setting.
statusThe status of the setting.
Returns
Whether the status was successfully updated.

Implemented in alexaClientSDK::settings::storage::SQLiteDeviceSettingStorage.


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

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