OOKwiz
on/off-keying for ESP32 and a variety of supported radio modules
src
Device.h
Go to the documentation of this file.
1
#
ifndef
_DEVICE_H_
2
#
define
_DEVICE_H_
3
4
#
include
<
Arduino
.
h
>
5
#
include
"config.h"
6
#
include
"RawTimings.h"
7
#
include
"Pulsetrain.h"
8
#
include
"Meaning.h"
9
#
include
"tools.h"
10
11
#
define
DEVICE_PLUGIN_START
(
name
)
12
namespace
ook
{
13
namespace
device_
##
name
{
14
class
DevicePlugin
:
public
Device
{
15
public
:
16
17
#
define
DEVICE_PLUGIN_END
(
name
)
18
}
;
19
struct
AutoRegister
{
20
AutoRegister
(
)
{
21
static
DevicePlugin
devicePlugin
;
22
Device
::
add
(
#
name
,
static_cast
<
Device
*
>
(
&
devicePlugin
)
)
;
23
}
24
}
autoRegister
;
25
26
}
27
}
28
29
30
// Device::store cannot become an std::vector because of the auto-register trick.
31
32
class
Device
{
33
public
:
34
static
struct
{
35
Device
*
pointer
;
36
char
name
[
MAX_DEVICE_NAME_LEN
];
37
} store[
MAX_DEVICES
];
38
static
int
len
;
39
static
bool
setup
();
40
static
bool
add
(
const
char
* name,
Device
*pointer);
41
static
String
list
(
String
separator
=
", "
);
42
static
bool
new_packet
(
RawTimings
&raw,
Pulsetrain
&train,
Meaning
&meaning);
43
static
bool
transmit
(
const
String &plugin_name,
const
String &toTransmit);
44
virtual
bool
receive
(
const
RawTimings
&raw,
const
Pulsetrain
&train,
const
Meaning
&meaning);
45
virtual
bool
transmit
(
const
String &toTransmit);
46
};
47
48
49
#
endif
Generated by
1.9.1