ESPHome
2025.5.0
Loading...
Searching...
No Matches
esphome
components
hm3301
aqi_calculator_factory.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
caqi_calculator.h
"
4
#include "
aqi_calculator.h
"
5
6
namespace
esphome
{
7
namespace
hm3301 {
8
9
enum
AQICalculatorType
{
CAQI_TYPE
= 0,
AQI_TYPE
= 1 };
10
11
class
AQICalculatorFactory
{
12
public
:
13
AbstractAQICalculator
*
get_calculator
(
AQICalculatorType
type
) {
14
if
(
type
== 0) {
15
return
caqi_calculator_
;
16
}
else
if
(
type
== 1) {
17
return
aqi_calculator_
;
18
}
19
20
return
nullptr
;
21
}
22
23
protected
:
24
CAQICalculator
*
caqi_calculator_
=
new
CAQICalculator
();
25
AQICalculator
*
aqi_calculator_
=
new
AQICalculator
();
26
};
27
28
}
// namespace hm3301
29
}
// namespace esphome
aqi_calculator.h
caqi_calculator.h
esphome::hm3301::AQICalculatorFactory
Definition
aqi_calculator_factory.h:11
esphome::hm3301::AQICalculatorFactory::get_calculator
AbstractAQICalculator * get_calculator(AQICalculatorType type)
Definition
aqi_calculator_factory.h:13
esphome::hm3301::AQICalculatorFactory::caqi_calculator_
CAQICalculator * caqi_calculator_
Definition
aqi_calculator_factory.h:24
esphome::hm3301::AQICalculatorFactory::aqi_calculator_
AQICalculator * aqi_calculator_
Definition
aqi_calculator_factory.h:25
esphome::hm3301::AQICalculator
Definition
aqi_calculator.h:9
esphome::hm3301::AbstractAQICalculator
Definition
abstract_aqi_calculator.h:8
esphome::hm3301::CAQICalculator
Definition
caqi_calculator.h:9
type
uint8_t type
Definition
e131_packet.cpp:21
esphome::hm3301::AQICalculatorType
AQICalculatorType
Definition
aqi_calculator_factory.h:9
esphome::hm3301::CAQI_TYPE
@ CAQI_TYPE
Definition
aqi_calculator_factory.h:9
esphome::hm3301::AQI_TYPE
@ AQI_TYPE
Definition
aqi_calculator_factory.h:9
esphome
Providing packet encoding functions for exchanging data with a remote host.
Definition
a01nyub.cpp:7
Generated by
1.12.0