Class ClockState

Class Documentation

class ClockState

The clockState is responsible to hold all the data that needs to be communicated between components. It can be imagined as kind of like an “object oriented global variable”.

Public Types

enum ClockStates

Avaliable clock modes each with a different behaviour.

Values:

enumerator CLOCK_MODE
enumerator TIMER_MODE
enumerator TIMER_NOTIFICATION
enumerator ALARM_NOTIFICATION

Public Functions

~ClockState()

Destroys the ClockState object and cause ClockState::getInstance to create a new object the next time it is called.

void switchMode(ClockStates newState)

Switch the current mode of the clock.

ClockStates getMode()

Returns the current mode of the clock.

void handleStates()

Has to be called periodically to update the screen and process state transitions within the state machine.

Public Members

uint8_t clockBrightness

Base brightness of the clock. The actual brightness can still change if a light sensor is used.

uint8_t nightModeBrightness

Brightness of the clock driing nighttime hours define by ClockState::NightModeStartTime and ClockState::NightModeStopTime.

TimeManager::TimeInfo NightModeStartTime

Any time after will be considered nighttime as long as it is still lower than ClockState::NightModeStopTime.

TimeManager::TimeInfo NightModeStopTime

Any time before will be considered nighttime as long as it is still higher than ClockState::NightModeStartTime.

uint8_t numDots

defines the number of dots. 0 -> no dot; 1 -> one dot; 2 -> two dots; other-> one dot

Public Static Functions

static ClockState *getInstance()

Get the instance of the Clock object or create it if it was not yet instantiated.

Returns:

ClockState* returns the address to the ClockState object