ESPHome
2025.9.0-dev
Loading...
Searching...
No Matches
esphome
components
api
api_noise_context.h
Go to the documentation of this file.
1
#pragma once
2
#include <array>
3
#include <cstdint>
4
#include "
esphome/core/defines.h
"
5
6
namespace
esphome::api
{
7
8
#ifdef USE_API_NOISE
9
using
psk_t
= std::array<uint8_t, 32>;
10
11
class
APINoiseContext
{
12
public
:
13
void
set_psk
(
psk_t
psk) {
14
this->
psk_
= psk;
15
bool
has_psk
=
false
;
16
for
(
auto
i : psk) {
17
has_psk
|= i;
18
}
19
this->
has_psk_
=
has_psk
;
20
}
21
const
psk_t
&
get_psk
()
const
{
return
this->
psk_
; }
22
bool
has_psk
()
const
{
return
this->
has_psk_
; }
23
24
protected
:
25
psk_t
psk_
{};
26
bool
has_psk_
{
false
};
27
};
28
#endif
// USE_API_NOISE
29
30
}
// namespace esphome::api
esphome::api::APINoiseContext
Definition
api_noise_context.h:11
esphome::api::APINoiseContext::has_psk_
bool has_psk_
Definition
api_noise_context.h:26
esphome::api::APINoiseContext::psk_
psk_t psk_
Definition
api_noise_context.h:25
esphome::api::APINoiseContext::get_psk
const psk_t & get_psk() const
Definition
api_noise_context.h:21
esphome::api::APINoiseContext::set_psk
void set_psk(psk_t psk)
Definition
api_noise_context.h:13
esphome::api::APINoiseContext::has_psk
bool has_psk() const
Definition
api_noise_context.h:22
defines.h
esphome::api
Definition
api_connection.cpp:34
esphome::api::psk_t
std::array< uint8_t, 32 > psk_t
Definition
api_noise_context.h:9
Generated by
1.12.0