21
21
#include < app/ConcreteCommandPath.h>
22
22
#include < app/util/attribute-storage.h>
23
23
#include < app/util/config.h>
24
+ #include < lib/core/Optional.h>
24
25
#include < platform/CHIPDeviceLayer.h>
25
26
#include < platform/PlatformManager.h>
26
27
#include < tracing/macros.h>
27
- #include < lib/core/Optional.h>
28
28
29
29
#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
30
30
#include < app/clusters/scenes-server/scenes-server.h>
@@ -438,7 +438,8 @@ Status ColorControlServer::stopAllColorTransitions(EndpointId endpoint)
438
438
}
439
439
440
440
bool ColorControlServer::stopMoveStepCommand (app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
441
- chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride)
441
+ chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask,
442
+ chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride)
442
443
{
443
444
EndpointId endpoint = commandPath.mEndpointId ;
444
445
Status status = Status::Success;
@@ -465,7 +466,9 @@ bool ColorControlServer::stopMoveStepCommand(app::CommandHandler * commandObj, c
465
466
return true ;
466
467
}
467
468
468
- bool ColorControlServer::shouldExecuteIfOff (EndpointId endpoint, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionMask, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionOverride)
469
+ bool ColorControlServer::shouldExecuteIfOff (EndpointId endpoint,
470
+ chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionMask,
471
+ chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionOverride)
469
472
{
470
473
// From 5.2.2.2.1.10 of ZCL7 document 14-0129-15f-zcl-ch-5-lighting.docx:
471
474
// "Command execution SHALL NOT continue beyond the Options processing if
@@ -507,7 +510,8 @@ bool ColorControlServer::shouldExecuteIfOff(EndpointId endpoint, chip::BitMask<c
507
510
// ---------- The following order is important in decision making -------
508
511
// -----------more readable ----------
509
512
//
510
- if (optionMask == static_cast <ColorControl::OptionsBitmap>(0xFF ) && optionOverride == static_cast <ColorControl::OptionsBitmap>(0xFF ))
513
+ if (optionMask == static_cast <ColorControl::OptionsBitmap>(0xFF ) &&
514
+ optionOverride == static_cast <ColorControl::OptionsBitmap>(0xFF ))
511
515
{
512
516
// 0xFF are the default values passed to the command handler when
513
517
// the payload is not present - in that case there is use of option
@@ -1329,7 +1333,9 @@ Status ColorControlServer::moveToHueAndSaturation(uint16_t hue, uint8_t saturati
1329
1333
* @return false Failed
1330
1334
*/
1331
1335
bool ColorControlServer::moveHueCommand (app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
1332
- MoveModeEnum moveMode, uint16_t rate, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride,
1336
+ MoveModeEnum moveMode, uint16_t rate,
1337
+ chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask,
1338
+ chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride,
1333
1339
bool isEnhanced)
1334
1340
{
1335
1341
MATTER_TRACE_SCOPE (" moveHue" , " ColorControl" );
@@ -1435,8 +1441,10 @@ bool ColorControlServer::moveHueCommand(app::CommandHandler * commandObj, const
1435
1441
* @return false Failed
1436
1442
*/
1437
1443
bool ColorControlServer::moveToHueCommand (app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
1438
- uint16_t hue, DirectionEnum moveDirection, uint16_t transitionTime, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask,
1439
- chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride, bool isEnhanced)
1444
+ uint16_t hue, DirectionEnum moveDirection, uint16_t transitionTime,
1445
+ chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask,
1446
+ chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride,
1447
+ bool isEnhanced)
1440
1448
{
1441
1449
MATTER_TRACE_SCOPE (" moveToHue" , " ColorControl" );
1442
1450
EndpointId endpoint = commandPath.mEndpointId ;
@@ -1568,10 +1576,10 @@ bool ColorControlServer::moveToHueCommand(app::CommandHandler * commandObj, cons
1568
1576
* @return true Success
1569
1577
* @return false Failed
1570
1578
*/
1571
- bool ColorControlServer::moveToHueAndSaturationCommand (app::CommandHandler * commandObj,
1572
- const app::ConcreteCommandPath & commandPath, uint16_t hue,
1573
- uint8_t saturation, uint16_t transitionTime, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask,
1574
- chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride, bool isEnhanced)
1579
+ bool ColorControlServer::moveToHueAndSaturationCommand (
1580
+ app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, uint16_t hue, uint8_t saturation ,
1581
+ uint16_t transitionTime, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask,
1582
+ chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride, bool isEnhanced)
1575
1583
{
1576
1584
MATTER_TRACE_SCOPE (" moveToHueAndSaturation" , " ColorControl" );
1577
1585
// limit checking: hue and saturation are 0..254. Spec dictates we ignore
@@ -1610,8 +1618,10 @@ bool ColorControlServer::moveToHueAndSaturationCommand(app::CommandHandler * com
1610
1618
* @return false Failed
1611
1619
*/
1612
1620
bool ColorControlServer::stepHueCommand (app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
1613
- StepModeEnum stepMode, uint16_t stepSize, uint16_t transitionTime, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask,
1614
- chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride, bool isEnhanced)
1621
+ StepModeEnum stepMode, uint16_t stepSize, uint16_t transitionTime,
1622
+ chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask,
1623
+ chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride,
1624
+ bool isEnhanced)
1615
1625
{
1616
1626
MATTER_TRACE_SCOPE (" stepHue" , " ColorControl" );
1617
1627
EndpointId endpoint = commandPath.mEndpointId ;
@@ -1807,14 +1817,14 @@ bool ColorControlServer::stepSaturationCommand(app::CommandHandler * commandObj,
1807
1817
const Commands::StepSaturation::DecodableType & commandData)
1808
1818
{
1809
1819
MATTER_TRACE_SCOPE (" stepSaturation" , " ColorControl" );
1810
- auto stepMode = commandData.stepMode ;
1811
- uint8_t stepSize = commandData.stepSize ;
1812
- uint8_t transitionTime = commandData.transitionTime ;
1813
- chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask = commandData.optionsMask ;
1814
- chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride = commandData.optionsOverride ;
1815
- EndpointId endpoint = commandPath.mEndpointId ;
1816
- Status status = Status::Success;
1817
- uint8_t currentSaturation = 0 ;
1820
+ auto stepMode = commandData.stepMode ;
1821
+ uint8_t stepSize = commandData.stepSize ;
1822
+ uint8_t transitionTime = commandData.transitionTime ;
1823
+ chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask = commandData.optionsMask ;
1824
+ chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride = commandData.optionsOverride ;
1825
+ EndpointId endpoint = commandPath.mEndpointId ;
1826
+ Status status = Status::Success;
1827
+ uint8_t currentSaturation = 0 ;
1818
1828
1819
1829
Color16uTransitionState * colorSaturationTransitionState = getSaturationTransitionState (endpoint);
1820
1830
VerifyOrExit (colorSaturationTransitionState != nullptr , status = Status::UnsupportedEndpoint);
@@ -1871,17 +1881,17 @@ bool ColorControlServer::colorLoopCommand(app::CommandHandler * commandObj, cons
1871
1881
const Commands::ColorLoopSet::DecodableType & commandData)
1872
1882
{
1873
1883
MATTER_TRACE_SCOPE (" colorLoop" , " ColorControl" );
1874
- auto updateFlags = commandData.updateFlags ;
1875
- auto action = commandData.action ;
1876
- auto direction = commandData.direction ;
1877
- uint16_t time = commandData.time ;
1878
- uint16_t startHue = commandData.startHue ;
1879
- chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask = commandData.optionsMask ;
1880
- chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride = commandData.optionsOverride ;
1881
- EndpointId endpoint = commandPath.mEndpointId ;
1882
- Status status = Status::Success;
1883
- uint8_t isColorLoopActive = 0 ;
1884
- uint8_t deactiveColorLoop = 0 ;
1884
+ auto updateFlags = commandData.updateFlags ;
1885
+ auto action = commandData.action ;
1886
+ auto direction = commandData.direction ;
1887
+ uint16_t time = commandData.time ;
1888
+ uint16_t startHue = commandData.startHue ;
1889
+ chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask = commandData.optionsMask ;
1890
+ chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride = commandData.optionsOverride ;
1891
+ EndpointId endpoint = commandPath.mEndpointId ;
1892
+ Status status = Status::Success;
1893
+ uint8_t isColorLoopActive = 0 ;
1894
+ uint8_t deactiveColorLoop = 0 ;
1885
1895
1886
1896
ColorHueTransitionState * colorHueTransitionState = getColorHueTransitionState (endpoint);
1887
1897
VerifyOrExit (colorHueTransitionState != nullptr , status = Status::UnsupportedEndpoint);
@@ -2202,12 +2212,12 @@ bool ColorControlServer::moveToColorCommand(app::CommandHandler * commandObj, co
2202
2212
bool ColorControlServer::moveColorCommand (app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
2203
2213
const Commands::MoveColor::DecodableType & commandData)
2204
2214
{
2205
- int16_t rateX = commandData.rateX ;
2206
- int16_t rateY = commandData.rateY ;
2215
+ int16_t rateX = commandData.rateX ;
2216
+ int16_t rateY = commandData.rateY ;
2207
2217
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask = commandData.optionsMask ;
2208
2218
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride = commandData.optionsOverride ;
2209
- EndpointId endpoint = commandPath.mEndpointId ;
2210
- Status status = Status::Success;
2219
+ EndpointId endpoint = commandPath.mEndpointId ;
2220
+ Status status = Status::Success;
2211
2221
2212
2222
Color16uTransitionState * colorXTransitionState = getXTransitionState (endpoint);
2213
2223
Color16uTransitionState * colorYTransitionState = getYTransitionState (endpoint);
@@ -2297,16 +2307,16 @@ bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, cons
2297
2307
bool ColorControlServer::stepColorCommand (app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
2298
2308
const Commands::StepColor::DecodableType & commandData)
2299
2309
{
2300
- int16_t stepX = commandData.stepX ;
2301
- int16_t stepY = commandData.stepY ;
2302
- uint16_t transitionTime = commandData.transitionTime ;
2310
+ int16_t stepX = commandData.stepX ;
2311
+ int16_t stepY = commandData.stepY ;
2312
+ uint16_t transitionTime = commandData.transitionTime ;
2303
2313
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask = commandData.optionsMask ;
2304
2314
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride = commandData.optionsOverride ;
2305
- EndpointId endpoint = commandPath.mEndpointId ;
2306
- uint16_t currentColorX = 0 ;
2307
- uint16_t currentColorY = 0 ;
2308
- uint16_t colorX = 0 ;
2309
- uint16_t colorY = 0 ;
2315
+ EndpointId endpoint = commandPath.mEndpointId ;
2316
+ uint16_t currentColorX = 0 ;
2317
+ uint16_t currentColorY = 0 ;
2318
+ uint16_t colorX = 0 ;
2319
+ uint16_t colorY = 0 ;
2310
2320
2311
2321
Status status = Status::Success;
2312
2322
@@ -2629,16 +2639,16 @@ void ColorControlServer::updateTempCommand(EndpointId endpoint)
2629
2639
bool ColorControlServer::moveColorTempCommand (app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
2630
2640
const Commands::MoveColorTemperature::DecodableType & commandData)
2631
2641
{
2632
- auto moveMode = commandData.moveMode ;
2633
- uint16_t rate = commandData.rate ;
2634
- uint16_t colorTemperatureMinimum = commandData.colorTemperatureMinimumMireds ;
2635
- uint16_t colorTemperatureMaximum = commandData.colorTemperatureMaximumMireds ;
2636
- chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask = commandData.optionsMask ;
2637
- chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride = commandData.optionsOverride ;
2638
- EndpointId endpoint = commandPath.mEndpointId ;
2639
- Status status = Status::Success;
2640
- uint16_t tempPhysicalMin = MIN_TEMPERATURE_VALUE;
2641
- uint16_t tempPhysicalMax = MAX_TEMPERATURE_VALUE;
2642
+ auto moveMode = commandData.moveMode ;
2643
+ uint16_t rate = commandData.rate ;
2644
+ uint16_t colorTemperatureMinimum = commandData.colorTemperatureMinimumMireds ;
2645
+ uint16_t colorTemperatureMaximum = commandData.colorTemperatureMaximumMireds ;
2646
+ chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask = commandData.optionsMask ;
2647
+ chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride = commandData.optionsOverride ;
2648
+ EndpointId endpoint = commandPath.mEndpointId ;
2649
+ Status status = Status::Success;
2650
+ uint16_t tempPhysicalMin = MIN_TEMPERATURE_VALUE;
2651
+ uint16_t tempPhysicalMax = MAX_TEMPERATURE_VALUE;
2642
2652
uint16_t transitionTime;
2643
2653
2644
2654
Color16uTransitionState * colorTempTransitionState = getTempTransitionState (endpoint);
@@ -2751,17 +2761,17 @@ bool ColorControlServer::moveToColorTempCommand(app::CommandHandler * commandObj
2751
2761
bool ColorControlServer::stepColorTempCommand (app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
2752
2762
const Commands::StepColorTemperature::DecodableType & commandData)
2753
2763
{
2754
- auto stepMode = commandData.stepMode ;
2755
- uint16_t stepSize = commandData.stepSize ;
2756
- uint16_t transitionTime = commandData.transitionTime ;
2757
- uint16_t colorTemperatureMinimum = commandData.colorTemperatureMinimumMireds ;
2758
- uint16_t colorTemperatureMaximum = commandData.colorTemperatureMaximumMireds ;
2759
- chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask = commandData.optionsMask ;
2760
- chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride = commandData.optionsOverride ;
2761
- EndpointId endpoint = commandPath.mEndpointId ;
2762
- Status status = Status::Success;
2763
- uint16_t tempPhysicalMin = MIN_TEMPERATURE_VALUE;
2764
- uint16_t tempPhysicalMax = MAX_TEMPERATURE_VALUE;
2764
+ auto stepMode = commandData.stepMode ;
2765
+ uint16_t stepSize = commandData.stepSize ;
2766
+ uint16_t transitionTime = commandData.transitionTime ;
2767
+ uint16_t colorTemperatureMinimum = commandData.colorTemperatureMinimumMireds ;
2768
+ uint16_t colorTemperatureMaximum = commandData.colorTemperatureMaximumMireds ;
2769
+ chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask = commandData.optionsMask ;
2770
+ chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride = commandData.optionsOverride ;
2771
+ EndpointId endpoint = commandPath.mEndpointId ;
2772
+ Status status = Status::Success;
2773
+ uint16_t tempPhysicalMin = MIN_TEMPERATURE_VALUE;
2774
+ uint16_t tempPhysicalMax = MAX_TEMPERATURE_VALUE;
2765
2775
2766
2776
Color16uTransitionState * colorTempTransitionState = getTempTransitionState (endpoint);
2767
2777
VerifyOrExit (colorTempTransitionState != nullptr , status = Status::UnsupportedEndpoint);
0 commit comments