Skip to content

Commit

Permalink
Update ZCL reporting code to be compatible with a client ZAP applicat…
Browse files Browse the repository at this point in the history
…ion (project-chip#4604)

#### Problem

In project-chip#3608, many reporting specific callbacks has been moved from `gen/callback-stub.cpp` to `src/app/reporting/`. The PR has been a bit overzealous since all the `*ReportingResponseCallback` declarations and definitions has been moved while those still needs to be part of the `gen/` content if one wants to override them.
Also, the server specific stack status callbacks are called for both the client and the server, while those only needs to be called by the reporter.

Those issues prevents to write a client application that consumes a `.zap` configuration file.

 #### Summary of changes
  * Move back `*ReportingResponseCallback` to the `gen/` folder
  * Update the `#ifdef` in `src/app/server/DataModelHandler.cpp` to only call the stack status callbacks for the server side
  * Update `HandleDataModelMessage` signature by only passing a `NodeId` for the first argument and remove the last one which is unused.
  • Loading branch information
vivien-apple authored and austinh0 committed Feb 3, 2021
1 parent bf68c65 commit 850876f
Show file tree
Hide file tree
Showing 17 changed files with 413 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,40 @@ bool __attribute__((weak)) emberAfDefaultResponseCallback(ClusterId clusterId, C
return false;
}

/** @brief Configure Reporting Response
*
* This function is called by the application framework when a Configure
* Reporting Response command is received from an external device. The
* application should return true if the message was processed or false if it
* was not.
*
* @param clusterId The cluster identifier of this response. Ver.: always
* @param buffer Buffer containing the list of attribute status records. Ver.:
* always
* @param bufLen The length in bytes of the list. Ver.: always
*/
bool __attribute__((weak)) emberAfConfigureReportingResponseCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
{
return false;
}

/** @brief Read Reporting Configuration Response
*
* This function is called by the application framework when a Read Reporting
* Configuration Response command is received from an external device. The
* application should return true if the message was processed or false if it
* was not.
*
* @param clusterId The cluster identifier of this response. Ver.: always
* @param buffer Buffer containing the list of attribute reporting configuration
* records. Ver.: always
* @param bufLen The length in bytes of the list. Ver.: always
*/
bool __attribute__((weak)) emberAfReadReportingConfigurationResponseCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
{
return false;
}

/** @brief Discover Attributes Response
*
* This function is called by the application framework when a Discover
Expand Down
28 changes: 28 additions & 0 deletions examples/all-clusters-app/all-clusters-common/gen/callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -2506,6 +2506,34 @@ bool emberAfAttributeWriteAccessCallback(chip::EndpointId endpoint, chip::Cluste
*/
bool emberAfDefaultResponseCallback(chip::ClusterId clusterId, chip::CommandId commandId, EmberAfStatus status);

/** @brief Configure Reporting Response
*
* This function is called by the application framework when a Configure
* Reporting Response command is received from an external device. The
* application should return true if the message was processed or false if it
* was not.
*
* @param clusterId The cluster identifier of this response. Ver.: always
* @param buffer Buffer containing the list of attribute status records. Ver.:
* always
* @param bufLen The length in bytes of the list. Ver.: always
*/
bool emberAfConfigureReportingResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);

/** @brief Read Reporting Configuration Response
*
* This function is called by the application framework when a Read Reporting
* Configuration Response command is received from an external device. The
* application should return true if the message was processed or false if it
* was not.
*
* @param clusterId The cluster identifier of this response. Ver.: always
* @param buffer Buffer containing the list of attribute reporting configuration
* records. Ver.: always
* @param bufLen The length in bytes of the list. Ver.: always
*/
bool emberAfReadReportingConfigurationResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);

/** @brief Discover Attributes Response
*
* This function is called by the application framework when a Discover
Expand Down
34 changes: 34 additions & 0 deletions examples/bridge-app/bridge-common/gen/callback-stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,40 @@ bool __attribute__((weak)) emberAfDefaultResponseCallback(ClusterId clusterId, C
return false;
}

/** @brief Configure Reporting Response
*
* This function is called by the application framework when a Configure
* Reporting Response command is received from an external device. The
* application should return true if the message was processed or false if it
* was not.
*
* @param clusterId The cluster identifier of this response. Ver.: always
* @param buffer Buffer containing the list of attribute status records. Ver.:
* always
* @param bufLen The length in bytes of the list. Ver.: always
*/
bool __attribute__((weak)) emberAfConfigureReportingResponseCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
{
return false;
}

/** @brief Read Reporting Configuration Response
*
* This function is called by the application framework when a Read Reporting
* Configuration Response command is received from an external device. The
* application should return true if the message was processed or false if it
* was not.
*
* @param clusterId The cluster identifier of this response. Ver.: always
* @param buffer Buffer containing the list of attribute reporting configuration
* records. Ver.: always
* @param bufLen The length in bytes of the list. Ver.: always
*/
bool __attribute__((weak)) emberAfReadReportingConfigurationResponseCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
{
return false;
}

/** @brief Discover Attributes Response
*
* This function is called by the application framework when a Discover
Expand Down
28 changes: 28 additions & 0 deletions examples/bridge-app/bridge-common/gen/callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,34 @@ bool emberAfAttributeWriteAccessCallback(chip::EndpointId endpoint, chip::Cluste
*/
bool emberAfDefaultResponseCallback(chip::ClusterId clusterId, chip::CommandId commandId, EmberAfStatus status);

/** @brief Configure Reporting Response
*
* This function is called by the application framework when a Configure
* Reporting Response command is received from an external device. The
* application should return true if the message was processed or false if it
* was not.
*
* @param clusterId The cluster identifier of this response. Ver.: always
* @param buffer Buffer containing the list of attribute status records. Ver.:
* always
* @param bufLen The length in bytes of the list. Ver.: always
*/
bool emberAfConfigureReportingResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);

/** @brief Read Reporting Configuration Response
*
* This function is called by the application framework when a Read Reporting
* Configuration Response command is received from an external device. The
* application should return true if the message was processed or false if it
* was not.
*
* @param clusterId The cluster identifier of this response. Ver.: always
* @param buffer Buffer containing the list of attribute reporting configuration
* records. Ver.: always
* @param bufLen The length in bytes of the list. Ver.: always
*/
bool emberAfReadReportingConfigurationResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);

/** @brief Discover Attributes Response
*
* This function is called by the application framework when a Discover
Expand Down
34 changes: 34 additions & 0 deletions examples/lighting-app/lighting-common/gen/callback-stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,40 @@ bool __attribute__((weak)) emberAfDefaultResponseCallback(ClusterId clusterId, C
return false;
}

/** @brief Configure Reporting Response
*
* This function is called by the application framework when a Configure
* Reporting Response command is received from an external device. The
* application should return true if the message was processed or false if it
* was not.
*
* @param clusterId The cluster identifier of this response. Ver.: always
* @param buffer Buffer containing the list of attribute status records. Ver.:
* always
* @param bufLen The length in bytes of the list. Ver.: always
*/
bool __attribute__((weak)) emberAfConfigureReportingResponseCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
{
return false;
}

/** @brief Read Reporting Configuration Response
*
* This function is called by the application framework when a Read Reporting
* Configuration Response command is received from an external device. The
* application should return true if the message was processed or false if it
* was not.
*
* @param clusterId The cluster identifier of this response. Ver.: always
* @param buffer Buffer containing the list of attribute reporting configuration
* records. Ver.: always
* @param bufLen The length in bytes of the list. Ver.: always
*/
bool __attribute__((weak)) emberAfReadReportingConfigurationResponseCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
{
return false;
}

/** @brief Discover Attributes Response
*
* This function is called by the application framework when a Discover
Expand Down
28 changes: 28 additions & 0 deletions examples/lighting-app/lighting-common/gen/callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,34 @@ bool emberAfAttributeWriteAccessCallback(chip::EndpointId endpoint, chip::Cluste
*/
bool emberAfDefaultResponseCallback(chip::ClusterId clusterId, chip::CommandId commandId, EmberAfStatus status);

/** @brief Configure Reporting Response
*
* This function is called by the application framework when a Configure
* Reporting Response command is received from an external device. The
* application should return true if the message was processed or false if it
* was not.
*
* @param clusterId The cluster identifier of this response. Ver.: always
* @param buffer Buffer containing the list of attribute status records. Ver.:
* always
* @param bufLen The length in bytes of the list. Ver.: always
*/
bool emberAfConfigureReportingResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);

/** @brief Read Reporting Configuration Response
*
* This function is called by the application framework when a Read Reporting
* Configuration Response command is received from an external device. The
* application should return true if the message was processed or false if it
* was not.
*
* @param clusterId The cluster identifier of this response. Ver.: always
* @param buffer Buffer containing the list of attribute reporting configuration
* records. Ver.: always
* @param bufLen The length in bytes of the list. Ver.: always
*/
bool emberAfReadReportingConfigurationResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);

/** @brief Discover Attributes Response
*
* This function is called by the application framework when a Discover
Expand Down
34 changes: 34 additions & 0 deletions examples/lock-app/lock-common/gen/callback-stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,40 @@ bool __attribute__((weak)) emberAfDefaultResponseCallback(ClusterId clusterId, C
return false;
}

/** @brief Configure Reporting Response
*
* This function is called by the application framework when a Configure
* Reporting Response command is received from an external device. The
* application should return true if the message was processed or false if it
* was not.
*
* @param clusterId The cluster identifier of this response. Ver.: always
* @param buffer Buffer containing the list of attribute status records. Ver.:
* always
* @param bufLen The length in bytes of the list. Ver.: always
*/
bool __attribute__((weak)) emberAfConfigureReportingResponseCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
{
return false;
}

/** @brief Read Reporting Configuration Response
*
* This function is called by the application framework when a Read Reporting
* Configuration Response command is received from an external device. The
* application should return true if the message was processed or false if it
* was not.
*
* @param clusterId The cluster identifier of this response. Ver.: always
* @param buffer Buffer containing the list of attribute reporting configuration
* records. Ver.: always
* @param bufLen The length in bytes of the list. Ver.: always
*/
bool __attribute__((weak)) emberAfReadReportingConfigurationResponseCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
{
return false;
}

/** @brief Discover Attributes Response
*
* This function is called by the application framework when a Discover
Expand Down
28 changes: 28 additions & 0 deletions examples/lock-app/lock-common/gen/callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,34 @@ bool emberAfAttributeWriteAccessCallback(chip::EndpointId endpoint, chip::Cluste
*/
bool emberAfDefaultResponseCallback(chip::ClusterId clusterId, chip::CommandId commandId, EmberAfStatus status);

/** @brief Configure Reporting Response
*
* This function is called by the application framework when a Configure
* Reporting Response command is received from an external device. The
* application should return true if the message was processed or false if it
* was not.
*
* @param clusterId The cluster identifier of this response. Ver.: always
* @param buffer Buffer containing the list of attribute status records. Ver.:
* always
* @param bufLen The length in bytes of the list. Ver.: always
*/
bool emberAfConfigureReportingResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);

/** @brief Read Reporting Configuration Response
*
* This function is called by the application framework when a Read Reporting
* Configuration Response command is received from an external device. The
* application should return true if the message was processed or false if it
* was not.
*
* @param clusterId The cluster identifier of this response. Ver.: always
* @param buffer Buffer containing the list of attribute reporting configuration
* records. Ver.: always
* @param bufLen The length in bytes of the list. Ver.: always
*/
bool emberAfReadReportingConfigurationResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);

/** @brief Discover Attributes Response
*
* This function is called by the application framework when a Discover
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,40 @@ bool __attribute__((weak)) emberAfDefaultResponseCallback(ClusterId clusterId, C
return false;
}

/** @brief Configure Reporting Response
*
* This function is called by the application framework when a Configure
* Reporting Response command is received from an external device. The
* application should return true if the message was processed or false if it
* was not.
*
* @param clusterId The cluster identifier of this response. Ver.: always
* @param buffer Buffer containing the list of attribute status records. Ver.:
* always
* @param bufLen The length in bytes of the list. Ver.: always
*/
bool __attribute__((weak)) emberAfConfigureReportingResponseCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
{
return false;
}

/** @brief Read Reporting Configuration Response
*
* This function is called by the application framework when a Read Reporting
* Configuration Response command is received from an external device. The
* application should return true if the message was processed or false if it
* was not.
*
* @param clusterId The cluster identifier of this response. Ver.: always
* @param buffer Buffer containing the list of attribute reporting configuration
* records. Ver.: always
* @param bufLen The length in bytes of the list. Ver.: always
*/
bool __attribute__((weak)) emberAfReadReportingConfigurationResponseCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
{
return false;
}

/** @brief Discover Attributes Response
*
* This function is called by the application framework when a Discover
Expand Down
28 changes: 28 additions & 0 deletions examples/temperature-measurement-app/esp32/main/gen/callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,34 @@ bool emberAfAttributeWriteAccessCallback(chip::EndpointId endpoint, chip::Cluste
*/
bool emberAfDefaultResponseCallback(chip::ClusterId clusterId, chip::CommandId commandId, EmberAfStatus status);

/** @brief Configure Reporting Response
*
* This function is called by the application framework when a Configure
* Reporting Response command is received from an external device. The
* application should return true if the message was processed or false if it
* was not.
*
* @param clusterId The cluster identifier of this response. Ver.: always
* @param buffer Buffer containing the list of attribute status records. Ver.:
* always
* @param bufLen The length in bytes of the list. Ver.: always
*/
bool emberAfConfigureReportingResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);

/** @brief Read Reporting Configuration Response
*
* This function is called by the application framework when a Read Reporting
* Configuration Response command is received from an external device. The
* application should return true if the message was processed or false if it
* was not.
*
* @param clusterId The cluster identifier of this response. Ver.: always
* @param buffer Buffer containing the list of attribute reporting configuration
* records. Ver.: always
* @param bufLen The length in bytes of the list. Ver.: always
*/
bool emberAfReadReportingConfigurationResponseCallback(chip::ClusterId clusterId, uint8_t * buffer, uint16_t bufLen);

/** @brief Discover Attributes Response
*
* This function is called by the application framework when a Discover
Expand Down
10 changes: 0 additions & 10 deletions src/app/reporting/reporting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1088,13 +1088,3 @@ uint8_t emAfPluginReportingConditionallyAddReportingEntry(EmberAfPluginReporting
}
return 0;
}

bool emberAfConfigureReportingResponseCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
{
return false;
}

bool emberAfReadReportingConfigurationResponseCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
{
return false;
}
Loading

0 comments on commit 850876f

Please sign in to comment.