Skip to content

Commit 2380b98

Browse files
committed
Fix up compilation errors caused by change to forecastID and powerAdjustementCapability list moving one level below.
1 parent 6ce2430 commit 2380b98

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/app/clusters/device-energy-management-server/device-energy-management-server.cpp

+10-9
Original file line numberDiff line numberDiff line change
@@ -319,15 +319,16 @@ void Instance::HandlePowerAdjustRequest(HandlerContext & ctx, const Commands::Po
319319
}
320320

321321
powerAdjustmentCapability = mDelegate.GetPowerAdjustmentCapability();
322-
if (powerAdjustmentCapability.IsNull())
322+
if ((powerAdjustmentCapability.IsNull()) || (powerAdjustmentCapability.Value().powerAdjustCapability.IsNull()))
323323
{
324324
ChipLogError(Zcl, "DEM: powerAdjustmentCapability IsNull");
325325
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
326326
return;
327327
}
328328

329-
/* PowerAdjustmentCapability is a list - so iterate through checking if the command is within one of the offers */
330-
for (auto pas : powerAdjustmentCapability.Value())
329+
/* PowerAdjustmentCapability is a list within a powerAdjustmentCapability structure
330+
so iterate through checking if the command is within one of the offers */
331+
for (auto pas : powerAdjustmentCapability.Value().powerAdjustCapability.Value())
331332
{
332333
if ((power >= pas.minPower) && (durationSec >= pas.minDuration) && (power <= pas.maxPower) &&
333334
(durationSec <= pas.maxDuration))
@@ -530,10 +531,10 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq
530531
return;
531532
}
532533

533-
/* We expect that there should be a slotIsPauseable entry (but it is optional) */
534-
if (!forecast.Value().slots[activeSlotNumber].slotIsPauseable.HasValue())
534+
/* We expect that there should be a slotIsPausable entry (but it is optional) */
535+
if (!forecast.Value().slots[activeSlotNumber].slotIsPausable.HasValue())
535536
{
536-
ChipLogError(Zcl, "DEM: activeSlotNumber %d does not include slotIsPauseable.", activeSlotNumber);
537+
ChipLogError(Zcl, "DEM: activeSlotNumber %d does not include slotIsPausable.", activeSlotNumber);
537538
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure);
538539
return;
539540
}
@@ -552,7 +553,7 @@ void Instance::HandlePauseRequest(HandlerContext & ctx, const Commands::PauseReq
552553
return;
553554
}
554555

555-
if (!forecast.Value().slots[activeSlotNumber].slotIsPauseable.Value())
556+
if (!forecast.Value().slots[activeSlotNumber].slotIsPausable.Value())
556557
{
557558
ChipLogError(Zcl, "DEM: activeSlotNumber %d is NOT pauseable.", activeSlotNumber);
558559
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::ConstraintError);
@@ -609,7 +610,7 @@ void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands:
609610
Status status;
610611
DataModel::Nullable<Structs::ForecastStruct::Type> forecast;
611612

612-
uint32_t forecastId = commandData.forecastId;
613+
uint32_t forecastID = commandData.forecastID;
613614
DataModel::DecodableList<Structs::SlotAdjustmentStruct::Type> slotAdjustments = commandData.slotAdjustments;
614615
AdjustmentCauseEnum adjustmentCause = commandData.cause;
615616

@@ -629,7 +630,7 @@ void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands:
629630
return;
630631
}
631632

632-
status = mDelegate.ModifyForecastRequest(forecastId, slotAdjustments, adjustmentCause);
633+
status = mDelegate.ModifyForecastRequest(forecastID, slotAdjustments, adjustmentCause);
633634
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
634635
if (status != Status::Success)
635636
{

0 commit comments

Comments
 (0)