Skip to content

Commit

Permalink
Modify the generated files for example lighting and lock apps to incl…
Browse files Browse the repository at this point in the history
…ude 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.
  • Loading branch information
bzbarsky-apple authored Oct 12, 2020
1 parent 994af3c commit 551796a
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 6 deletions.
12 changes: 10 additions & 2 deletions examples/lighting-app/lighting-common/gen/callback-stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -2478,8 +2488,6 @@ void halSleepCallback(bool enter, SleepModes sleepMode) {}

// 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;
Expand Down
7 changes: 5 additions & 2 deletions examples/lighting-app/lighting-common/gen/endpoint_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
}, \
}

Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/lighting-common/gen/gen_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions examples/lock-app/lock-common/gen/callback-stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions examples/lock-app/lock-common/gen/endpoint_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
}, \
}

Expand Down
1 change: 1 addition & 0 deletions examples/lock-app/lock-common/gen/gen_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 551796a

Please sign in to comment.