ESPHome
2026.11.0-dev
Loading...
Searching...
No Matches
esphome
components
remote_base
magiquest_protocol.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
remote_base.h
"
4
5
#include <cinttypes>
6
7
/* Based on protocol analysis from
8
* https://arduino-irremote.github.io/Arduino-IRremote/ir__MagiQuest_8hpp_source.html
9
*/
10
11
namespace
esphome::remote_base
{
12
13
// Older decoders read the wand id 5 bits too early, so ids in older configs lack its 5 low bits.
14
static
constexpr
uint8_t MAGIQUEST_LEGACY_WAND_ID_SHIFT = 5;
15
16
struct
MagiQuestData
{
17
uint16_t
magnitude
;
18
uint32_t
wand_id
;
19
20
// Not symmetric: `this` is the decoded frame and `rhs` the configured match. A configured wand_id of 0 matches
21
// any wand. Magnitude is not compared; it appears to encode the cast type rather than a strength. The legacy
22
// match applies to every configured id, so an id below 2^26 also matches the 32 wands whose full id shifts to it.
23
bool
operator==
(
const
MagiQuestData
&rhs)
const
{
24
return
rhs.
wand_id
== 0 || rhs.
wand_id
== this->wand_id ||
25
rhs.
wand_id
== (this->wand_id >> MAGIQUEST_LEGACY_WAND_ID_SHIFT);
26
}
27
};
28
29
class
MagiQuestProtocol
:
public
RemoteProtocol
<MagiQuestData> {
30
public
:
31
void
encode
(
RemoteTransmitData
*dst,
const
MagiQuestData
&data);
32
optional<MagiQuestData>
decode
(
RemoteReceiveData
src
);
33
void
dump
(
const
MagiQuestData
&data);
34
};
35
36
DECLARE_REMOTE_PROTOCOL(MagiQuest)
37
38
}
// namespace esphome::remote_base
esphome::remote_base::MagiQuestProtocol
Definition
magiquest_protocol.h:29
esphome::remote_base::MagiQuestProtocol::decode
optional< MagiQuestData > decode(RemoteReceiveData src)
Definition
magiquest_protocol.cpp:56
esphome::remote_base::MagiQuestProtocol::dump
void dump(const MagiQuestData &data)
Definition
magiquest_protocol.cpp:97
esphome::remote_base::MagiQuestProtocol::encode
void encode(RemoteTransmitData *dst, const MagiQuestData &data)
Definition
magiquest_protocol.cpp:30
esphome::remote_base::RemoteProtocol
Definition
remote_base.h:390
esphome::remote_base::RemoteReceiveData
Definition
remote_base.h:88
esphome::remote_base::RemoteTransmitData
Definition
remote_base.h:39
esphome::remote_base
Definition
ir_rf_base.cpp:222
esphome::src
const void * src
Definition
hal.h:68
remote_base.h
uint32_t
static void uint32_t
Definition
crash_handler.cpp:153
esphome::remote_base::MagiQuestData
Definition
magiquest_protocol.h:16
esphome::remote_base::MagiQuestData::operator==
bool operator==(const MagiQuestData &rhs) const
Definition
magiquest_protocol.h:23
esphome::remote_base::MagiQuestData::wand_id
uint32_t wand_id
Definition
magiquest_protocol.h:18
esphome::remote_base::MagiQuestData::magnitude
uint16_t magnitude
Definition
magiquest_protocol.h:17
Generated by
1.12.0