supla-device
Toggle main menu visibility
Loading...
Searching...
No Matches
src
supla
protocol
protocol_layer.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
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
*/
18
19
#ifndef SRC_SUPLA_PROTOCOL_PROTOCOL_LAYER_H_
20
#define SRC_SUPLA_PROTOCOL_PROTOCOL_LAYER_H_
21
22
#include <stdint.h>
23
#include <supla-common/proto.h>
24
25
class
SuplaDeviceClass
;
26
27
namespace
Supla {
28
29
namespace
Protocol {
30
31
class
ProtocolLayer {
32
public
:
33
explicit
ProtocolLayer(
SuplaDeviceClass
*sdc);
34
virtual
~ProtocolLayer();
35
static
ProtocolLayer *first();
36
static
ProtocolLayer *last();
37
static
bool
IsAnyUpdatePending();
38
ProtocolLayer *next();
39
SuplaDeviceClass
*getSdc();
40
41
void
setVerboseLog(
bool
value);
42
virtual
void
onInit() = 0;
43
virtual
bool
onLoadConfig() = 0;
44
virtual
bool
verifyConfig() = 0;
45
virtual
bool
isEnabled() = 0;
46
virtual
void
disconnect() = 0;
47
virtual
bool
isConfigEmpty();
48
// Return value indicates if specific protocol is ready to handle data
49
// from other elements and if call to Element::iterateConnected should be
50
// done.
51
virtual
bool
iterate(uint32_t _millis) = 0;
52
virtual
bool
isNetworkRestartRequested() = 0;
53
virtual
uint32_t getConnectionFailTime() = 0;
54
virtual
bool
isConnectionError();
55
virtual
bool
isConnecting();
56
virtual
bool
isMqtt()
const
;
57
virtual
bool
isUpdatePending();
58
virtual
bool
isRegisteredAndReady() = 0;
59
virtual
void
sendActionTrigger(uint8_t channelNumber, uint32_t actionId) = 0;
60
virtual
void
sendRemainingTimeValue(uint8_t channelNumber,
61
uint32_t timeMs,
62
uint8_t state,
63
int32_t senderId);
64
virtual
void
sendRemainingTimeValue(uint8_t channelNumber,
65
uint32_t remainingTime,
66
uint8_t* state,
67
int32_t senderId,
68
bool
useSecondsInsteadOfMs);
69
virtual
void
getUserLocaltime();
70
virtual
void
sendChannelValueChanged(uint8_t channelNumber, int8_t *value,
71
uint8_t offline, uint32_t validityTimeSec) = 0;
72
virtual
void
sendExtendedChannelValueChanged(uint8_t channelNumber,
73
TSuplaChannelExtendedValue
*value) = 0;
74
75
virtual
void
getChannelConfig(uint8_t channelNumber,
76
uint8_t configType = SUPLA_CONFIG_TYPE_DEFAULT);
77
virtual
bool
setChannelConfig(uint8_t channelNumber,
78
_supla_int_t channelFunction,
void
*channelConfig,
int
size,
79
uint8_t configType = SUPLA_CONFIG_TYPE_DEFAULT);
80
virtual
void
notifyConfigChange(
int
channelNumber);
81
82
virtual
bool
setDeviceConfig(
TSDS_SetDeviceConfig
*deviceConfig);
83
virtual
bool
setInitialCaption(uint8_t channelNumber,
const
char
*caption);
84
85
virtual
void
sendRegisterNotification(
86
TDS_RegisterPushNotification
*notification);
87
virtual
bool
sendNotification(
int
context,
88
const
char
*title,
89
const
char
*message,
90
int
soundId);
91
virtual
void
sendSubdeviceDetails(
TDS_SubdeviceDetails
*subdeviceDetails);
92
virtual
void
sendChannelStateResult(int32_t receiverId, uint8_t channelNo);
93
94
protected
:
95
static
ProtocolLayer *firstPtr;
96
ProtocolLayer *nextPtr =
nullptr
;
97
SuplaDeviceClass
*sdc =
nullptr
;
98
bool
configEmpty =
true
;
99
bool
verboseLog =
false
;
100
};
101
102
}
// namespace Protocol
103
}
// namespace Supla
104
105
#endif
// SRC_SUPLA_PROTOCOL_PROTOCOL_LAYER_H_
SuplaDeviceClass
Definition
SuplaDevice.h:163
TDS_RegisterPushNotification
Definition
proto.h:3874
TDS_SubdeviceDetails
Definition
proto.h:3900
TSDS_SetDeviceConfig
Definition
proto.h:2885
TSuplaChannelExtendedValue
Definition
proto.h:782
Generated by
1.17.0