OOKwiz
on/off-keying for ESP32 and a variety of supported radio modules
src
Meaning.h
Go to the documentation of this file.
1
#
ifndef
_MEANING_H_
2
#
define
_MEANING_H_
3
4
#
include
<
vector
>
5
#
include
<
Arduino
.
h
>
6
#
include
"config.h"
7
8
class
Pulsetrain
;
9
10
/// @brief Encodes type of modulation for a MeaningElement
11
typedef
enum
modulation
{
12
UNKNOWN
,
13
PULSE
,
14
GAP
,
15
PWM
,
16
PPM
17
} modulation;
18
19
/// @brief Chunks of parsed packet. Either a pulse, a gap or a block of decoded data
20
typedef
struct
MeaningElement
{
21
modulation
type
;
22
std
::
vector
<
uint8_t
>
data
;
23
uint16_t
data_len
;
// in bits
24
uint16_t
time1
;
25
uint16_t
time2
;
26
uint16_t
time3
;
27
} MeaningElement;
28
29
/// @brief Holds the parsed packet as a collection of MeaningElements
30
class
Meaning
{
31
public
:
32
/// @brief The MeaningElement structs that make up the parsed packet
33
std
::
vector
<
MeaningElement
>
elements
;
34
/// @brief Set when there were no repetitions and the number of bits detected is not divisible by 4
35
bool
suspected_incomplete
=
false
;
36
/// @brief Number of repeats of the signal
37
uint16_t
repeats
= 0;
38
/// @brief Shortest time between two repetitions
39
uint16_t
gap
= 0;
40
41
static
bool
maybe
(String str);
42
operator
bool
();
43
void
zap
();
44
bool
fromPulsetrain
(
Pulsetrain
&train);
45
Pulsetrain
toPulsetrain
();
46
bool
addPulse
(uint16_t pulse_time);
47
bool
addGap
(uint16_t pulse_time);
48
bool
addPWM
(
int
space,
int
mark,
int
bits, uint8_t* tmp_data);
49
bool
addPPM
(
int
space,
int
mark,
int
filler,
int
bits, uint8_t* tmp_data);
50
String
toString
();
51
bool
fromString
(String in);
52
int
parsePWM
(
const
Pulsetrain
&train,
int
from,
int
to,
int
space,
int
mark);
53
int
parsePPM
(
const
Pulsetrain
&train,
int
from,
int
to,
int
space,
int
mark,
int
filler);
54
};
55
56
#
endif
Generated by
1.9.1