@@ -1361,7 +1361,8 @@ bool ColorControlServer::moveHueCommand(app::CommandHandler * commandObj, const
1361
1361
1362
1362
VerifyOrExit (colorHueTransitionState != nullptr , status = Status::UnsupportedEndpoint);
1363
1363
1364
- // check moveMode before any operation is done on the transition states
1364
+ // check moveMode and rate before any operation is done on the transition states
1365
+ // rate value is ignored if the MoveMode is stop
1365
1366
if (moveMode == HueMoveMode::kUnknownEnumValue || (rate == 0 && moveMode != HueMoveMode::kStop ))
1366
1367
{
1367
1368
commandObj->AddStatus (commandPath, Status::InvalidCommand);
@@ -1643,8 +1644,8 @@ bool ColorControlServer::stepHueCommand(app::CommandHandler * commandObj, const
1643
1644
ColorHueTransitionState * colorHueTransitionState = getColorHueTransitionState (endpoint);
1644
1645
VerifyOrExit (colorHueTransitionState != nullptr , status = Status::UnsupportedEndpoint);
1645
1646
1646
- // Confirm validity of the step mode received
1647
- if (stepMode == HueStepMode::kUnknownEnumValue )
1647
+ // Confirm validity of the step mode and step size received
1648
+ if (stepMode == HueStepMode::kUnknownEnumValue || stepSize == 0 )
1648
1649
{
1649
1650
commandObj->AddStatus (commandPath, Status::InvalidCommand);
1650
1651
return true ;
@@ -1730,7 +1731,8 @@ bool ColorControlServer::moveSaturationCommand(app::CommandHandler * commandObj,
1730
1731
Color16uTransitionState * colorSaturationTransitionState = getSaturationTransitionState (endpoint);
1731
1732
VerifyOrExit (colorSaturationTransitionState != nullptr , status = Status::UnsupportedEndpoint);
1732
1733
1733
- // check moveMode before any operation is done on the transition states
1734
+ // check moveMode and rate before any operation is done on the transition states
1735
+ // rate value is ignored if the MoveMode is stop
1734
1736
if (moveMode == SaturationMoveMode::kUnknownEnumValue || (rate == 0 && moveMode != SaturationMoveMode::kStop ))
1735
1737
{
1736
1738
commandObj->AddStatus (commandPath, Status::InvalidCommand);
@@ -1841,8 +1843,8 @@ bool ColorControlServer::stepSaturationCommand(app::CommandHandler * commandObj,
1841
1843
Color16uTransitionState * colorSaturationTransitionState = getSaturationTransitionState (endpoint);
1842
1844
VerifyOrExit (colorSaturationTransitionState != nullptr , status = Status::UnsupportedEndpoint);
1843
1845
1844
- // Confirm validity of the step mode received
1845
- if (stepMode == SaturationStepMode::kUnknownEnumValue )
1846
+ // Confirm validity of the step mode and step size received
1847
+ if (stepMode == SaturationStepMode::kUnknownEnumValue || stepSize == 0 )
1846
1848
{
1847
1849
commandObj->AddStatus (commandPath, Status::InvalidCommand);
1848
1850
return true ;
@@ -2237,6 +2239,12 @@ bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, cons
2237
2239
VerifyOrExit (colorXTransitionState != nullptr , status = Status::UnsupportedEndpoint);
2238
2240
VerifyOrExit (colorYTransitionState != nullptr , status = Status::UnsupportedEndpoint);
2239
2241
2242
+ if (rateX == 0 && rateY == 0 )
2243
+ {
2244
+ commandObj->AddStatus (commandPath, Status::InvalidCommand);
2245
+ return true ;
2246
+ }
2247
+
2240
2248
if (!shouldExecuteIfOff (endpoint, optionsMask, optionsOverride))
2241
2249
{
2242
2250
commandObj->AddStatus (commandPath, Status::Success);
@@ -2249,12 +2257,6 @@ bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, cons
2249
2257
// New command. Need to stop any active transitions.
2250
2258
stopAllColorTransitions (endpoint);
2251
2259
2252
- if (rateX == 0 && rateY == 0 )
2253
- {
2254
- commandObj->AddStatus (commandPath, Status::InvalidCommand);
2255
- return true ;
2256
- }
2257
-
2258
2260
// Handle color mode transition, if necessary.
2259
2261
handleModeSwitch (endpoint, ColorControl::EnhancedColorMode::kCurrentXAndCurrentY );
2260
2262
@@ -2338,6 +2340,12 @@ bool ColorControlServer::stepColorCommand(app::CommandHandler * commandObj, cons
2338
2340
VerifyOrExit (colorXTransitionState != nullptr , status = Status::UnsupportedEndpoint);
2339
2341
VerifyOrExit (colorYTransitionState != nullptr , status = Status::UnsupportedEndpoint);
2340
2342
2343
+ if (stepX == 0 && stepY == 0 )
2344
+ {
2345
+ commandObj->AddStatus (commandPath, Status::InvalidCommand);
2346
+ return true ;
2347
+ }
2348
+
2341
2349
if (!shouldExecuteIfOff (endpoint, optionsMask, optionsOverride))
2342
2350
{
2343
2351
commandObj->AddStatus (commandPath, Status::Success);
@@ -2667,7 +2675,8 @@ bool ColorControlServer::moveColorTempCommand(app::CommandHandler * commandObj,
2667
2675
Color16uTransitionState * colorTempTransitionState = getTempTransitionState (endpoint);
2668
2676
VerifyOrExit (colorTempTransitionState != nullptr , status = Status::UnsupportedEndpoint);
2669
2677
2670
- // check moveMode before any operation is done on the transition states
2678
+ // check moveMode and rate before any operation is done on the transition states
2679
+ // rate value is ignored if the MoveMode is stop
2671
2680
if (moveMode == HueMoveMode::kUnknownEnumValue || (rate == 0 && moveMode != HueMoveMode::kStop ))
2672
2681
{
2673
2682
commandObj->AddStatus (commandPath, Status::InvalidCommand);
@@ -2784,8 +2793,8 @@ bool ColorControlServer::stepColorTempCommand(app::CommandHandler * commandObj,
2784
2793
Color16uTransitionState * colorTempTransitionState = getTempTransitionState (endpoint);
2785
2794
VerifyOrExit (colorTempTransitionState != nullptr , status = Status::UnsupportedEndpoint);
2786
2795
2787
- // Confirm validity of the step mode received
2788
- if (stepMode == HueStepMode::kUnknownEnumValue )
2796
+ // Confirm validity of the step mode and step size received
2797
+ if (stepMode == HueStepMode::kUnknownEnumValue || stepSize == 0 )
2789
2798
{
2790
2799
commandObj->AddStatus (commandPath, Status::InvalidCommand);
2791
2800
return true ;
0 commit comments