supla-device
Loading...
Searching...
No Matches
src
supla
device
last_state_logger.h
1
// SPDX-FileCopyrightText: AC SOFTWARE SP. Z O.O.
2
// SPDX-License-Identifier: GPL-2.0-or-later
3
4
#ifndef SRC_SUPLA_DEVICE_LAST_STATE_LOGGER_H_
5
#define SRC_SUPLA_DEVICE_LAST_STATE_LOGGER_H_
6
7
#define LAST_STATE_LOGGER_BUFFER_SIZE 500
8
9
#include <stddef.h>
10
11
namespace
Supla {
12
class
Mutex;
13
14
namespace
Device {
15
class
LastStateLogger
{
16
public
:
17
LastStateLogger
();
18
virtual
~LastStateLogger
();
19
virtual
void
log(
const
char
*,
int
uptimeSec);
20
virtual
void
clear();
21
22
// getLog locks the mutex on first call and releases it when all messages
23
// have been read, so make sure you call it in a loop until null is returned
24
virtual
char
*getLog();
25
virtual
bool
prepareLastStateLog();
26
27
protected
:
28
char
buffer[LAST_STATE_LOGGER_BUFFER_SIZE] = {};
29
size_t
index = 0;
30
Supla::Mutex
*mutex =
nullptr
;
31
};
32
};
// namespace Device
33
};
// namespace Supla
34
35
#endif
// SRC_SUPLA_DEVICE_LAST_STATE_LOGGER_H_
Supla::Device::LastStateLogger
Definition
last_state_logger.h:15
Supla::Mutex
Definition
mutex.h:9
Generated by
1.12.0