Modify the generated files for example lighting and lock apps to include server init callbacks. (#3180)
This allows the app to implement
emberAfPluginOnOffClusterServerPostInitCallback to sync up the data
model state with the state of the actual device when the data model
initializes.
diff --git a/examples/lighting-app/lighting-common/gen/callback-stub.c b/examples/lighting-app/lighting-common/gen/callback-stub.c
index 2566ed8..37bb1d6 100644
--- a/examples/lighting-app/lighting-common/gen/callback-stub.c
+++ b/examples/lighting-app/lighting-common/gen/callback-stub.c
@@ -43,6 +43,16 @@
//#include "hal/hal.h"
//#include EMBER_AF_API_NETWORK_STEERING
+/** @brief On/off Cluster Server Post Init
+ *
+ * Following resolution of the On/Off state at startup for this endpoint,
+ * perform any additional initialization needed; e.g., synchronize hardware
+ * state.
+ *
+ * @param endpoint Endpoint that is being initialized Ver.: always
+ */
+void emberAfPluginOnOffClusterServerPostInitCallback(uint8_t endpoint) {}
+
/** @brief Add To Current App Tasks
*
* This function is only useful to sleepy end devices. This function will note
@@ -2478,8 +2488,6 @@
// These functions / constants are added to avoid ld failure when building with GN
// They should be removed if we have zcl updates and nolonger need this or causing other errors
-void emberAfPluginOnOffClusterServerPostInitCallback(uint8_t endpoint) {}
-
bool emberAfIsCurrentSecurityProfileSmartEnergy(void)
{
return false;
diff --git a/examples/lighting-app/lighting-common/gen/endpoint_config.h b/examples/lighting-app/lighting-common/gen/endpoint_config.h
index 70c37bd..b84160d 100644
--- a/examples/lighting-app/lighting-common/gen/endpoint_config.h
+++ b/examples/lighting-app/lighting-common/gen/endpoint_config.h
@@ -50,13 +50,16 @@
}
// Cluster function static arrays
-#define GENERATED_FUNCTION_ARRAYS
+#define GENERATED_FUNCTION_ARRAYS \
+ const EmberAfGenericClusterFunction emberAfFuncArrayOnOffClusterServer[] = { ( \
+ EmberAfGenericClusterFunction) emberAfOnOffClusterServerInitCallback };
// Clusters definitions
#define GENERATED_CLUSTERS \
{ \
{ \
- 0x0006, (EmberAfAttributeMetadata *) &(generatedAttributes[0]), 2, 3, (CLUSTER_MASK_SERVER), NULL, \
+ 0x0006, (EmberAfAttributeMetadata *) &(generatedAttributes[0]), 2, \
+ 3, (CLUSTER_MASK_SERVER | CLUSTER_MASK_INIT_FUNCTION), emberAfFuncArrayOnOffClusterServer, \
}, \
}
diff --git a/examples/lighting-app/lighting-common/gen/gen_config.h b/examples/lighting-app/lighting-common/gen/gen_config.h
index b1b1add..f7efba4 100644
--- a/examples/lighting-app/lighting-common/gen/gen_config.h
+++ b/examples/lighting-app/lighting-common/gen/gen_config.h
@@ -89,6 +89,7 @@
#define EMBER_CALLBACK_ON_OFF_CLUSTER_OFF
#define EMBER_CALLBACK_ON_OFF_CLUSTER_ON
#define EMBER_CALLBACK_ON_OFF_CLUSTER_TOGGLE
+#define EMBER_CALLBACK_ON_OFF_CLUSTER_ON_OFF_CLUSTER_SERVER_INIT
#define EMBER_CALLBACK_ENERGY_SCAN_RESULT
#define EMBER_CALLBACK_SCAN_COMPLETE
#define EMBER_CALLBACK_NETWORK_FOUND
diff --git a/examples/lock-app/lock-common/gen/callback-stub.c b/examples/lock-app/lock-common/gen/callback-stub.c
index 13fce46..bd2109e 100644
--- a/examples/lock-app/lock-common/gen/callback-stub.c
+++ b/examples/lock-app/lock-common/gen/callback-stub.c
@@ -40,9 +40,20 @@
// of the callbacks have not been provided.
#include "af.h"
#include <assert.h>
+
//#include "hal/hal.h"
//#include EMBER_AF_API_NETWORK_STEERING
+/** @brief On/off Cluster Server Post Init
+ *
+ * Following resolution of the On/Off state at startup for this endpoint,
+ * perform any additional initialization needed; e.g., synchronize hardware
+ * state.
+ *
+ * @param endpoint Endpoint that is being initialized Ver.: always
+ */
+void emberAfPluginOnOffClusterServerPostInitCallback(uint8_t endpoint) {}
+
/** @brief Add To Current App Tasks
*
* This function is only useful to sleepy end devices. This function will note
diff --git a/examples/lock-app/lock-common/gen/endpoint_config.h b/examples/lock-app/lock-common/gen/endpoint_config.h
index 70c37bd..b84160d 100644
--- a/examples/lock-app/lock-common/gen/endpoint_config.h
+++ b/examples/lock-app/lock-common/gen/endpoint_config.h
@@ -50,13 +50,16 @@
}
// Cluster function static arrays
-#define GENERATED_FUNCTION_ARRAYS
+#define GENERATED_FUNCTION_ARRAYS \
+ const EmberAfGenericClusterFunction emberAfFuncArrayOnOffClusterServer[] = { ( \
+ EmberAfGenericClusterFunction) emberAfOnOffClusterServerInitCallback };
// Clusters definitions
#define GENERATED_CLUSTERS \
{ \
{ \
- 0x0006, (EmberAfAttributeMetadata *) &(generatedAttributes[0]), 2, 3, (CLUSTER_MASK_SERVER), NULL, \
+ 0x0006, (EmberAfAttributeMetadata *) &(generatedAttributes[0]), 2, \
+ 3, (CLUSTER_MASK_SERVER | CLUSTER_MASK_INIT_FUNCTION), emberAfFuncArrayOnOffClusterServer, \
}, \
}
diff --git a/examples/lock-app/lock-common/gen/gen_config.h b/examples/lock-app/lock-common/gen/gen_config.h
index b1b1add..f7efba4 100644
--- a/examples/lock-app/lock-common/gen/gen_config.h
+++ b/examples/lock-app/lock-common/gen/gen_config.h
@@ -89,6 +89,7 @@
#define EMBER_CALLBACK_ON_OFF_CLUSTER_OFF
#define EMBER_CALLBACK_ON_OFF_CLUSTER_ON
#define EMBER_CALLBACK_ON_OFF_CLUSTER_TOGGLE
+#define EMBER_CALLBACK_ON_OFF_CLUSTER_ON_OFF_CLUSTER_SERVER_INIT
#define EMBER_CALLBACK_ENERGY_SCAN_RESULT
#define EMBER_CALLBACK_SCAN_COMPLETE
#define EMBER_CALLBACK_NETWORK_FOUND