LightHub
4.6.0
Open-source smart home controller firmware
Toggle main menu visibility
Loading...
Searching...
No Matches
out_elevator.h
Go to the documentation of this file.
1
#pragma once
2
#include "
options.h
"
3
#ifdef ELEVATOR_ENABLE
4
#include <
abstractout.h
>
5
#include <
item.h
>
6
#include "
itemCmd.h
"
7
#include "
utils.h
"
8
9
#if defined(ESP32)
10
#define serialParamType uint32_t
11
#else
12
#define serialParamType uint16_t
13
#endif
14
15
#define MAX_PDU 64
16
17
#ifndef MODULE_UATRBRIDGE_UARTA
18
#define MODULE_UATRBRIDGE_UARTA Serial1
19
#endif
20
21
#ifndef MODULE_UATRBRIDGE_UARTB
22
#define MODULE_UATRBRIDGE_UARTB Serial2
23
#endif
24
25
#ifndef MODULE_UATRBRIDGE_UARTA_RX_PIN
26
#define MODULE_UATRBRIDGE_UARTA_RX_PIN 15
27
#endif
28
29
#ifndef MODULE_UATRBRIDGE_UARTA_TX_PIN
30
#define MODULE_UATRBRIDGE_UARTA_TX_PIN 2
31
#endif
32
33
#ifndef MODULE_UATRBRIDGE_UARTB_RX_PIN
34
#define MODULE_UATRBRIDGE_UARTB_RX_PIN -1
35
#endif
36
37
#ifndef MODULE_UATRBRIDGE_UARTB_TX_PIN
38
#define MODULE_UATRBRIDGE_UARTB_TX_PIN -1
39
#endif
40
44
class
ubPersistent :
public
chPersistent
{
45
46
public
:
47
// int addr
48
int8_t driverStatus;
49
int
baud;
50
serialParamType
serialParam;
51
//uint16_t pollingInterval;
52
//uint32_t timestamp;
53
//aJsonObject * pollingRegisters;
54
//aJsonObject * pollingIrs;
55
//aJsonObject * parameters;
56
};
57
58
#define PDELAY 10
59
79
class
out_elevator :
public
abstractOut
{
80
public
:
81
82
//out_elevator(Item * _item):abstractOut(_item){store = (ubPersistent *) item->getPersistent();};
84
out_elevator():store(NULL){};
86
void
link(Item * _item){
abstractOut::link
(_item);
if
(_item) {store = (ubPersistent *) item->getPersistent();}
else
store = NULL;};
87
89
int
Setup()
override
;
91
int
Poll(
short
cause)
override
;
93
int
Stop()
override
;
95
int
Status()
override
;
97
int
getChanType()
override
;
99
int
Ctrl(itemCmd cmd,
char
* subItem=NULL,
bool
toExecute=
true
,
bool
authorized =
false
)
override
;
101
int
getDefaultStorageType(){
return
ST_INT32
;};
103
virtual
bool
isAllowed(itemCmd cmd)
override
;
104
105
106
protected
:
107
ubPersistent * store;
108
bool
getConfig();
109
void
checkSignature(String curStr);
110
void
flushA();
111
void
flushB();
112
};
113
#endif
abstractout.h
abstractOut
Base class of output driver modules (one per channel type).
Definition
abstractout.h:19
abstractOut::link
virtual void link(Item *_item)
Definition
abstractout.h:24
chPersistent
Placeholder for driver-persistent data attached to an item (I_EXT field).
Definition
abstractout.h:8
item.h
Item (virtual channel) system of LightHub.
itemCmd.h
ST_INT32
#define ST_INT32
Definition
itemCmd.h:226
options.h
utils.h
Utility helpers of LightHub.
serialParamType
#define serialParamType
Type for a serial parameter (uint32 on ESP32, uint16 elsewhere).
Definition
utils.h:65
lighthub
modules
out_elevator.h
Generated by
1.18.0