LightHub
4.6.0
Open-source smart home controller firmware
Toggle main menu visibility
Loading...
Searching...
No Matches
out_mercury.h
Go to the documentation of this file.
1
#pragma once
2
#include "
options.h
"
3
#ifdef MERCURY_ENABLE
4
#include <
abstractout.h
>
5
#include <
item.h
>
6
#include "
itemCmd.h
"
7
#include <
utils.h
>
8
#include <Arduino.h>
9
10
11
15
class
mercuryPersistent :
public
chPersistent
{
16
17
public
:
18
uint32_t timestamp;
19
uint32_t lastSuccessTS;
20
};
21
23
#define MB_NEED_SEND 8
24
#define MB_SEND_ERROR 4
25
#define MB_SEND_ATTEMPTS 3
26
33
#define M_CONNECTING CST_USER+0
34
#define M_CONNECTED CST_USER+1
35
#define M_POLLING1 CST_USER+2
36
#define M_POLLING2 CST_USER+3
37
#define M_POLLING3 CST_USER+4
38
#define M_POLLING4 CST_USER+5
39
#define M_POLLING5 CST_USER+6
40
#define M_POLLING6 CST_USER+7
41
#define M_POLLING7 CST_USER+8
42
#define M_POLLING8 CST_USER+9
43
45
#define RET_SUCCESS 0
46
#define RET_INVALID_PARAM 1
47
#define RET_INTERROR 2
48
#define RET_ACCESS_LEVEL 3
49
#define RET_RTC_ERR 4
50
#define RET_NOT_CONNECTED 3
51
52
74
class
out_Mercury :
public
abstractOut
{
75
public
:
76
77
//out_Mercury(Item * _item):abstractOut(_item){store = (mercuryPersistent *) item->getPersistent();};
79
out_Mercury():store(NULL){};
81
void
link(Item * _item){
abstractOut::link
(_item);
if
(_item) {store = (mercuryPersistent *) item->getPersistent();}
else
store = NULL;};
82
84
int
Setup()
override
;
86
int
Poll(
short
cause)
override
;
88
int
Stop()
override
;
90
int
getChanType()
override
;
92
int
Ctrl(itemCmd cmd,
char
* subItem=NULL,
bool
toExecute=
true
,
bool
authorized =
false
)
override
;
93
94
95
protected
:
96
mercuryPersistent * store;
97
uint32_t pollingInterval;
98
bool
getConfig();
99
void
initLine(
bool
full =
false
);
100
short
connectMercury();
101
short
disconnectMercury();
102
short
getCurrentVal12(
byte
param, String topic,
int
divisor=1);
103
short
getCurrentVal15(
byte
param, String topic,
int
divisor=1);
104
short
getCounters (
byte
when, String topic,
int
divisor=1);
105
106
};
107
#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
options.h
utils.h
Utility helpers of LightHub.
lighthub
modules
out_mercury.h
Generated by
1.18.0