@@ -681,7 +681,7 @@ void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands:
681
681
return ;
682
682
}
683
683
684
- // Check to see if trying to modify a slot which have already been run
684
+ // Check to see if trying to modify a slot which has already been run
685
685
if (!forecast.Value ().activeSlotNumber .IsNull () && slotAdjustment.slotIndex < forecast.Value ().activeSlotNumber .Value ())
686
686
{
687
687
ChipLogError (Zcl, " DEM: Modifying already run slot index %d" , slotAdjustment.slotIndex );
@@ -714,6 +714,12 @@ void Instance::HandleModifyForecastRequest(HandlerContext & ctx, const Commands:
714
714
}
715
715
}
716
716
717
+ if (iterator.GetStatus () != CHIP_NO_ERROR)
718
+ {
719
+ ctx.mCommandHandler .AddStatus (ctx.mRequestPath , Status::InvalidCommand);
720
+ return ;
721
+ }
722
+
717
723
status = mDelegate .ModifyForecastRequest (forecastID, slotAdjustments, adjustmentCause);
718
724
ctx.mCommandHandler .AddStatus (ctx.mRequestPath , status);
719
725
if (status != Status::Success)
@@ -747,10 +753,10 @@ void Instance::HandleRequestConstraintBasedForecast(HandlerContext & ctx,
747
753
}
748
754
749
755
uint32_t currentUtcTime = 0 ;
750
- status = GetCurrentUtcTime (currentUtcTime);
756
+ status = GetCurrentTimeEpochS (currentUtcTime);
751
757
if (status != Status::Success)
752
758
{
753
- ChipLogError (Zcl, " DEM: Forecast is Null " );
759
+ ChipLogError (Zcl, " DEM: Failed to get UTC time " );
754
760
ctx.mCommandHandler .AddStatus (ctx.mRequestPath , status);
755
761
return ;
756
762
}
@@ -781,7 +787,11 @@ void Instance::HandleRequestConstraintBasedForecast(HandlerContext & ctx,
781
787
if (constraint.nominalPower .Value () < mDelegate .GetAbsMinPower () ||
782
788
constraint.nominalPower .Value () > mDelegate .GetAbsMaxPower ())
783
789
{
784
- ChipLogError (Zcl, " DEM: RequestConstraintBasedForecast nominalPower out of range [absMinPower, absMaxPower]" );
790
+ ChipLogError (Zcl, " DEM: RequestConstraintBasedForecast nominalPower " ChipLogFormatX64 " out of range [" ChipLogFormatX64 " , " ChipLogFormatX64 " ]" ,
791
+ ChipLogValueX64 (constraint.nominalPower .Value ()),
792
+ ChipLogValueX64 (mDelegate .GetAbsMinPower ()),
793
+ ChipLogValueX64 (mDelegate .GetAbsMaxPower ()));
794
+
785
795
ctx.mCommandHandler .AddStatus (ctx.mRequestPath , Status::ConstraintError);
786
796
return ;
787
797
}
@@ -811,6 +821,12 @@ void Instance::HandleRequestConstraintBasedForecast(HandlerContext & ctx,
811
821
}
812
822
}
813
823
}
824
+
825
+ if (iterator.GetStatus () != CHIP_NO_ERROR)
826
+ {
827
+ ctx.mCommandHandler .AddStatus (ctx.mRequestPath , Status::InvalidCommand);
828
+ return ;
829
+ }
814
830
}
815
831
816
832
// Check for overlappping elements
@@ -819,7 +835,7 @@ void Instance::HandleRequestConstraintBasedForecast(HandlerContext & ctx,
819
835
if (iterator.Next ())
820
836
{
821
837
// Get the first constraint
822
- const Structs::ConstraintsStruct::DecodableType & prevConstraint = iterator.GetValue ();
838
+ Structs::ConstraintsStruct::DecodableType prevConstraint = iterator.GetValue ();
823
839
824
840
// Start comparing next vs prev constraints
825
841
while (iterator.Next ())
@@ -832,8 +848,16 @@ void Instance::HandleRequestConstraintBasedForecast(HandlerContext & ctx,
832
848
ctx.mCommandHandler .AddStatus (ctx.mRequestPath , Status::ConstraintError);
833
849
return ;
834
850
}
851
+
852
+ prevConstraint = iterator.GetValue ();
835
853
}
836
854
}
855
+
856
+ if (iterator.GetStatus () != CHIP_NO_ERROR)
857
+ {
858
+ ctx.mCommandHandler .AddStatus (ctx.mRequestPath , Status::InvalidCommand);
859
+ return ;
860
+ }
837
861
}
838
862
839
863
status = mDelegate .RequestConstraintBasedForecast (constraints, adjustmentCause);
@@ -868,7 +892,7 @@ void Instance::HandleCancelRequest(HandlerContext & ctx, const Commands::CancelR
868
892
ctx.mCommandHandler .AddStatus (ctx.mRequestPath , status);
869
893
}
870
894
871
- Status Instance::GetCurrentUtcTime (uint32_t & currentUtcTime) const
895
+ Status Instance::GetCurrentTimeEpochS (uint32_t & currentUtcTime) const
872
896
{
873
897
currentUtcTime = 0 ;
874
898
System::Clock::Milliseconds64 cTMs;
0 commit comments