ESPHome
2024.11.0
esphome
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
esphome::hm3301::AQICalculatorFactory
Definition:
aqi_calculator_factory.h:11
esphome::hm3301::CAQICalculator
Definition:
caqi_calculator.h:9
caqi_calculator.h
esphome::hm3301::AQICalculatorFactory::get_calculator
AbstractAQICalculator * get_calculator(AQICalculatorType type)
Definition:
aqi_calculator_factory.h:13
esphome::hm3301::AQICalculator
Definition:
aqi_calculator.h:9
aqi_calculator.h
esphome::hm3301::CAQI_TYPE
Definition:
aqi_calculator_factory.h:9
esphome::hm3301::AbstractAQICalculator
Definition:
abstract_aqi_calculator.h:8
esphome::hm3301::AQICalculatorFactory::aqi_calculator_
AQICalculator * aqi_calculator_
Definition:
aqi_calculator_factory.h:25
type
uint8_t type
Definition:
e131_packet.cpp:135
esphome::hm3301::AQICalculatorType
AQICalculatorType
Definition:
aqi_calculator_factory.h:9
esphome::hm3301::AQICalculatorFactory::caqi_calculator_
CAQICalculator * caqi_calculator_
Definition:
aqi_calculator_factory.h:24
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
esphome::hm3301::AQI_TYPE
Definition:
aqi_calculator_factory.h:9
Generated by
1.8.13