ESPHome 2025.5.0
Loading...
Searching...
No Matches
radon_eye_rd200.h
Go to the documentation of this file.
1#pragma once
2
3#ifdef USE_ESP32
4
5#include <esp_gattc_api.h>
6#include <algorithm>
7#include <iterator>
12#include "esphome/core/log.h"
13
14namespace esphome {
15namespace radon_eye_rd200 {
16
17static const char *const SERVICE_UUID = "00001523-1212-efde-1523-785feabcd123";
18static const char *const WRITE_CHARACTERISTIC_UUID = "00001524-1212-efde-1523-785feabcd123";
19static const char *const READ_CHARACTERISTIC_UUID = "00001525-1212-efde-1523-785feabcd123";
20
22 public:
24
25 void dump_config() override;
26 void update() override;
27
28 void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
29 esp_ble_gattc_cb_param_t *param) override;
30
31 void set_radon(sensor::Sensor *radon) { radon_sensor_ = radon; }
32 void set_radon_long_term(sensor::Sensor *radon_long_term) { radon_long_term_sensor_ = radon_long_term; }
33
34 protected:
35 bool is_valid_radon_value_(float radon);
36
37 void read_sensors_(uint8_t *value, uint16_t value_len);
40
43
44 uint16_t read_handle_;
45 uint16_t write_handle_;
49
50 union RadonValue {
51 char chars[4];
52 float number;
53 };
54};
55
56} // namespace radon_eye_rd200
57} // namespace esphome
58
59#endif // USE_ESP32
This class simplifies creating components that periodically check a state.
Definition component.h:301
void read_sensors_(uint8_t *value, uint16_t value_len)
void set_radon_long_term(sensor::Sensor *radon_long_term)
esp32_ble_tracker::ESPBTUUID sensors_write_characteristic_uuid_
esp32_ble_tracker::ESPBTUUID service_uuid_
esp32_ble_tracker::ESPBTUUID sensors_read_characteristic_uuid_
void set_radon(sensor::Sensor *radon)
void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t *param) override
Base-class for all sensors.
Definition sensor.h:57
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7