forked from DanNixon/NeoNextion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathINextionBooleanValued.h
49 lines (43 loc) · 1.06 KB
/
INextionBooleanValued.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*! \file */
#ifndef __NEONEXTION_INEXTIONBOOLEANVALUED
#define __NEONEXTION_INEXTIONBOOLEANVALUED
#include "Nextion.h"
#include "INextionNumericalValued.h"
#include "NextionTypes.h"
/*!
* \class INextionBooleanValued
* \brief Interface for widgets that store a boolean value.
*
* Assumes that the boolean value is a property named "val".
*/
class INextionBooleanValued : private INextionNumericalValued
{
public:
/*!
* \copydoc INextionWidget::INextionWidget
*/
INextionBooleanValued(Nextion &nex, uint8_t page, uint8_t component,
const char *name)
: INextionWidget(nex, page, component, name)
, INextionNumericalValued(nex, page, component, name)
{
}
/*!
* \brief Gets the state of the boolean value of the control.
* \return True if boolean state is active
*/
bool isActive()
{
return getValue();
}
/*!
* \brief Sets the state of the boolean value.
* \param active State
* \return True if successful
*/
bool setActive(bool active)
{
return setValue((uint32_t)active);
}
};
#endif