You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

130 lines
3.9 KiB

#ifndef ControlState_h
#define ControlState_h
#include <States.h>
#include <AT24C32.h>
#include <DS3231.h>
/*
abstract control state
*/
class ControlState
{
public:
virtual void leftPressed(ViewStates &viewState, ControlStates &controlState) = 0;
virtual void rightPressed(ViewStates &viewState, ControlStates &controlState) = 0;
virtual void enterPressed(ViewStates &viewState, ControlStates &controlState) = 0;
virtual void decrementPressed(ViewStates &viewState, ControlStates &controlState) = 0;
virtual void incrementPressed(ViewStates &viewState, ControlStates &controlState) = 0;
};
/*
control view state
*/
class ControlViewState : public ControlState
{
public:
ControlViewState(AT24C32 &_at24c32);
void leftPressed(ViewStates &viewState, ControlStates &controlState);
void rightPressed(ViewStates &viewState, ControlStates &controlState);
void enterPressed(ViewStates &viewState, ControlStates &controlState);
void decrementPressed(ViewStates &viewState, ControlStates &controlState);
void incrementPressed(ViewStates &viewState, ControlStates &controlState);
protected:
AT24C32 at24c32;
};
/*
control time state
*/
class ControlTimeState : public ControlState
{
public:
ControlTimeState(DS3231 &_ds3231, AT24C32 &_at24c32);
void leftPressed(ViewStates &viewState, ControlStates &controlState);
void rightPressed(ViewStates &viewState, ControlStates &controlState);
void enterPressed(ViewStates &viewState, ControlStates &controlState);
void decrementPressed(ViewStates &viewState, ControlStates &controlState);
void incrementPressed(ViewStates &viewState, ControlStates &controlState);
protected:
DS3231 ds3231;
AT24C32 at24c32;
};
/*
control seconds state
*/
class ControlSecondsState : public ControlState
{
public:
ControlSecondsState(DS3231 &_ds3231);
void leftPressed(ViewStates &viewState, ControlStates &controlState);
void rightPressed(ViewStates &viewState, ControlStates &controlState);
void enterPressed(ViewStates &viewState, ControlStates &controlState);
void decrementPressed(ViewStates &viewState, ControlStates &controlState);
void incrementPressed(ViewStates &viewState, ControlStates &controlState);
protected:
DS3231 ds3231;
};
/*
control date state
*/
class ControlDateState : public ControlState
{
public:
ControlDateState(DS3231 &_ds3231);
void leftPressed(ViewStates &viewState, ControlStates &controlState);
void rightPressed(ViewStates &viewState, ControlStates &controlState);
void enterPressed(ViewStates &viewState, ControlStates &controlState);
void decrementPressed(ViewStates &viewState, ControlStates &controlState);
void incrementPressed(ViewStates &viewState, ControlStates &controlState);
protected:
DS3231 ds3231;
};
/*
control color value state
*/
class ControlColorState : public ControlState
{
public:
ControlColorState(AT24C32 &_at24c32);
void leftPressed(ViewStates &viewState, ControlStates &controlState);
void rightPressed(ViewStates &viewState, ControlStates &controlState);
void enterPressed(ViewStates &viewState, ControlStates &controlState);
void decrementPressed(ViewStates &viewState, ControlStates &controlState);
void incrementPressed(ViewStates &viewState, ControlStates &controlState);
protected:
AT24C32 at24c32;
void decrementColorR();
void incrementColorR();
void decrementColorG();
void incrementColorG();
void decrementColorB();
void incrementColorB();
};
/*
control text state
*/
class ControlTextState : public ControlState
{
public:
ControlTextState(AT24C32 &_at24c32);
void leftPressed(ViewStates &viewState, ControlStates &controlState);
void rightPressed(ViewStates &viewState, ControlStates &controlState);
void enterPressed(ViewStates &viewState, ControlStates &controlState);
void decrementPressed(ViewStates &viewState, ControlStates &controlState);
void incrementPressed(ViewStates &viewState, ControlStates &controlState);
protected:
AT24C32 at24c32;
};
#endif