16 #ifndef ALEXA_CLIENT_SDK_ACSDKALERTSINTERFACES_INCLUDE_ACSDKALERTSINTERFACES_ALERTOBSERVERINTERFACE_H_ 17 #define ALEXA_CLIENT_SDK_ACSDKALERTSINTERFACES_INCLUDE_ACSDKALERTSINTERFACES_ALERTOBSERVERINTERFACE_H_ 26 namespace acsdkAlertsInterfaces {
54 return value >= minVal && value <= maxVal;
122 int hour = ORIGINAL_TIME_FIELD_MIN,
123 int minute = ORIGINAL_TIME_FIELD_MIN,
124 int second = ORIGINAL_TIME_FIELD_MIN,
125 int millisecond = ORIGINAL_TIME_FIELD_MIN) :
129 millisecond{millisecond} {
130 if (!
withinBounds(hour, ORIGINAL_TIME_FIELD_MIN, ORIGINAL_TIME_HOUR_MAX) ||
131 !
withinBounds(minute, ORIGINAL_TIME_FIELD_MIN, ORIGINAL_TIME_MINUTE_MAX) ||
132 !
withinBounds(second, ORIGINAL_TIME_FIELD_MIN, ORIGINAL_TIME_SECOND_MAX) ||
133 !
withinBounds(millisecond, ORIGINAL_TIME_FIELD_MIN, ORIGINAL_TIME_MILLISECOND_MAX)) {
187 const std::chrono::system_clock::time_point& scheduledTime,
194 scheduledTime{scheduledTime},
195 originalTime{originalTime},
269 return "FOCUS_ENTERED_FOREGROUND";
271 return "FOCUS_ENTERED_BACKGROUND";
277 return "SCHEDULED_FOR_LATER";
279 return "Unknown State";
291 return "Unknown Type";
295 std::stringstream ss;
296 ss << std::setfill(
'0') << std::setw(2) << originalTime.
hour <<
":" << std::setfill(
'0') << std::setw(2)
297 << originalTime.
minute <<
":" << std::setfill(
'0') << std::setw(2) << originalTime.
second <<
"." 298 << std::setfill(
'0') << std::setw(3) << originalTime.
millisecond;
338 #endif // ALEXA_CLIENT_SDK_ACSDKALERTSINTERFACES_INCLUDE_ACSDKALERTSINTERFACES_ALERTOBSERVERINTERFACE_H_ std::string reason
The reason for the state change.
Definition: AlertObserverInterface.h:214
static const int ORIGINAL_TIME_SECOND_MAX
The maximum value for the second field in OriginalTime.
Definition: AlertObserverInterface.h:40
std::string token
An opaque token that uniquely identifies the alert.
Definition: AlertObserverInterface.h:201
bool operator==(const OriginalTime &rhs) const
Definition: AlertObserverInterface.h:147
The alert has been scheduled to trigger at a future time.
int second
Seconds in [0-59].
Definition: AlertObserverInterface.h:156
static std::string originalTimeToString(const OriginalTime &originalTime)
Definition: AlertObserverInterface.h:294
::std::string string
Definition: gtest-port.h:1097
static bool withinBounds(T value, T minVal, T maxVal)
Definition: AlertObserverInterface.h:53
static const int ORIGINAL_TIME_MINUTE_MAX
The maximum value for the minute field in OriginalTime.
Definition: AlertObserverInterface.h:38
Definition: AlertObserverInterface.h:31
State state
The state of the alert.
Definition: AlertObserverInterface.h:205
std::chrono::system_clock::time_point scheduledTime
UTC timestamp for when the alert is scheduled.
Definition: AlertObserverInterface.h:207
Definition: AlertObserverInterface.h:112
The alert has entered the foreground.
avsCommon::utils::Optional< std::string > label
An optional label for the content of an alert.
Definition: AlertObserverInterface.h:212
The alert is ready to start, and is waiting for channel focus.
int minute
Minutes in [0-59].
Definition: AlertObserverInterface.h:154
static std::string typeToString(Type type)
Definition: AlertObserverInterface.h:282
int hour
Hours in [0-23].
Definition: AlertObserverInterface.h:152
Definition: Optional.h:32
The alert has stopped due to user or system intervention.
The alert has entered the background.
Definition: AlertObserverInterface.h:171
std::ostream & operator<<(std::ostream &stream, const AlertObserverInterface::State &state)
Definition: AlertObserverInterface.h:309
Type
Definition: AlertObserverInterface.h:88
static const int ORIGINAL_TIME_FIELD_MIN
The minimum value for the field in OriginalTime.
Definition: AlertObserverInterface.h:34
The alert has been deleted.
virtual void onAlertStateChange(const AlertInfo &alertInfo)=0
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
State
Definition: AlertObserverInterface.h:60
avsCommon::utils::Optional< OriginalTime > originalTime
Definition: AlertObserverInterface.h:210
int millisecond
Milliseconds in [0-999].
Definition: AlertObserverInterface.h:158
virtual ~AlertObserverInterface()=default
type
Definition: upload.py:443
AlertInfo(const std::string &token, const Type type, const State state, const std::chrono::system_clock::time_point &scheduledTime, const avsCommon::utils::Optional< OriginalTime > &originalTime=avsCommon::utils::Optional< OriginalTime >(), const avsCommon::utils::Optional< std::string > &label=avsCommon::utils::Optional< std::string >(), const std::string &reason="")
Definition: AlertObserverInterface.h:183
static std::string stateToString(State state)
Definition: AlertObserverInterface.h:254
OriginalTime(int hour=ORIGINAL_TIME_FIELD_MIN, int minute=ORIGINAL_TIME_FIELD_MIN, int second=ORIGINAL_TIME_FIELD_MIN, int millisecond=ORIGINAL_TIME_FIELD_MIN)
Definition: AlertObserverInterface.h:121
The alert has completed on its own.
static const int ORIGINAL_TIME_HOUR_MAX
The maximum value for the hour field in OriginalTime.
Definition: AlertObserverInterface.h:36
The alert has been determined to be past-due, and will not be rendered.
Type type
The type of the alert.
Definition: AlertObserverInterface.h:203
static const int ORIGINAL_TIME_MILLISECOND_MAX
The maximum value for the millisecond field in OriginalTime.
Definition: AlertObserverInterface.h:42
The alert has encountered an error.