Skip to content

Commit

Permalink
chg: misc fixed addressing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rochaferraz committed Feb 11, 2023
1 parent 2dd2edb commit 1062052
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1603,8 +1603,8 @@
}; \
const EmberAfGenericClusterFunction chipFuncArrayDoorLockServer[] = { \
(EmberAfGenericClusterFunction) MatterDoorLockClusterServerAttributeChangedCallback, \
(EmberAfGenericClusterFunction) MatterDoorLockClusterServerPreAttributeChangedCallback, \
(EmberAfGenericClusterFunction) MatterDoorLockClusterServerShutdownCallback, \
(EmberAfGenericClusterFunction) MatterDoorLockClusterServerPreAttributeChangedCallback, \
}; \
const EmberAfGenericClusterFunction chipFuncArrayWindowCoveringServer[] = { \
(EmberAfGenericClusterFunction) MatterWindowCoveringClusterServerAttributeChangedCallback, \
Expand Down Expand Up @@ -2559,7 +2559,7 @@
.attributes = ZAP_ATTRIBUTE_INDEX(324), \
.attributeCount = 33, \
.clusterSize = 55, \
.mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION) | ZAP_CLUSTER_MASK(SHUTDOWN_FUNCTION), \
.mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION) | ZAP_CLUSTER_MASK(SHUTDOWN_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \
.functions = chipFuncArrayDoorLockServer, \
.acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 127 ) ,\
.generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 142 ) ,\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ void ColorControlServer::cancelEndpointTimerCallback(EmberEventControl * control
void ColorControlServer::cancelEndpointTimerCallback(EndpointId endpoint)
{
auto control = ColorControlServer::getEventControl(endpoint);
if (control) {
if (control)
{
cancelEndpointTimerCallback(control);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/clusters/color-control-server/color-control-server.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ class ColorControlServer
Color16uTransitionState colorTempTransitionStates[EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT];
#endif // EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_TEMP

EmberEventControl eventControls[EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT];
EmberEventControl
eventControls[EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT];
};

/**********************************************************
Expand Down
2 changes: 1 addition & 1 deletion src/app/clusters/level-control/level-control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@ void emberAfLevelControlClusterServerInitCallback(EndpointId endpoint)
void MatterLevelControlClusterServerShutdownCallback(EndpointId endpoint)
{
emberAfOnOffClusterPrintln("Shuting down level control server cluster on endpoint %d", endpoint);
DeviceLayer::SystemLayer().CancelTimer(timerCallback, reinterpret_cast<void *>(static_cast<uintptr_t>(endpoint)));
cancelEndpointTimerCallback(endpoint);
}

#ifndef IGNORE_LEVEL_CONTROL_CLUSTER_START_UP_CURRENT_LEVEL
Expand Down
3 changes: 2 additions & 1 deletion src/app/clusters/on-off-server/on-off-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ void OnOffServer::cancelEndpointTimerCallback(EmberEventControl * control)
void OnOffServer::cancelEndpointTimerCallback(EndpointId endpoint)
{
auto control = OnOffServer::getEventControl(endpoint);
if (control) {
if (control)
{
cancelEndpointTimerCallback(control);
}
}
Expand Down
7 changes: 7 additions & 0 deletions src/app/common/templates/config-data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ ClustersWithAttributeChangedFunctions:
- Window Covering
- Fan Control

ClustersWithShutdownFunctions:
- Barrier Control
- On/Off
- Door Lock
- Level Control
- Color Control

ClustersWithPreAttributeChangeFunctions:
- Door Lock
- Pump Configuration and Control
Expand Down
8 changes: 8 additions & 0 deletions src/app/util/af-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,14 @@ typedef void (*EmberAfTickFunction)(chip::EndpointId endpoint);
*/
typedef void (*EmberAfInitFunction)(chip::EndpointId endpoint);

/**
* @brief Type for referring to the shutdown callback for cluster.
*
* Init function is called when the cluster is shut down, for example
* when an endpoint is disabled
*/
typedef void (*EmberAfShutdownFunction)(chip::EndpointId endpoint);

/**
* @brief Type for referring to the attribute changed callback function.
*
Expand Down
5 changes: 2 additions & 3 deletions src/app/util/attribute-storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,10 @@ static void shutdownEndpoint(EmberAfDefinedEndpoint * definedEndpoint)
for (clusterIndex = 0; clusterIndex < epType->clusterCount; clusterIndex++)
{
const EmberAfCluster * cluster = &(epType->cluster[clusterIndex]);
EmberAfGenericClusterFunction f;
f = emberAfFindClusterFunction(cluster, CLUSTER_MASK_SHUTDOWN_FUNCTION);
EmberAfGenericClusterFunction f = emberAfFindClusterFunction(cluster, CLUSTER_MASK_SHUTDOWN_FUNCTION);
if (f != nullptr)
{
((EmberAfInitFunction) f)(definedEndpoint->endpoint);
((EmberAfShutdownFunction) f)(definedEndpoint->endpoint);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/zap-templates/templates/app/att-storage.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
// Cluster is a server
#define CLUSTER_MASK_SERVER (0x40)
// Cluster is a client
#define CLUSTER_MASK_CLIENT (0x80)
#define CLUSTER_MASK_CLIENT (0x80)

0 comments on commit 1062052

Please sign in to comment.