AlexaClientSDK  1.19.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Classes | Public Member Functions | List of all members
alexaClientSDK::capabilityAgents::alerts::AlertScheduler Class Reference

#include <AlertScheduler.h>

Inheritance diagram for alexaClientSDK::capabilityAgents::alerts::AlertScheduler:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::capabilityAgents::alerts::AlertScheduler:
Collaboration graph
[legend]

Classes

struct  AlertsContextInfo
 

Public Member Functions

 AlertScheduler (std::shared_ptr< storage::AlertStorageInterface > alertStorage, std::shared_ptr< renderer::RendererInterface > alertRenderer, std::chrono::seconds alertPastDueTimeLimitSeconds)
 
void onAlertStateChange (const std::string &alertToken, const std::string &alertType, State state, const std::string &reason="") override
 
bool initialize (std::shared_ptr< AlertObserverInterface > observer, std::shared_ptr< settings::DeviceSettingsManager > settingsManager)
 
bool scheduleAlert (std::shared_ptr< Alert > alert)
 
bool snoozeAlert (const std::string &alertToken, const std::string &updatedTime_ISO_8601)
 
bool deleteAlert (const std::string &alertToken)
 
bool deleteAlerts (const std::list< std::string > &tokenList)
 
bool isAlertActive (std::shared_ptr< Alert > alert)
 
void updateFocus (avsCommon::avs::FocusState focusState)
 
avsCommon::avs::FocusState getFocusState ()
 
AlertScheduler::AlertsContextInfo getContextInfo ()
 
void onLocalStop ()
 
void clearData (Alert::StopReason reason=Alert::StopReason::SHUTDOWN)
 
void shutdown ()
 
std::list< std::shared_ptr< Alert > > getAllAlerts ()
 
- Public Member Functions inherited from alexaClientSDK::capabilityAgents::alerts::AlertObserverInterface
virtual ~AlertObserverInterface ()=default
 

Additional Inherited Members

- Public Types inherited from alexaClientSDK::capabilityAgents::alerts::AlertObserverInterface
enum  State {
  State::READY, State::STARTED, State::STOPPED, State::SNOOZED,
  State::COMPLETED, State::PAST_DUE, State::FOCUS_ENTERED_FOREGROUND, State::FOCUS_ENTERED_BACKGROUND,
  State::ERROR, State::DELETED, State::SCHEDULED_FOR_LATER
}
 
- Static Public Member Functions inherited from alexaClientSDK::capabilityAgents::alerts::AlertObserverInterface
static std::string stateToString (State state)
 

Detailed Description

This class handles the management of AVS alerts. This is essentially a time-ordered queue, where a timer is set for the alert which must activate soonest. As alerts are added or removed, this timer must be reset.

Constructor & Destructor Documentation

◆ AlertScheduler()

alexaClientSDK::capabilityAgents::alerts::AlertScheduler::AlertScheduler ( std::shared_ptr< storage::AlertStorageInterface alertStorage,
std::shared_ptr< renderer::RendererInterface alertRenderer,
std::chrono::seconds  alertPastDueTimeLimitSeconds 
)

Constructor.

Parameters
alertStorageThe storage object where alerts can be saved, modified and deleted.
alertRendererThe object which will handle user-perceivable effects upon alert activation.
alertPastDueTimeLimitSecondsThe threshold in seconds, beyond which alerts will be considered past-due and discarded.

Member Function Documentation

◆ clearData()

void alexaClientSDK::capabilityAgents::alerts::AlertScheduler::clearData ( Alert::StopReason  reason = Alert::StopReason::SHUTDOWN)

Clear all data being managed. This includes database storage.

Parameters
reasonWhat triggered the data to be cleared.

◆ deleteAlert()

bool alexaClientSDK::capabilityAgents::alerts::AlertScheduler::deleteAlert ( const std::string &  alertToken)

Delete an alert from the schedule.

Parameters
alertTokenThe AVS token identifying the alert.
Returns
Whether we successfully deleted the alert.

◆ deleteAlerts()

bool alexaClientSDK::capabilityAgents::alerts::AlertScheduler::deleteAlerts ( const std::list< std::string > &  tokenList)

Delete multiple alerts from the schedule by their tokens. All existing alerts are deleted with all-or-none rule. In case of failure no actual deletion is made. Missing alert is not treated as an error.

Parameters
tokenListList of tokens of the alerts to be deleted
Returns
true if all alerts has been deleted, false if any of the deletion failed.

◆ getAllAlerts()

std::list< std::shared_ptr< Alert > > alexaClientSDK::capabilityAgents::alerts::AlertScheduler::getAllAlerts ( )

Utility method to get list of all alerts being tracked by AlertScheduler

Returns
list of all alerts being tracked by AlertScheduler

◆ getContextInfo()

AlertScheduler::AlertsContextInfo alexaClientSDK::capabilityAgents::alerts::AlertScheduler::getContextInfo ( )

Collects Context data for all alerts being managed.

Returns
An AlertsContextInfo structure, containing all data needed.

◆ getFocusState()

avsCommon::avs::FocusState alexaClientSDK::capabilityAgents::alerts::AlertScheduler::getFocusState ( )

Provide our current channel focus state.

Returns
Our current channel focus state.

◆ initialize()

bool alexaClientSDK::capabilityAgents::alerts::AlertScheduler::initialize ( std::shared_ptr< AlertObserverInterface observer,
std::shared_ptr< settings::DeviceSettingsManager settingsManager 
)

Initialization.

Note
This function must be called before other use of an object this class.
Parameters
observerAn observer which we will notify of all alert state changes.
m_settingsManagerA settingsManager object that manages alarm volume ramp setting.
Returns
Whether initialization was successful.

◆ isAlertActive()

bool alexaClientSDK::capabilityAgents::alerts::AlertScheduler::isAlertActive ( std::shared_ptr< Alert alert)

Utility function to determine if an alert is currently active.

Parameters
alertThe alert being queried.
Returns
Whether the alert is active.

◆ onAlertStateChange()

void alexaClientSDK::capabilityAgents::alerts::AlertScheduler::onAlertStateChange ( const std::string &  alertToken,
const std::string &  alertType,
State  state,
const std::string &  reason = "" 
)
overridevirtual

A callback function to notify an object that an alert has updated its state.

Parameters
alertTokenThe AVS token of the alert.
alertTypeThe type of the alert.
stateThe state of the alert.
reasonThe reason for the state change.

Implements alexaClientSDK::capabilityAgents::alerts::AlertObserverInterface.

◆ onLocalStop()

void alexaClientSDK::capabilityAgents::alerts::AlertScheduler::onLocalStop ( )

Handle a local stop.

◆ scheduleAlert()

bool alexaClientSDK::capabilityAgents::alerts::AlertScheduler::scheduleAlert ( std::shared_ptr< Alert alert)

Schedule an alert for rendering.

Parameters
alertThe alert to be scheduled.
Returns
Whether the alert was successfully scheduled.

◆ shutdown()

void alexaClientSDK::capabilityAgents::alerts::AlertScheduler::shutdown ( )

Handle shutdown.

◆ snoozeAlert()

bool alexaClientSDK::capabilityAgents::alerts::AlertScheduler::snoozeAlert ( const std::string &  alertToken,
const std::string &  updatedTime_ISO_8601 
)

Snooze an active alert to re-activate at a new specified time. The alert, if active, will be de-activated and re-scheduled for the new time.

Parameters
alertTokenThe AVS token identifying the alert.
updatedTime_ISO_8601The new time in ISO-8601 format.
Returns
Whether we successfully snoozed the alert.

◆ updateFocus()

void alexaClientSDK::capabilityAgents::alerts::AlertScheduler::updateFocus ( avsCommon::avs::FocusState  focusState)

Update our state of channel focus.

Parameters
focusStateThe state we now have.

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