//
#include "Define.h"
//
#ifndef Switch_h
#define Switch_h
//
enum EStateSwitch
{
    sswUndefined = 0,
    sswOff = 1,
    sswOn = 2
};
//
typedef void (*TOnStateSwitchChanged)(EStateSwitch state);
//
class CSwitch
{
    private:
    EStateSwitch FState;
    bool FInverted;
    int FPinSwitch;
    long unsigned FTicksPreset;
    TOnStateSwitchChanged FOnStateSwitchChanged;
    //
    public:
    CSwitch(int pinswitch, bool inverted,
            TOnStateSwitchChanged onstateswitchchanged);
    //
    bool ReadLevel(void);
    EStateSwitch GetState(void) { return FState; }
    void SetState(EStateSwitch state);
    EStateSwitch ReadState(void);
    //
    bool Open(void);
    bool Close(void);
    //
    void Execute(void);
};
//
#endif // Switch
//
