Skip to content

Commit

Permalink
Add some missing #ifdefs into src/app (#3620)
Browse files Browse the repository at this point in the history
  • Loading branch information
vivien-apple authored and pull[bot] committed Jan 5, 2021
1 parent 22a5c78 commit 4b38ec1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/app/clusters/on-off-server/on-off.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,25 @@ EmberAfStatus emberAfOnOffClusterSetValueCallback(uint8_t endpoint, uint8_t comm
return status;
}

#ifdef EMBER_AF_PLUGIN_LEVEL_CONTROL
// If initiatedByLevelChange is false, then we assume that the level change
// ZCL stuff has not happened and we do it here
if (!initiatedByLevelChange && emberAfContainsServer(endpoint, ZCL_LEVEL_CONTROL_CLUSTER_ID))
{
emberAfOnOffClusterLevelControlEffectCallback(endpoint, newValue);
}
#endif // EMBER_AF_PLUGIN_LEVEL_CONTROL
}
else
{
#ifdef EMBER_AF_PLUGIN_LEVEL_CONTROL
// If initiatedByLevelChange is false, then we assume that the level change
// ZCL stuff has not happened and we do it here
if (!initiatedByLevelChange && emberAfContainsServer(endpoint, ZCL_LEVEL_CONTROL_CLUSTER_ID))
{
emberAfOnOffClusterLevelControlEffectCallback(endpoint, newValue);
}
#endif // EMBER_AF_PLUGIN_LEVEL_CONTROL

// write the new on/off value
status = emberAfWriteAttribute(endpoint, ZCL_ON_OFF_CLUSTER_ID, ZCL_ON_OFF_ATTRIBUTE_ID, CLUSTER_MASK_SERVER,
Expand All @@ -139,13 +143,15 @@ EmberAfStatus emberAfOnOffClusterSetValueCallback(uint8_t endpoint, uint8_t comm
}
#endif

#ifdef EMBER_AF_PLUGIN_SCENES
// the scene has been changed (the value of on/off has changed) so
// the current scene as descibed in the attribute table is invalid,
// so mark it as invalid (just writes the valid/invalid attribute)
if (emberAfContainsServer(endpoint, ZCL_SCENES_CLUSTER_ID))
{
emberAfScenesClusterMakeInvalidCallback(endpoint);
}
#endif // EMBER_AF_PLUGIN_SCENES

// The returned status is based solely on the On/Off cluster. Errors in the
// Level Control and/or Scenes cluster are ignored.
Expand Down
2 changes: 2 additions & 0 deletions src/app/util/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ static bool dispatchZclMessage(EmberAfClusterCommand * cmd)
emberAfDebugPrintln("0x%02x", cmd->apsFrame->profileId);
return false;
}
#ifdef EMBER_AF_PLUGIN_GROUPS_SERVER
else if ((cmd->type == EMBER_INCOMING_MULTICAST || cmd->type == EMBER_INCOMING_MULTICAST_LOOPBACK) &&
!emberAfGroupsClusterEndpointInGroupCallback(cmd->apsFrame->destinationEndpoint, cmd->apsFrame->groupId))
{
Expand All @@ -447,6 +448,7 @@ static bool dispatchZclMessage(EmberAfClusterCommand * cmd)
emberAfDebugPrintln("0x%02x", cmd->apsFrame->groupId);
return false;
}
#endif // EMBER_AF_PLUGIN_GROUPS_SERVER
else
{
return (cmd->clusterSpecific ? emAfProcessClusterSpecificCommand(cmd) : emAfProcessGlobalCommand(cmd));
Expand Down

0 comments on commit 4b38ec1

Please sign in to comment.