ESPHome
2025.2.2
Main Page
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
y
+
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
b
d
e
f
i
j
l
m
n
p
q
r
s
t
u
v
+
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
+
Enumerator
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
+
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Typedefs
a
c
d
o
p
s
t
v
w
+
Enumerations
b
c
e
f
i
m
n
p
r
s
t
v
+
Enumerator
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
w
Related Functions
+
Files
File List
+
Globals
+
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
y
+
Functions
_
a
l
m
o
s
t
u
+
Variables
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
y
Typedefs
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Modules
Pages
esphome
esphome
components
ble_client
text_sensor
automation.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
esphome/core/automation.h
"
4
#include "
esphome/components/ble_client/text_sensor/ble_text_sensor.h
"
5
6
#ifdef USE_ESP32
7
8
namespace
esphome
{
9
namespace
ble_client {
10
11
class
BLETextSensorNotifyTrigger
:
public
Trigger
<std::string>,
public
BLETextSensor
{
12
public
:
13
explicit
BLETextSensorNotifyTrigger
(
BLETextSensor
*
sensor
) {
sensor_
=
sensor
; }
14
void
gattc_event_handler
(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
15
esp_ble_gattc_cb_param_t *param)
override
{
16
switch
(event) {
17
case
ESP_GATTC_SEARCH_CMPL_EVT: {
18
this->
sensor_
->
node_state
= espbt::ClientState::ESTABLISHED;
19
break
;
20
}
21
case
ESP_GATTC_NOTIFY_EVT: {
22
if
(param->notify.conn_id != this->sensor_->parent()->get_conn_id() ||
23
param->notify.handle != this->
sensor_
->
handle
)
24
break
;
25
this->
trigger
(this->
sensor_
->
parse_data
(param->notify.value, param->notify.value_len));
26
}
27
default
:
28
break
;
29
}
30
}
31
32
protected
:
33
BLETextSensor
*
sensor_
;
34
};
35
36
}
// namespace ble_client
37
}
// namespace esphome
38
39
#endif
esphome::ble_client::BLETextSensor::parse_data
std::string parse_data(uint8_t *value, uint16_t value_len)
Definition:
ble_text_sensor.cpp:107
esphome::ble_client::BLETextSensor
Definition:
ble_text_sensor.h:16
automation.h
esphome::Trigger< std::string >::trigger
void trigger(Ts... x)
Inform the parent automation that the event has triggered.
Definition:
automation.h:95
esphome::ble_client::BLETextSensor::handle
uint16_t handle
Definition:
ble_text_sensor.h:35
ble_text_sensor.h
esphome::ble_client::BLETextSensorNotifyTrigger::BLETextSensorNotifyTrigger
BLETextSensorNotifyTrigger(BLETextSensor *sensor)
Definition:
automation.h:13
esphome::ble_client::BLETextSensorNotifyTrigger::sensor_
BLETextSensor * sensor_
Definition:
automation.h:33
esphome::ble_client::BLETextSensorNotifyTrigger::gattc_event_handler
void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t *param) override
Definition:
automation.h:14
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
esphome::Trigger
Definition:
automation.h:92
esphome::statsd::sensor
esphome::sensor::Sensor * sensor
Definition:
statsd.h:38
esphome::ble_client::BLETextSensorNotifyTrigger
Definition:
automation.h:11
esphome::ble_client::BLEClientNode::node_state
espbt::ClientState node_state
Definition:
ble_client.h:38
Generated by
1.8.13