ESPHome
2025.5.0
Loading...
Searching...
No Matches
esphome
components
radon_eye_ble
radon_eye_listener.cpp
Go to the documentation of this file.
1
#include "
radon_eye_listener.h
"
2
#include "
esphome/core/log.h
"
3
#include <algorithm>
4
#include <vector>
5
6
#ifdef USE_ESP32
7
8
namespace
esphome
{
9
namespace
radon_eye_ble {
10
11
static
const
char
*
const
TAG =
"radon_eye_ble"
;
12
13
bool
RadonEyeListener::parse_device
(
const
esp32_ble_tracker::ESPBTDevice
&device) {
14
if
(not device.
get_name
().empty()) {
15
// Vector containing the prefixes to search for
16
std::vector<std::string> prefixes = {
"FR:R"
,
"FR:I"
,
"FR:H"
};
17
18
// Check if the device name starts with any of the prefixes
19
if
(std::any_of(prefixes.begin(), prefixes.end(),
20
[&](
const
std::string &prefix) { return device.get_name().rfind(prefix, 0) == 0; })) {
21
// Device found
22
ESP_LOGD(TAG,
"Found Radon Eye device Name: %s (MAC: %s)"
, device.
get_name
().c_str(),
23
device.
address_str
().c_str());
24
}
25
}
26
return
false
;
27
}
28
29
}
// namespace radon_eye_ble
30
}
// namespace esphome
31
32
#endif
esphome::esp32_ble_tracker::ESPBTDevice
Definition
esp32_ble_tracker.h:63
esphome::esp32_ble_tracker::ESPBTDevice::get_name
const std::string & get_name() const
Definition
esp32_ble_tracker.h:75
esphome::esp32_ble_tracker::ESPBTDevice::address_str
std::string address_str() const
Definition
esp32_ble_tracker.cpp:724
esphome::radon_eye_ble::RadonEyeListener::parse_device
bool parse_device(const esp32_ble_tracker::ESPBTDevice &device) override
Definition
radon_eye_listener.cpp:13
log.h
esphome
Providing packet encoding functions for exchanging data with a remote host.
Definition
a01nyub.cpp:7
radon_eye_listener.h
Generated by
1.12.0