Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Chef] Add Air Quality Sensor device type #29436

Merged
merged 8 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions examples/chef/common/chef-air-quality.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
*
* Copyright (c) 2023 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <app-common/zap-generated/callback.h>
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/util/config.h>
#include <lib/core/DataModelTypes.h>

using namespace chip;
using namespace chip::app;
using namespace chip::app::Clusters;

#ifdef EMBER_AF_PLUGIN_AIR_QUALITY_SERVER
#include <app/clusters/air-quality-server/air-quality-server.h>
using namespace chip::app::Clusters::AirQuality;

static chip::BitMask<Feature, uint32_t> airQualityFeatures(Feature::kFair, Feature::kModerate, Feature::kVeryPoor,
Feature::kExtremelyPoor);
static Instance gAirQualityClusterInstance = Instance(1, airQualityFeatures);

void emberAfAirQualityClusterInitCallback(chip::EndpointId endpointId)
{
gAirQualityClusterInstance.Init();
}
#endif
160 changes: 160 additions & 0 deletions examples/chef/common/chef-concentration-measurement.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
/*
*
* Copyright (c) 2023 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <app-common/zap-generated/callback.h>
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/util/config.h>
#include <lib/core/DataModelTypes.h>

using namespace chip;
using namespace chip::app;
using namespace chip::app::Clusters;

#if defined(EMBER_AF_PLUGIN_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_SERVER) || \
defined(EMBER_AF_PLUGIN_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_SERVER) || \
defined(EMBER_AF_PLUGIN_NITROGEN_DIOXIDE_CONCENTRATION_MEASUREMENT_SERVER) || \
defined(EMBER_AF_PLUGIN_OZONE_CONCENTRATION_MEASUREMENT_SERVER) || \
defined(EMBER_AF_PLUGIN_PM2__5_CONCENTRATION_MEASUREMENT_SERVER) || \
defined(EMBER_AF_PLUGIN_FORMALDEHYDE_CONCENTRATION_MEASUREMENT_SERVER) || \
defined(EMBER_AF_PLUGIN_PM1_CONCENTRATION_MEASUREMENT_SERVER) || \
defined(EMBER_AF_PLUGIN_PM10_CONCENTRATION_MEASUREMENT_SERVER) || \
defined(EMBER_AF_PLUGIN_TOTAL_VOLATILE_ORGANIC_COMPOUNDS_CONCENTRATION_MEASUREMENT_SERVER) || \
defined(EMBER_AF_PLUGIN_RADON_CONCENTRATION_MEASUREMENT_SERVER)
#include <app/clusters/concentration-measurement-server/concentration-measurement-server.h>
using namespace chip::app::Clusters::ConcentrationMeasurement;
#endif

#ifdef EMBER_AF_PLUGIN_CARBON_DIOXIDE_CONCENTRATION_MEASUREMENT_SERVER
static Instance gCarbonDioxideConcentrationMeasurementInstance =
CreateNumericMeasurementAndLevelIndicationConcentrationCluster<true, true, true, true>(
EndpointId(1), CarbonDioxideConcentrationMeasurement::Id, MeasurementMediumEnum::kAir, MeasurementUnitEnum::kPpm);

void emberAfCarbonDioxideConcentrationMeasurementClusterInitCallback(EndpointId endpoint)
erwinpan1 marked this conversation as resolved.
Show resolved Hide resolved
{
VerifyOrDie(1 == endpoint);
gCarbonDioxideConcentrationMeasurementInstance.Init();
}
#endif

#ifdef EMBER_AF_PLUGIN_CARBON_MONOXIDE_CONCENTRATION_MEASUREMENT_SERVER
static Instance gCarbonMonoxideConcentrationMeasurementInstance =
CreateNumericMeasurementAndLevelIndicationConcentrationCluster<true, true, true, true>(
EndpointId(1), CarbonMonoxideConcentrationMeasurement::Id, MeasurementMediumEnum::kAir, MeasurementUnitEnum::kPpm);

void emberAfCarbonMonoxideConcentrationMeasurementClusterInitCallback(EndpointId endpoint)
{
VerifyOrDie(1 == endpoint);
gCarbonMonoxideConcentrationMeasurementInstance.Init();
}
#endif

#ifdef EMBER_AF_PLUGIN_NITROGEN_DIOXIDE_CONCENTRATION_MEASUREMENT_SERVER
static Instance gNitrogenDioxideConcentrationMeasurementInstance =
CreateNumericMeasurementAndLevelIndicationConcentrationCluster<true, true, true, true>(
EndpointId(1), NitrogenDioxideConcentrationMeasurement::Id, MeasurementMediumEnum::kAir, MeasurementUnitEnum::kPpm);

void emberAfNitrogenDioxideConcentrationMeasurementClusterInitCallback(EndpointId endpoint)
{
VerifyOrDie(1 == endpoint);
gNitrogenDioxideConcentrationMeasurementInstance.Init();
}
#endif

#ifdef EMBER_AF_PLUGIN_PM1_CONCENTRATION_MEASUREMENT_SERVER
static Instance gPm1ConcentrationMeasurementInstance =
CreateNumericMeasurementAndLevelIndicationConcentrationCluster<true, true, true, true>(
EndpointId(1), Pm1ConcentrationMeasurement::Id, MeasurementMediumEnum::kAir, MeasurementUnitEnum::kPpm);

void emberAfPm1ConcentrationMeasurementClusterInitCallback(EndpointId endpoint)
{
VerifyOrDie(1 == endpoint);
gPm1ConcentrationMeasurementInstance.Init();
}
#endif

#ifdef EMBER_AF_PLUGIN_PM10_CONCENTRATION_MEASUREMENT_SERVER
static Instance gPm10ConcentrationMeasurementInstance =
CreateNumericMeasurementAndLevelIndicationConcentrationCluster<true, true, true, true>(
EndpointId(1), Pm10ConcentrationMeasurement::Id, MeasurementMediumEnum::kAir, MeasurementUnitEnum::kPpm);

void emberAfPm10ConcentrationMeasurementClusterInitCallback(EndpointId endpoint)
{
VerifyOrDie(1 == endpoint);
gPm10ConcentrationMeasurementInstance.Init();
}
#endif

#ifdef EMBER_AF_PLUGIN_PM2__5_CONCENTRATION_MEASUREMENT_SERVER
static Instance gPm25ConcentrationMeasurementInstance =
CreateNumericMeasurementAndLevelIndicationConcentrationCluster<true, true, true, true>(
EndpointId(1), Pm25ConcentrationMeasurement::Id, MeasurementMediumEnum::kAir, MeasurementUnitEnum::kPpm);

void emberAfPm25ConcentrationMeasurementClusterInitCallback(EndpointId endpoint)
{
VerifyOrDie(1 == endpoint);
gPm25ConcentrationMeasurementInstance.Init();
}
#endif

#ifdef EMBER_AF_PLUGIN_RADON_CONCENTRATION_MEASUREMENT_SERVER
static Instance gRadonConcentrationMeasurementInstance =
CreateNumericMeasurementAndLevelIndicationConcentrationCluster<true, true, true, true>(
EndpointId(1), RadonConcentrationMeasurement::Id, MeasurementMediumEnum::kAir, MeasurementUnitEnum::kPpm);

void emberAfRadonConcentrationMeasurementClusterInitCallback(EndpointId endpoint)
{
VerifyOrDie(1 == endpoint);
gRadonConcentrationMeasurementInstance.Init();
}
#endif

#ifdef EMBER_AF_PLUGIN_TOTAL_VOLATILE_ORGANIC_COMPOUNDS_CONCENTRATION_MEASUREMENT_SERVER
static Instance gTotalVolatileOrganicCompoundsConcentrationMeasurementInstance =
CreateNumericMeasurementAndLevelIndicationConcentrationCluster<true, true, true, true>(
EndpointId(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, MeasurementMediumEnum::kAir,
MeasurementUnitEnum::kPpm);

void emberAfTotalVolatileOrganicCompoundsConcentrationMeasurementClusterInitCallback(EndpointId endpoint)
{
VerifyOrDie(1 == endpoint);
gTotalVolatileOrganicCompoundsConcentrationMeasurementInstance.Init();
}
#endif

#ifdef EMBER_AF_PLUGIN_OZONE_CONCENTRATION_MEASUREMENT_SERVER
static Instance gOzoneConcentrationMeasurementInstance =
CreateNumericMeasurementAndLevelIndicationConcentrationCluster<true, true, true, true>(
EndpointId(1), OzoneConcentrationMeasurement::Id, MeasurementMediumEnum::kAir, MeasurementUnitEnum::kPpm);

void emberAfOzoneConcentrationMeasurementClusterInitCallback(EndpointId endpoint)
{
VerifyOrDie(1 == endpoint);
gOzoneConcentrationMeasurementInstance.Init();
}
#endif

#ifdef EMBER_AF_PLUGIN_FORMALDEHYDE_CONCENTRATION_MEASUREMENT_SERVER
static Instance gFormaldehydeConcentrationMeasurementInstance =
CreateNumericMeasurementAndLevelIndicationConcentrationCluster<true, true, true, true>(
EndpointId(1), FormaldehydeConcentrationMeasurement::Id, MeasurementMediumEnum::kAir, MeasurementUnitEnum::kPpm);

void emberAfFormaldehydeConcentrationMeasurementClusterInitCallback(EndpointId endpoint)
{
VerifyOrDie(1 == endpoint);
gFormaldehydeConcentrationMeasurementInstance.Init();
}
#endif
Loading
Loading