Skip to content

Commit

Permalink
Fix Build Error
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasgraf committed Aug 17, 2023
1 parent b78e85b commit 7c8eb5c
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,39 @@
#include <app/clusters/resource-monitoring-server/resource-monitoring-cluster-objects.h>
#include <app/clusters/resource-monitoring-server/resource-monitoring-server.h>

/// This is an application level Instance to handle ActivatedCarbonfilterMonitoringInstance commands according to the specific
namespace chip {
namespace app {
namespace Clusters {

namespace ActivatedCarbonFilterMonitoring {

/// This is an application level Delegate to handle ActivatedCarbonFilterMonitoringDelegate commands according to the specific
/// business logic.
class ActivatedCarbonFilterMonitoringInstance : public chip::app::Clusters::ResourceMonitoring::Instance
class ActivatedCarbonFilterMonitoringDelegate : public ResourceMonitoring::Delegate
{
private:
CHIP_ERROR AppInit() override;
CHIP_ERROR Init() override;
chip::Protocols::InteractionModel::Status PreResetCondition() override;
chip::Protocols::InteractionModel::Status PostResetCondition() override;

public:
ActivatedCarbonFilterMonitoringInstance(
chip::EndpointId aEndpointId, uint32_t aFeature,
chip::app::Clusters::ResourceMonitoring::Attributes::DegradationDirection::TypeInfo::Type aDegradationDirection,
bool aResetConditionCommandSupported) :
Instance(aEndpointId, chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id, aFeature, aDegradationDirection,
aResetConditionCommandSupported){};
~ActivatedCarbonFilterMonitoringDelegate() override = default;
};

/// This is an application level instance to handle HepaFilterMonitoringInstance commands according to the specific business logic.
class HepaFilterMonitoringInstance : public chip::app::Clusters::ResourceMonitoring::Instance
} // namespace ActivatedCarbonFilterMonitoring

namespace HepaFilterMonitoring {

/// This is an application level delegate to handle HepaFilterMonitoringDelegate commands according to the specific business logic.
class HepaFilterMonitoringDelegate : public ResourceMonitoring::Delegate
{
private:
CHIP_ERROR AppInit() override;
CHIP_ERROR Init() override;
chip::Protocols::InteractionModel::Status PreResetCondition() override;
chip::Protocols::InteractionModel::Status PostResetCondition() override;

public:
HepaFilterMonitoringInstance(
chip::EndpointId aEndpointId, uint32_t aFeature,
chip::app::Clusters::ResourceMonitoring::Attributes::DegradationDirection::TypeInfo::Type aDegradationDirection,
bool aResetConditionCommandSupported) :
Instance(aEndpointId, chip::app::Clusters::HepaFilterMonitoring::Id, aFeature, aDegradationDirection,
aResetConditionCommandSupported){};
~HepaFilterMonitoringDelegate() override = default;
};

class ImmutableReplacementProductListManager : public chip::app::Clusters::ResourceMonitoring::ReplacementProductListManager
Expand All @@ -61,3 +61,9 @@ class ImmutableReplacementProductListManager : public chip::app::Clusters::Resou
CHIP_ERROR
Next(chip::app::Clusters::ResourceMonitoring::ReplacementProductStruct & item) override;
};

} // namespace HepaFilterMonitoring

} // namespace Clusters
} // namespace app
} // namespace chip
Original file line number Diff line number Diff line change
Expand Up @@ -19,78 +19,90 @@
#include <app-common/zap-generated/ids/Clusters.h>
#include <app/clusters/resource-monitoring-server/resource-monitoring-cluster-objects.h>
#include <app/clusters/resource-monitoring-server/resource-monitoring-server.h>
#include <resource-monitoring-instances.h>
#include <resource-monitoring-delegates.h>

using namespace chip;
using namespace chip::app;
using namespace chip::app::Clusters;
using namespace chip::app::Clusters::ResourceMonitoring;
using namespace chip::app::Clusters::ActivatedCarbonFilterMonitoring;
using namespace chip::app::Clusters::HepaFilterMonitoring;
using chip::Protocols::InteractionModel::Status;

constexpr std::bitset<4> gHepaFilterFeatureMap{ static_cast<uint32_t>(Feature::kCondition) |
static_cast<uint32_t>(Feature::kWarning) |
static_cast<uint32_t>(Feature::kReplacementProductList) };
constexpr std::bitset<4> gActivatedCarbonFeatureMap{ static_cast<uint32_t>(Feature::kCondition) |
static_cast<uint32_t>(Feature::kWarning) |
static_cast<uint32_t>(Feature::kReplacementProductList) };
constexpr std::bitset<4> gHepaFilterFeatureMap{ static_cast<uint32_t>(ResourceMonitoring::Feature::kCondition) |
static_cast<uint32_t>(ResourceMonitoring::Feature::kWarning) |
static_cast<uint32_t>(ResourceMonitoring::Feature::kReplacementProductList) };
constexpr std::bitset<4> gActivatedCarbonFeatureMap{ static_cast<uint32_t>(ResourceMonitoring::Feature::kCondition) |
static_cast<uint32_t>(ResourceMonitoring::Feature::kWarning) |
static_cast<uint32_t>(ResourceMonitoring::Feature::kReplacementProductList) };

static HepaFilterMonitoringInstance * gHepaFilterInstance = nullptr;
static ActivatedCarbonFilterMonitoringInstance * gActivatedCarbonFilterInstance = nullptr;

static ActivatedCarbonFilterMonitoringDelegate * gActivatedCarbonFilterDelegate = nullptr;
static ResourceMonitoring::Instance * gActivatedCarbonFilterInstance = nullptr;

static HepaFilterMonitoringDelegate * gHepaFilterDelegate = nullptr;
static ResourceMonitoring::Instance * gHepaFilterInstance = nullptr;

static ImmutableReplacementProductListManager sReplacementProductListManager;

//-- Activated Carbon Filter Monitoring Instance methods
CHIP_ERROR ActivatedCarbonFilterMonitoringInstance::AppInit()
CHIP_ERROR ActivatedCarbonFilterMonitoringDelegate::Init()
{
ChipLogDetail(Zcl, "ActivatedCarbonFilterMonitoringDelegate::Init()");
SetReplacementProductListManagerInstance(&sReplacementProductListManager);
mInstance->SetReplacementProductListManagerInstance(&sReplacementProductListManager);
return CHIP_NO_ERROR;
}

Status ActivatedCarbonFilterMonitoringInstance::PreResetCondition()
Status ActivatedCarbonFilterMonitoringDelegate::PreResetCondition()
{
ChipLogDetail(Zcl, "ActivatedCarbonFilterMonitoringInstance::PreResetCondition()");
ChipLogDetail(Zcl, "ActivatedCarbonFilterMonitoringDelegate::PreResetCondition()");
return Status::Success;
}

Status ActivatedCarbonFilterMonitoringInstance::PostResetCondition()
Status ActivatedCarbonFilterMonitoringDelegate::PostResetCondition()
{
ChipLogDetail(Zcl, "ActivatedCarbonFilterMonitoringInstance::PostResetCondition()");
ChipLogDetail(Zcl, "ActivatedCarbonFilterMonitoringDelegate::PostResetCondition()");
return Status::Success;
}

//-- Hepa Filter Monitoring instance methods
CHIP_ERROR HepaFilterMonitoringInstance::AppInit()
CHIP_ERROR HepaFilterMonitoringDelegate::Init()
{
ChipLogDetail(Zcl, "HepaFilterMonitoringInstance::Init()");
SetReplacementProductListManagerInstance(&sReplacementProductListManager);
ChipLogDetail(Zcl, "HepaFilterMonitoringDelegate::Init()");
mInstance->SetReplacementProductListManagerInstance(&sReplacementProductListManager);
return CHIP_NO_ERROR;
}

Status HepaFilterMonitoringInstance::PreResetCondition()
Status HepaFilterMonitoringDelegate::PreResetCondition()
{
ChipLogDetail(Zcl, "HepaFilterMonitoringInstance::PreResetCondition()");
ChipLogDetail(Zcl, "HepaFilterMonitoringDelegate::PreResetCondition()");
return Status::Success;
}

Status HepaFilterMonitoringInstance::PostResetCondition()
Status HepaFilterMonitoringDelegate::PostResetCondition()
{
ChipLogDetail(Zcl, "HepaFilterMonitoringInstance::PostResetCondition()");
ChipLogDetail(Zcl, "HepaFilterMonitoringDelegate::PostResetCondition()");
return Status::Success;
}

void emberAfActivatedCarbonFilterMonitoringClusterInitCallback(chip::EndpointId endpoint)
{
VerifyOrDie(gActivatedCarbonFilterInstance == nullptr);
gActivatedCarbonFilterInstance = new ActivatedCarbonFilterMonitoringInstance(
endpoint, static_cast<uint32_t>(gActivatedCarbonFeatureMap.to_ulong()), DegradationDirectionEnum::kDown, true);

gActivatedCarbonFilterDelegate = new ActivatedCarbonFilterMonitoringDelegate;
gActivatedCarbonFilterInstance = new ResourceMonitoring::Instance(
gActivatedCarbonFilterDelegate, endpoint, ActivatedCarbonFilterMonitoring::Id,
static_cast<uint32_t>(gActivatedCarbonFeatureMap.to_ulong()), ResourceMonitoring::DegradationDirectionEnum::kDown, true);
gActivatedCarbonFilterInstance->Init();
}
void emberAfHepaFilterMonitoringClusterInitCallback(chip::EndpointId endpoint)
{
VerifyOrDie(gHepaFilterInstance == nullptr);
gHepaFilterInstance = new HepaFilterMonitoringInstance(endpoint, static_cast<uint32_t>(gHepaFilterFeatureMap.to_ulong()),
DegradationDirectionEnum::kDown, true);

gHepaFilterDelegate = new HepaFilterMonitoringDelegate;
gHepaFilterInstance = new ResourceMonitoring::Instance(gHepaFilterDelegate, endpoint, HepaFilterMonitoring::Id,
static_cast<uint32_t>(gHepaFilterFeatureMap.to_ulong()),
ResourceMonitoring::DegradationDirectionEnum::kDown, true);
gHepaFilterInstance->Init();
}

Expand Down

0 comments on commit 7c8eb5c

Please sign in to comment.