@@ -1387,7 +1387,8 @@ bool ColorControlServer::moveHueCommand(app::CommandHandler * commandObj, const
1387
1387
1388
1388
VerifyOrExit (colorHueTransitionState != nullptr , status = Status::UnsupportedEndpoint);
1389
1389
1390
- // check moveMode before any operation is done on the transition states
1390
+ // check moveMode and rate before any operation is done on the transition states
1391
+ // rate value is ignored if the MoveMode is stop
1391
1392
if (moveMode == HueMoveMode::kUnknownEnumValue || (rate == 0 && moveMode != HueMoveMode::kStop ))
1392
1393
{
1393
1394
commandObj->AddStatus (commandPath, Status::InvalidCommand);
@@ -1669,8 +1670,8 @@ bool ColorControlServer::stepHueCommand(app::CommandHandler * commandObj, const
1669
1670
ColorHueTransitionState * colorHueTransitionState = getColorHueTransitionState (endpoint);
1670
1671
VerifyOrExit (colorHueTransitionState != nullptr , status = Status::UnsupportedEndpoint);
1671
1672
1672
- // Confirm validity of the step mode received
1673
- if (stepMode == HueStepMode::kUnknownEnumValue )
1673
+ // Confirm validity of the step mode and step size received
1674
+ if (stepMode == HueStepMode::kUnknownEnumValue || stepSize == 0 )
1674
1675
{
1675
1676
commandObj->AddStatus (commandPath, Status::InvalidCommand);
1676
1677
return true ;
@@ -1756,7 +1757,8 @@ bool ColorControlServer::moveSaturationCommand(app::CommandHandler * commandObj,
1756
1757
Color16uTransitionState * colorSaturationTransitionState = getSaturationTransitionState (endpoint);
1757
1758
VerifyOrExit (colorSaturationTransitionState != nullptr , status = Status::UnsupportedEndpoint);
1758
1759
1759
- // check moveMode before any operation is done on the transition states
1760
+ // check moveMode and rate before any operation is done on the transition states
1761
+ // rate value is ignored if the MoveMode is stop
1760
1762
if (moveMode == SaturationMoveMode::kUnknownEnumValue || (rate == 0 && moveMode != SaturationMoveMode::kStop ))
1761
1763
{
1762
1764
commandObj->AddStatus (commandPath, Status::InvalidCommand);
@@ -1867,8 +1869,8 @@ bool ColorControlServer::stepSaturationCommand(app::CommandHandler * commandObj,
1867
1869
Color16uTransitionState * colorSaturationTransitionState = getSaturationTransitionState (endpoint);
1868
1870
VerifyOrExit (colorSaturationTransitionState != nullptr , status = Status::UnsupportedEndpoint);
1869
1871
1870
- // Confirm validity of the step mode received
1871
- if (stepMode == SaturationStepMode::kUnknownEnumValue )
1872
+ // Confirm validity of the step mode and step size received
1873
+ if (stepMode == SaturationStepMode::kUnknownEnumValue || stepSize == 0 )
1872
1874
{
1873
1875
commandObj->AddStatus (commandPath, Status::InvalidCommand);
1874
1876
return true ;
@@ -2263,6 +2265,12 @@ bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, cons
2263
2265
VerifyOrExit (colorXTransitionState != nullptr , status = Status::UnsupportedEndpoint);
2264
2266
VerifyOrExit (colorYTransitionState != nullptr , status = Status::UnsupportedEndpoint);
2265
2267
2268
+ if (rateX == 0 && rateY == 0 )
2269
+ {
2270
+ commandObj->AddStatus (commandPath, Status::InvalidCommand);
2271
+ return true ;
2272
+ }
2273
+
2266
2274
if (!shouldExecuteIfOff (endpoint, optionsMask, optionsOverride))
2267
2275
{
2268
2276
commandObj->AddStatus (commandPath, Status::Success);
@@ -2275,12 +2283,6 @@ bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, cons
2275
2283
// New command. Need to stop any active transitions.
2276
2284
stopAllColorTransitions (endpoint);
2277
2285
2278
- if (rateX == 0 && rateY == 0 )
2279
- {
2280
- commandObj->AddStatus (commandPath, Status::InvalidCommand);
2281
- return true ;
2282
- }
2283
-
2284
2286
// Handle color mode transition, if necessary.
2285
2287
handleModeSwitch (endpoint, ColorControl::EnhancedColorMode::kCurrentXAndCurrentY );
2286
2288
@@ -2364,6 +2366,12 @@ bool ColorControlServer::stepColorCommand(app::CommandHandler * commandObj, cons
2364
2366
VerifyOrExit (colorXTransitionState != nullptr , status = Status::UnsupportedEndpoint);
2365
2367
VerifyOrExit (colorYTransitionState != nullptr , status = Status::UnsupportedEndpoint);
2366
2368
2369
+ if (stepX == 0 && stepY == 0 )
2370
+ {
2371
+ commandObj->AddStatus (commandPath, Status::InvalidCommand);
2372
+ return true ;
2373
+ }
2374
+
2367
2375
if (!shouldExecuteIfOff (endpoint, optionsMask, optionsOverride))
2368
2376
{
2369
2377
commandObj->AddStatus (commandPath, Status::Success);
@@ -2693,7 +2701,8 @@ bool ColorControlServer::moveColorTempCommand(app::CommandHandler * commandObj,
2693
2701
Color16uTransitionState * colorTempTransitionState = getTempTransitionState (endpoint);
2694
2702
VerifyOrExit (colorTempTransitionState != nullptr , status = Status::UnsupportedEndpoint);
2695
2703
2696
- // check moveMode before any operation is done on the transition states
2704
+ // check moveMode and rate before any operation is done on the transition states
2705
+ // rate value is ignored if the MoveMode is stop
2697
2706
if (moveMode == HueMoveMode::kUnknownEnumValue || (rate == 0 && moveMode != HueMoveMode::kStop ))
2698
2707
{
2699
2708
commandObj->AddStatus (commandPath, Status::InvalidCommand);
@@ -2815,8 +2824,8 @@ bool ColorControlServer::stepColorTempCommand(app::CommandHandler * commandObj,
2815
2824
Color16uTransitionState * colorTempTransitionState = getTempTransitionState (endpoint);
2816
2825
VerifyOrExit (colorTempTransitionState != nullptr , status = Status::UnsupportedEndpoint);
2817
2826
2818
- // Confirm validity of the step mode received
2819
- if (stepMode == HueStepMode::kUnknownEnumValue )
2827
+ // Confirm validity of the step mode and step size received
2828
+ if (stepMode == HueStepMode::kUnknownEnumValue || stepSize == 0 )
2820
2829
{
2821
2830
commandObj->AddStatus (commandPath, Status::InvalidCommand);
2822
2831
return true ;
0 commit comments