SpaIot Library
Loading...
Searching...
No Matches
button.h
1
/*
2
SpaIot Library (c) by epsilonrt - epsilonrt@epsilonrt.fr
3
This file is part of SpaIot library <https://github.com/epsilonrt/spaiot-lib>
4
5
SPDX-License-Identifier: BSD-3-Clause
6
7
SpaIot library is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY;
9
*/
10
#pragma once
11
12
#include "buttonsettings.h"
13
#include "buttoncontroller.h"
14
#include "multiplexer.h"
15
#include "pcf8574mux.h"
16
17
namespace
SpaIot
{
18
26
class
Button
{
27
28
public
:
32
Button
();
33
37
virtual
~Button
();
38
42
Button
(
const
ButtonSettings
&
settings
);
43
47
Button
(
const
Button
&other);
48
53
Button
(
Button
&&other);
54
58
Button
&
operator=
(
const
Button
&other);
59
64
Button
&
operator=
(
Button
&&other);
65
70
void
clear
();
71
75
bool
isNull
()
const
;
76
80
bool
isEmpty
()
const
;
81
85
bool
operator==
(
const
Button
&other)
const
;
86
90
bool
operator!=
(
const
Button
&other)
const
;
91
95
int
id
()
const
;
96
100
const
ButtonController
&
ctrl
()
const
;
101
105
ButtonController
&
ctrl
();
106
110
const
ButtonSettings
&
settings
()
const
;
111
115
void
begin
();
116
120
void
press
();
121
125
void
release
();
126
130
void
push
();
131
135
bool
isOpen
()
const
;
136
140
bool
isPressed
()
const
;
141
142
protected
:
143
class
Private;
144
Button
(Private &dd);
145
std::unique_ptr<Private> d_ptr;
146
private
:
147
PIMPL_DECLARE_PRIVATE (
Button
)
148
};
149
}
SpaIot::ButtonController
This class is the base class of all button controllers.
Definition
buttoncontroller.h:26
SpaIot::Button
This class represents a button.
Definition
button.h:26
SpaIot::Button::release
void release()
Releases the button.
SpaIot::Button::Button
Button(const ButtonSettings &settings)
The constructor for the Button class with settings.
SpaIot::Button::isPressed
bool isPressed() const
Checks if the button is pressed.
SpaIot::Button::push
void push()
Presses and releases the button, HoldPressedMs milliseconds is the time the button is pressed.
SpaIot::Button::ctrl
ButtonController & ctrl()
Returns the button controller used by the button.
SpaIot::Button::settings
const ButtonSettings & settings() const
Returns the settings of the button.
SpaIot::Button::id
int id() const
Returns the button identification key in the possible values of SpaIot::Key.
SpaIot::Button::isEmpty
bool isEmpty() const
Checks if all attributes are set to their default values (same as the default constructor)
SpaIot::Button::operator=
Button & operator=(const Button &other)
Sets the Button object to be equal to other.
SpaIot::Button::ctrl
const ButtonController & ctrl() const
Returns the button controller used by the button.
SpaIot::Button::operator!=
bool operator!=(const Button &other) const
Checks if the two objects are not equal.
SpaIot::Button::~Button
virtual ~Button()
Destructor.
SpaIot::Button::Button
Button(const Button &other)
Copy Constructor.
SpaIot::Button::Button
Button(Button &&other)
Move Constructor after the move, other is null, other.clear() must be called if it is to be used agai...
SpaIot::Button::operator==
bool operator==(const Button &other) const
Checks if the two objects are equal.
SpaIot::Button::isOpen
bool isOpen() const
Checks if the button is opened.
SpaIot::Button::Button
Button()
The default constructor.
SpaIot::Button::isNull
bool isNull() const
Returns true if the object is null (i.e. it has not been initialized, d_ptr is null)
SpaIot::Button::begin
void begin()
Initializes the button, if its controller is not initialized, it is initialized.
SpaIot::Button::press
void press()
Presses the button, it is not released automatically.
SpaIot::Button::clear
void clear()
Clears the Button object After the call to this function, the Button object is the same as one that h...
SpaIot::ButtonSettings
This class represents the settings of a button.
Definition
buttonsettings.h:27
SpaIot
SpaIot name space.
Definition
bussettings.h:15
src
button.h
Generated by
1.9.8