LightHub  v4.0.0
Smarthome controller firmware
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 
41 class ubPersistent : public chPersistent {
42 
43 public:
44 // int addr
45  int8_t driverStatus;
46  int baud;
47  serialParamType serialParam;
48  //uint16_t pollingInterval;
49  //uint32_t timestamp;
50  //aJsonObject * pollingRegisters;
51  //aJsonObject * pollingIrs;
52  //aJsonObject * parameters;
53 };
54 
55 #define PDELAY 10
56 
57 class out_elevator : public abstractOut {
58 public:
59 
60  out_elevator(Item * _item):abstractOut(_item){store = (ubPersistent *) item->getPersistent();};
61  int Setup() override;
62  int Poll(short cause) override;
63  int Stop() override;
64  int Status() override;
65  int getChanType() override;
66  int Ctrl(itemCmd cmd, char* subItem=NULL, bool toExecute=true) override;
67  int getDefaultStorageType(){return ST_INT32;};
68 
69 
70 protected:
71  ubPersistent * store;
72  bool getConfig();
73  void checkSignature(String curStr);
74  void flushA();
75  void flushB();
76 };
77 #endif
abstractOut::Ctrl
virtual int Ctrl(itemCmd cmd, char *subItem=NULL, bool toExecute=true)=0
itemCmd.h
itemCmd
Definition: itemCmd.h:153
abstractCh::Stop
virtual int Stop()
Definition: abstractch.h:15
chPersistent
Definition: abstractout.h:7
ST_INT32
#define ST_INT32
Definition: itemCmd.h:96
serialParamType
#define serialParamType
Definition: utils.h:49
options.h
abstractOut
Definition: abstractout.h:8
utils.h
abstractOut::getDefaultStorageType
virtual int getDefaultStorageType()
Definition: abstractout.h:15
Item
Definition: item.h:104
abstractout.h
abstractOut::Setup
int Setup() override
Remove?? Now getChanType used instead.
Definition: abstractout.cpp:20
abstractCh::Poll
virtual int Poll(short cause)=0
abstractOut::getChanType
virtual int getChanType()
Definition: abstractout.h:14
abstractCh::Status
virtual int Status()
Definition: abstractch.h:16
item.h