Skip to content

Commit

Permalink
build error solved
Browse files Browse the repository at this point in the history
  • Loading branch information
Thirsrin committed Aug 21, 2024
1 parent 601712d commit 1207823
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 35 deletions.
55 changes: 28 additions & 27 deletions src/app/clusters/color-control-server/color-control-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <platform/CHIPDeviceLayer.h>
#include <platform/PlatformManager.h>
#include <tracing/macros.h>
#include <lib/core/Optional.h>

#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
#include <app/clusters/scenes-server/scenes-server.h>
Expand Down Expand Up @@ -469,7 +470,7 @@ Status ColorControlServer::stopAllColorTransitions(EndpointId endpoint)
}

bool ColorControlServer::stopMoveStepCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
uint8_t optionsMask, uint8_t optionsOverride)
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride)
{
EndpointId endpoint = commandPath.mEndpointId;
Status status = Status::Success;
Expand Down Expand Up @@ -509,7 +510,7 @@ bool ColorControlServer::stopMoveStepCommand(app::CommandHandler * commandObj, c
return true;
}

bool ColorControlServer::shouldExecuteIfOff(EndpointId endpoint, uint8_t optionMask, uint8_t optionOverride)
bool ColorControlServer::shouldExecuteIfOff(EndpointId endpoint, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionMask, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionOverride)
{
// From 5.2.2.2.1.10 of ZCL7 document 14-0129-15f-zcl-ch-5-lighting.docx:
// "Command execution SHALL NOT continue beyond the Options processing if
Expand Down Expand Up @@ -551,7 +552,7 @@ bool ColorControlServer::shouldExecuteIfOff(EndpointId endpoint, uint8_t optionM
// ---------- The following order is important in decision making -------
// -----------more readable ----------
//
if (optionMask == 0xFF && optionOverride == 0xFF)
if (optionMask == static_cast<ColorControl::OptionsBitmap>(0xFF) && optionOverride == static_cast<ColorControl::OptionsBitmap>(0xFF))
{
// 0xFF are the default values passed to the command handler when
// the payload is not present - in that case there is use of option
Expand All @@ -560,14 +561,14 @@ bool ColorControlServer::shouldExecuteIfOff(EndpointId endpoint, uint8_t optionM
}
// ---------- The above is to distinguish if the payload is present or not

if (READBITS(optionMask, static_cast<uint8_t>(ColorControl::OptionsBitmap::kExecuteIfOff)))
if (optionMask.Has(ColorControl::OptionsBitmap::kExecuteIfOff))
{
// Mask is present and set in the command payload, this indicates
// use the override as temporary option
return READBITS(optionOverride, static_cast<uint8_t>(ColorControl::OptionsBitmap::kExecuteIfOff));
// use the over ride as temporary option
return optionOverride.Has(ColorControl::OptionsBitmap::kExecuteIfOff);
}
// if we are here - use the option attribute bits
return options.GetField(ColorControl::OptionsBitmap::kExecuteIfOff);
// if we are here - use the option bits
return options.Has(ColorControl::OptionsBitmap::kExecuteIfOff);
}

/**
Expand Down Expand Up @@ -1396,7 +1397,7 @@ Status ColorControlServer::moveToHueAndSaturation(uint16_t hue, uint8_t saturati
* @return false Failed
*/
bool ColorControlServer::moveHueCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
MoveModeEnum moveMode, uint16_t rate, uint8_t optionsMask, uint8_t optionsOverride,
MoveModeEnum moveMode, uint16_t rate, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride,
bool isEnhanced)
{
MATTER_TRACE_SCOPE("moveHue", "ColorControl");
Expand Down Expand Up @@ -1506,8 +1507,8 @@ bool ColorControlServer::moveHueCommand(app::CommandHandler * commandObj, const
* @return false Failed
*/
bool ColorControlServer::moveToHueCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
uint16_t hue, DirectionEnum moveDirection, uint16_t transitionTime, uint8_t optionsMask,
uint8_t optionsOverride, bool isEnhanced)
uint16_t hue, DirectionEnum moveDirection, uint16_t transitionTime, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask,
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride, bool isEnhanced)
{
MATTER_TRACE_SCOPE("moveToHue", "ColorControl");
EndpointId endpoint = commandPath.mEndpointId;
Expand Down Expand Up @@ -1642,8 +1643,8 @@ bool ColorControlServer::moveToHueCommand(app::CommandHandler * commandObj, cons
*/
bool ColorControlServer::moveToHueAndSaturationCommand(app::CommandHandler * commandObj,
const app::ConcreteCommandPath & commandPath, uint16_t hue,
uint8_t saturation, uint16_t transitionTime, uint8_t optionsMask,
uint8_t optionsOverride, bool isEnhanced)
uint8_t saturation, uint16_t transitionTime, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask,
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride, bool isEnhanced)
{
MATTER_TRACE_SCOPE("moveToHueAndSaturation", "ColorControl");
// limit checking: hue and saturation are 0..254. Spec dictates we ignore
Expand Down Expand Up @@ -1682,8 +1683,8 @@ bool ColorControlServer::moveToHueAndSaturationCommand(app::CommandHandler * com
* @return false Failed
*/
bool ColorControlServer::stepHueCommand(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath,
StepModeEnum stepMode, uint16_t stepSize, uint16_t transitionTime, uint8_t optionsMask,
uint8_t optionsOverride, bool isEnhanced)
StepModeEnum stepMode, uint16_t stepSize, uint16_t transitionTime, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask,
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride, bool isEnhanced)
{
MATTER_TRACE_SCOPE("stepHue", "ColorControl");
EndpointId endpoint = commandPath.mEndpointId;
Expand Down Expand Up @@ -1886,8 +1887,8 @@ bool ColorControlServer::stepSaturationCommand(app::CommandHandler * commandObj,
auto stepMode = commandData.stepMode;
uint8_t stepSize = commandData.stepSize;
uint8_t transitionTime = commandData.transitionTime;
uint8_t optionsMask = commandData.optionsMask;
uint8_t optionsOverride = commandData.optionsOverride;
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask = commandData.optionsMask;
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride = commandData.optionsOverride;
EndpointId endpoint = commandPath.mEndpointId;
Status status = Status::Success;
uint8_t currentSaturation = 0;
Expand Down Expand Up @@ -1953,8 +1954,8 @@ bool ColorControlServer::colorLoopCommand(app::CommandHandler * commandObj, cons
auto direction = commandData.direction;
uint16_t time = commandData.time;
uint16_t startHue = commandData.startHue;
uint8_t optionsMask = commandData.optionsMask;
uint8_t optionsOverride = commandData.optionsOverride;
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask = commandData.optionsMask;
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride = commandData.optionsOverride;
EndpointId endpoint = commandPath.mEndpointId;
Status status = Status::Success;
uint8_t isColorLoopActive = 0;
Expand Down Expand Up @@ -2323,8 +2324,8 @@ bool ColorControlServer::moveColorCommand(app::CommandHandler * commandObj, cons
{
int16_t rateX = commandData.rateX;
int16_t rateY = commandData.rateY;
uint8_t optionsMask = commandData.optionsMask;
uint8_t optionsOverride = commandData.optionsOverride;
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask = commandData.optionsMask;
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride = commandData.optionsOverride;
EndpointId endpoint = commandPath.mEndpointId;
Status status = Status::Success;

Expand Down Expand Up @@ -2416,8 +2417,8 @@ bool ColorControlServer::stepColorCommand(app::CommandHandler * commandObj, cons
int16_t stepX = commandData.stepX;
int16_t stepY = commandData.stepY;
uint16_t transitionTime = commandData.transitionTime;
uint8_t optionsMask = commandData.optionsMask;
uint8_t optionsOverride = commandData.optionsOverride;
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask = commandData.optionsMask;
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride = commandData.optionsOverride;
EndpointId endpoint = commandPath.mEndpointId;
uint16_t currentColorX = 0;
uint16_t currentColorY = 0;
Expand Down Expand Up @@ -2776,8 +2777,8 @@ bool ColorControlServer::moveColorTempCommand(app::CommandHandler * commandObj,
uint16_t rate = commandData.rate;
uint16_t colorTemperatureMinimum = commandData.colorTemperatureMinimumMireds;
uint16_t colorTemperatureMaximum = commandData.colorTemperatureMaximumMireds;
uint8_t optionsMask = commandData.optionsMask;
uint8_t optionsOverride = commandData.optionsOverride;
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask = commandData.optionsMask;
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride = commandData.optionsOverride;
EndpointId endpoint = commandPath.mEndpointId;
Status status = Status::Success;
uint16_t tempPhysicalMin = MIN_TEMPERATURE_VALUE;
Expand Down Expand Up @@ -2901,8 +2902,8 @@ bool ColorControlServer::stepColorTempCommand(app::CommandHandler * commandObj,
uint16_t transitionTime = commandData.transitionTime;
uint16_t colorTemperatureMinimum = commandData.colorTemperatureMinimumMireds;
uint16_t colorTemperatureMaximum = commandData.colorTemperatureMaximumMireds;
uint8_t optionsMask = commandData.optionsMask;
uint8_t optionsOverride = commandData.optionsOverride;
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask = commandData.optionsMask;
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride = commandData.optionsOverride;
EndpointId endpoint = commandPath.mEndpointId;
Status status = Status::Success;
uint16_t tempPhysicalMin = MIN_TEMPERATURE_VALUE;
Expand Down
16 changes: 8 additions & 8 deletions src/app/clusters/color-control-server/color-control-server.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,20 @@ class ColorControlServer
bool HasFeature(chip::EndpointId endpoint, Feature feature);
chip::Protocols::InteractionModel::Status stopAllColorTransitions(chip::EndpointId endpoint);
bool stopMoveStepCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
uint8_t optionsMask, uint8_t optionsOverride);
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride);

#ifdef MATTER_DM_PLUGIN_COLOR_CONTROL_SERVER_HSV
bool moveHueCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
MoveModeEnum moveMode, uint16_t rate, uint8_t optionsMask, uint8_t optionsOverride, bool isEnhanced);
MoveModeEnum moveMode, uint16_t rate, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride, bool isEnhanced);
bool moveToHueCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, uint16_t hue,
DirectionEnum moveDirection, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride,
DirectionEnum moveDirection, uint16_t transitionTime, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride,
bool isEnhanced);
bool moveToHueAndSaturationCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
uint16_t hue, uint8_t saturation, uint16_t transitionTime, uint8_t optionsMask,
uint8_t optionsOverride, bool isEnhanced);
uint16_t hue, uint8_t saturation, uint16_t transitionTime, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask,
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride, bool isEnhanced);
bool stepHueCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
StepModeEnum stepMode, uint16_t stepSize, uint16_t transitionTime, uint8_t optionsMask,
uint8_t optionsOverride, bool isEnhanced);
StepModeEnum stepMode, uint16_t stepSize, uint16_t transitionTime, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsMask,
chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionsOverride, bool isEnhanced);
bool moveSaturationCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
const chip::app::Clusters::ColorControl::Commands::MoveSaturation::DecodableType & commandData);
bool moveToSaturationCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
Expand Down Expand Up @@ -216,7 +216,7 @@ class ColorControlServer
}
}

bool shouldExecuteIfOff(chip::EndpointId endpoint, uint8_t optionMask, uint8_t optionOverride);
bool shouldExecuteIfOff(chip::EndpointId endpoint, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionMask, chip::BitMask<chip::app::Clusters::ColorControl::OptionsBitmap> optionOverride);
void handleModeSwitch(chip::EndpointId endpoint, chip::app::Clusters::ColorControl::EnhancedColorModeEnum newColorMode);
uint16_t computeTransitionTimeFromStateAndRate(Color16uTransitionState * p, uint16_t rate);
EmberEventControl * getEventControl(chip::EndpointId endpoint);
Expand Down

0 comments on commit 1207823

Please sign in to comment.