supla-device
Toggle main menu visibility
Loading...
Searching...
No Matches
src
supla
local_action.h
1
/*
2
Copyright (C) AC SOFTWARE SP. Z O.O.
3
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License
6
as published by the Free Software Foundation; either version 2
7
of the License, or (at your option) any later version.
8
This program is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15
*/
16
17
#ifndef SRC_SUPLA_LOCAL_ACTION_H_
18
#define SRC_SUPLA_LOCAL_ACTION_H_
19
20
#include <stdint.h>
21
22
namespace
Supla {
23
24
class
ActionHandler
;
25
class
LocalAction
;
26
27
class
ActionHandlerClient {
28
public
:
29
ActionHandlerClient();
30
31
virtual
~ActionHandlerClient();
32
33
LocalAction
*trigger =
nullptr
;
34
ActionHandler
*client =
nullptr
;
35
ActionHandlerClient *next =
nullptr
;
36
uint16_t onEvent = 0;
37
uint16_t action = 0;
38
static
ActionHandlerClient *begin;
39
40
bool
isEnabled();
41
42
virtual
void
setAlwaysEnabled();
43
virtual
void
enable();
44
virtual
void
disable();
45
virtual
bool
isAlwaysEnabled();
46
47
protected
:
48
bool
enabled =
true
;
49
bool
alwaysEnabled =
false
;
50
};
51
52
class
LocalAction
{
53
public
:
54
virtual
~LocalAction
();
55
virtual
void
addAction(uint16_t action,
56
ActionHandler
&client,
// NOLINT(runtime/references)
57
uint16_t event,
58
bool
alwaysEnabled =
false
);
59
virtual
void
addAction(uint16_t action,
ActionHandler
*client, uint16_t event,
60
bool
alwaysEnabled =
false
);
61
62
virtual
void
runAction(uint16_t event)
const
;
63
64
virtual
bool
isEventAlreadyUsed(uint16_t event,
bool
ignoreAlwaysEnabled);
65
virtual
ActionHandlerClient
*getHandlerForFirstClient(uint16_t event);
66
virtual
ActionHandlerClient
*getHandlerForClient(
ActionHandler
*client,
67
uint16_t event);
68
69
virtual
void
disableOtherClients(
const
ActionHandler
&client, uint16_t event);
70
virtual
void
enableOtherClients(
const
ActionHandler
&client, uint16_t event);
71
virtual
void
disableOtherClients(
const
ActionHandler
*client, uint16_t event);
72
virtual
void
enableOtherClients(
const
ActionHandler
*client, uint16_t event);
73
74
static
void
DeleteActionsHandledBy(
const
ActionHandler
*client);
75
static
void
DeleteActionsTriggeredBy(
const
LocalAction
*action);
76
static
void
NullifyActionsHandledBy(
const
ActionHandler
*client);
77
78
// action and event are internally uint16_t type, however -1 is used
79
// as "all events/actions", so here we pass int32_t
80
virtual
void
disableAction(int32_t action,
81
ActionHandler
*client,
82
int32_t event);
83
virtual
void
enableAction(int32_t action,
84
ActionHandler
*client,
85
int32_t event);
86
87
virtual
bool
disableActionsInConfigMode();
88
89
static
ActionHandlerClient
*getClientListPtr();
90
};
91
92
};
// namespace Supla
93
94
#endif
// SRC_SUPLA_LOCAL_ACTION_H_
Supla::ActionHandlerClient
Definition
local_action.h:27
Supla::ActionHandler
Definition
action_handler.h:21
Supla::LocalAction
Definition
local_action.h:52
Generated by
1.17.0