Update emberAf*AttributeChange callbacks (#10315)
* Add chip::app::ConcreteAttributePath
* Update emberAf[Pre/Post]AttributeChangeCallback signature to Matter[Pre/Post]AttributeChangeCallback
* Update emberAf{{asUpperCamelCase label}}ClusterAttributeChangeCallback signature to Matter{{asUpperCamelCase label}}AttributeChangeCallback
* Update usage of emberAf{{asUpperCamelCase label}}ClusterAttributeChangeCallback across the tree
* Update usage of emberAfPostAttributeChangeCallback across the tree
* Update generated content
diff --git a/examples/all-clusters-app/linux/main.cpp b/examples/all-clusters-app/linux/main.cpp
index 224df1e..8884a9b 100644
--- a/examples/all-clusters-app/linux/main.cpp
+++ b/examples/all-clusters-app/linux/main.cpp
@@ -16,36 +16,11 @@
* limitations under the License.
*/
-#include <platform/CHIPDeviceLayer.h>
-#include <platform/PlatformManager.h>
-
-#include <app-common/zap-generated/attribute-id.h>
-#include <app-common/zap-generated/cluster-id.h>
#include <app/Command.h>
-#include <app/chip-zcl-zpro-codec.h>
-#include <app/server/Mdns.h>
-#include <app/util/af-types.h>
#include <app/util/af.h>
-#include <app/util/attribute-storage.h>
-#include <app/util/util.h>
-#include <lib/core/CHIPError.h>
-#include <lib/support/CHIPMem.h>
-#include <lib/support/RandUtils.h>
#include "AppMain.h"
-#include <cassert>
-#include <iostream>
-
-using namespace chip;
-using namespace chip::Inet;
-using namespace chip::Transport;
-using namespace chip::DeviceLayer;
-
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
-{}
-
bool emberAfBasicClusterMfgSpecificPingCallback(chip::app::Command * commandObj)
{
emberAfSendDefaultResponse(emberAfCurrentCommand(), EMBER_ZCL_STATUS_SUCCESS);
diff --git a/examples/lighting-app/efr32/src/ZclCallbacks.cpp b/examples/lighting-app/efr32/src/ZclCallbacks.cpp
index 93e3e3d..03c93db 100644
--- a/examples/lighting-app/efr32/src/ZclCallbacks.cpp
+++ b/examples/lighting-app/efr32/src/ZclCallbacks.cpp
@@ -21,29 +21,25 @@
*/
#include "AppConfig.h"
-#include <lib/support/logging/CHIPLogging.h>
-
#include "LightingManager.h"
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
-#include <app/util/af-types.h>
+#include <app/ConcreteAttributePath.h>
+#include <lib/support/logging/CHIPLogging.h>
using namespace ::chip;
using namespace ::chip::app::Clusters;
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
+void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
+ uint16_t size, uint8_t * value)
{
- if (clusterId == OnOff::Id)
- {
- if (attributeId != OnOff::Attributes::OnOff::Id)
- {
- ChipLogError(Zcl, "ON OFF attribute ID: " ChipLogFormatMEI " Type: %" PRIu8 " Value: %" PRIu16 ", length %" PRIu16,
- ChipLogValueMEI(attributeId), type, *value, size);
- return;
- }
+ ClusterId clusterId = attributePath.mClusterId;
+ AttributeId attributeId = attributePath.mAttributeId;
+ ChipLogProgress(Zcl, "Cluster callback: " ChipLogFormatMEI, ChipLogValueMEI(clusterId));
+ if (clusterId == OnOff::Id && attributeId == OnOff::Attributes::OnOff::Id)
+ {
LightMgr().InitiateAction(AppEvent::kEventType_Light, *value ? LightingManager::ON_ACTION : LightingManager::OFF_ACTION);
}
else if (clusterId == LevelControl::Id)
diff --git a/examples/lighting-app/linux/main.cpp b/examples/lighting-app/linux/main.cpp
index 10f5ae6..5cfb79f 100644
--- a/examples/lighting-app/linux/main.cpp
+++ b/examples/lighting-app/linux/main.cpp
@@ -16,54 +16,27 @@
* limitations under the License.
*/
-#include <platform/CHIPDeviceLayer.h>
-#include <platform/PlatformManager.h>
+#include "LightingManager.h"
+#include <AppMain.h>
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
-#include <app/chip-zcl-zpro-codec.h>
-#include <app/util/af-types.h>
-#include <app/util/af.h>
-#include <app/util/attribute-storage.h>
-#include <app/util/util.h>
-
-#include "LightingManager.h"
-
-#include <AppMain.h>
+#include <app/ConcreteAttributePath.h>
+#include <lib/support/logging/CHIPLogging.h>
#if defined(PW_RPC_ENABLED)
#include "Rpc.h"
#endif // PW_RPC_ENABLED
-#include <cassert>
-#include <iostream>
-
using namespace chip;
using namespace chip::app::Clusters;
-using namespace chip::DeviceLayer;
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
+void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
+ uint16_t size, uint8_t * value)
{
- if (clusterId != OnOff::Id)
+ if (attributePath.mClusterId == OnOff::Id && attributePath.mAttributeId == OnOff::Attributes::OnOff::Id)
{
- ChipLogProgress(Zcl, "Unknown cluster ID: " ChipLogFormatMEI, ChipLogValueMEI(clusterId));
- return;
- }
-
- if (attributeId != OnOff::Attributes::OnOff::Id)
- {
- ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId));
- return;
- }
-
- if (*value)
- {
- LightingMgr().InitiateAction(LightingManager::ON_ACTION);
- }
- else
- {
- LightingMgr().InitiateAction(LightingManager::OFF_ACTION);
+ LightingMgr().InitiateAction(*value ? LightingManager::ON_ACTION : LightingManager::OFF_ACTION);
}
}
diff --git a/examples/lighting-app/mbed/main/ZclCallbacks.cpp b/examples/lighting-app/mbed/main/ZclCallbacks.cpp
index 45945e1..6975bc8 100644
--- a/examples/lighting-app/mbed/main/ZclCallbacks.cpp
+++ b/examples/lighting-app/mbed/main/ZclCallbacks.cpp
@@ -16,43 +16,31 @@
* limitations under the License.
*/
-#include <lib/support/logging/CHIPLogging.h>
-
-#include <app-common/zap-generated/attribute-id.h>
-#include <app-common/zap-generated/cluster-id.h>
-#include <app-common/zap-generated/command-id.h>
-#include <app/util/af-types.h>
-#include <app/util/af.h>
-
#include "AppTask.h"
#include "LightingManager.h"
+#include <app-common/zap-generated/ids/Attributes.h>
+#include <app-common/zap-generated/ids/Clusters.h>
+#include <app/ConcreteAttributePath.h>
+#include <lib/support/logging/CHIPLogging.h>
+
using namespace chip;
+using namespace ::chip::app::Clusters;
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
+void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
+ uint16_t size, uint8_t * value)
{
- ChipLogProgress(Zcl, "Cluster callback: %" PRIx32, clusterId);
+ ClusterId clusterId = attributePath.mClusterId;
+ AttributeId attributeId = attributePath.mAttributeId;
+ ChipLogProgress(Zcl, "Cluster callback: " ChipLogFormatMEI, ChipLogValueMEI(clusterId));
- if (clusterId == ZCL_ON_OFF_CLUSTER_ID)
+ if (clusterId == OnOff::Id && attributeId == OnOff::Attributes::OnOff::Id)
{
- if (attributeId != ZCL_ON_OFF_ATTRIBUTE_ID)
- {
- ChipLogProgress(Zcl, "Unknown attribute ID: %" PRIx32, attributeId);
- return;
- }
-
LightingMgr().InitiateAction(*value ? LightingManager::ON_ACTION : LightingManager::OFF_ACTION,
AppEvent::kEventType_Lighting, size, value);
}
- else if (clusterId == ZCL_LEVEL_CONTROL_CLUSTER_ID)
+ else if (clusterId == LevelControl::Id && attributeId == LevelControl::Attributes::CurrentLevel::Id)
{
- if (attributeId != ZCL_CURRENT_LEVEL_ATTRIBUTE_ID)
- {
- ChipLogProgress(Zcl, "Unknown attribute ID: %" PRIx32, attributeId);
- return;
- }
-
ChipLogProgress(Zcl, "Value: %u, length %u", *value, size);
if (size == 1)
{
@@ -63,11 +51,6 @@
ChipLogError(Zcl, "wrong length for level: %d", size);
}
}
- else
- {
- ChipLogProgress(Zcl, "Unknown cluster ID: %" PRIx32, clusterId);
- return;
- }
}
/** @brief OnOff Cluster Init
diff --git a/examples/lighting-app/nrfconnect/main/ZclCallbacks.cpp b/examples/lighting-app/nrfconnect/main/ZclCallbacks.cpp
index 928463f..d7eb7b2 100644
--- a/examples/lighting-app/nrfconnect/main/ZclCallbacks.cpp
+++ b/examples/lighting-app/nrfconnect/main/ZclCallbacks.cpp
@@ -16,23 +16,23 @@
* limitations under the License.
*/
-#include <lib/support/logging/CHIPLogging.h>
+#include "AppTask.h"
+#include "LightingManager.h"
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
-#include <app-common/zap-generated/ids/Commands.h>
-#include <app/util/af-types.h>
-#include <app/util/af.h>
-
-#include "AppTask.h"
-#include "LightingManager.h"
+#include <app/ConcreteAttributePath.h>
+#include <lib/support/logging/CHIPLogging.h>
using namespace chip;
using namespace chip::app::Clusters;
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
+void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
+ uint16_t size, uint8_t * value)
{
+ ClusterId clusterId = attributePath.mClusterId;
+ AttributeId attributeId = attributePath.mAttributeId;
+
if (clusterId == OnOff::Id && attributeId == OnOff::Attributes::OnOff::Id)
{
ChipLogProgress(Zcl, "Cluster OnOff: attribute OnOff set to %" PRIu8, *value);
diff --git a/examples/lighting-app/qpg/src/ZclCallbacks.cpp b/examples/lighting-app/qpg/src/ZclCallbacks.cpp
index 0882678..c2151f9 100644
--- a/examples/lighting-app/qpg/src/ZclCallbacks.cpp
+++ b/examples/lighting-app/qpg/src/ZclCallbacks.cpp
@@ -21,39 +21,29 @@
#include "AppTask.h"
#include "LightingManager.h"
-#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attributes/Accessors.h>
-#include <app-common/zap-generated/cluster-id.h>
-#include <app-common/zap-generated/command-id.h>
-#include <app/chip-zcl-zpro-codec.h>
+#include <app-common/zap-generated/ids/Attributes.h>
+#include <app-common/zap-generated/ids/Clusters.h>
+#include <app/ConcreteAttributePath.h>
#include <app/util/af-types.h>
-#include <app/util/attribute-storage.h>
-#include <app/util/util.h>
+#include <lib/support/logging/CHIPLogging.h>
using namespace ::chip;
using namespace chip::app::Clusters;
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
+void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
+ uint16_t size, uint8_t * value)
{
- if (clusterId == ZCL_ON_OFF_CLUSTER_ID)
- {
- if (attributeId != ZCL_ON_OFF_ATTRIBUTE_ID)
- {
- ChipLogProgress(Zcl, "Unknown attribute ID: %" PRIx32, attributeId);
- return;
- }
+ EndpointId endpoint = attributePath.mEndpointId;
+ ClusterId clusterId = attributePath.mClusterId;
+ AttributeId attributeId = attributePath.mAttributeId;
+ if (clusterId == OnOff::Id && attributeId == OnOff::Attributes::OnOff::Id)
+ {
LightingMgr().InitiateAction(*value ? LightingManager::ON_ACTION : LightingManager::OFF_ACTION, 0, size, value);
}
- else if (clusterId == ZCL_LEVEL_CONTROL_CLUSTER_ID)
+ else if (clusterId == LevelControl::Id && attributeId == LevelControl::Attributes::CurrentLevel::Id)
{
- if (attributeId != ZCL_CURRENT_LEVEL_ATTRIBUTE_ID)
- {
- ChipLogProgress(Zcl, "Unknown attribute ID: %" PRIx32, attributeId);
- return;
- }
-
if (size == 1)
{
ChipLogProgress(Zcl, "New level: %u", *value);
@@ -64,36 +54,35 @@
ChipLogError(Zcl, "wrong length for level: %d", size);
}
}
- else if (clusterId == ZCL_COLOR_CONTROL_CLUSTER_ID)
+ else if (clusterId == ColorControl::Id)
{
/* ignore several attributes that are currently not processed */
- if ((attributeId == ZCL_COLOR_CONTROL_REMAINING_TIME_ATTRIBUTE_ID) ||
- (attributeId == ZCL_COLOR_CONTROL_ENHANCED_COLOR_MODE_ATTRIBUTE_ID) ||
- (attributeId == ZCL_COLOR_CONTROL_COLOR_MODE_ATTRIBUTE_ID))
+ if ((attributeId == ColorControl::Attributes::RemainingTime::Id) ||
+ (attributeId == ColorControl::Attributes::EnhancedColorMode::Id) ||
+ (attributeId == ColorControl::Attributes::ColorMode::Id))
{
return;
}
- if ((attributeId != ZCL_COLOR_CONTROL_CURRENT_X_ATTRIBUTE_ID) &&
- (attributeId != ZCL_COLOR_CONTROL_CURRENT_Y_ATTRIBUTE_ID) &&
- (attributeId != ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID) &&
- (attributeId != ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID))
+ if ((attributeId != ColorControl::Attributes::CurrentX::Id) && (attributeId != ColorControl::Attributes::CurrentY::Id) &&
+ (attributeId != ColorControl::Attributes::CurrentHue::Id) &&
+ (attributeId != ColorControl::Attributes::CurrentSaturation::Id))
{
- ChipLogProgress(Zcl, "Unknown attribute ID: %" PRIx32, attributeId);
+ ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId));
return;
}
if (size == sizeof(uint16_t))
{
XyColor_t xy;
- if (attributeId == ZCL_COLOR_CONTROL_CURRENT_X_ATTRIBUTE_ID)
+ if (attributeId == ColorControl::Attributes::CurrentX::Id)
{
xy.x = *reinterpret_cast<uint16_t *>(value);
// get Y from cluster value storage
EmberAfStatus status = ColorControl::Attributes::CurrentY::Get(endpoint, &xy.y);
assert(status == EMBER_ZCL_STATUS_SUCCESS);
}
- if (attributeId == ZCL_COLOR_CONTROL_CURRENT_Y_ATTRIBUTE_ID)
+ if (attributeId == ColorControl::Attributes::CurrentY::Id)
{
xy.y = *reinterpret_cast<uint16_t *>(value);
// get X from cluster value storage
@@ -106,14 +95,14 @@
else if (size == sizeof(uint8_t))
{
HsvColor_t hsv;
- if (attributeId == ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID)
+ if (attributeId == ColorControl::Attributes::CurrentHue::Id)
{
hsv.h = *value;
// get saturation from cluster value storage
EmberAfStatus status = ColorControl::Attributes::CurrentSaturation::Get(endpoint, &hsv.s);
assert(status == EMBER_ZCL_STATUS_SUCCESS);
}
- if (attributeId == ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID)
+ if (attributeId == ColorControl::Attributes::CurrentSaturation::Id)
{
hsv.s = *value;
// get hue from cluster value storage
@@ -130,7 +119,7 @@
}
else
{
- ChipLogProgress(Zcl, "Unknown cluster ID: %" PRIx32, clusterId);
+ ChipLogProgress(Zcl, "Unknown cluster ID: " ChipLogFormatMEI, ChipLogValueMEI(clusterId));
return;
}
}
diff --git a/examples/lighting-app/telink/src/ZclCallbacks.cpp b/examples/lighting-app/telink/src/ZclCallbacks.cpp
index 3a4430d..f69006c 100644
--- a/examples/lighting-app/telink/src/ZclCallbacks.cpp
+++ b/examples/lighting-app/telink/src/ZclCallbacks.cpp
@@ -16,44 +16,31 @@
* limitations under the License.
*/
-#include <lib/support/logging/CHIPLogging.h>
+#include "AppTask.h"
+#include "LightingManager.h"
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
-#include <app-common/zap-generated/ids/Commands.h>
-#include <app/util/af-types.h>
-#include <app/util/af.h>
-
-#include "AppTask.h"
-#include "LightingManager.h"
+#include <app/ConcreteAttributePath.h>
+#include <lib/support/logging/CHIPLogging.h>
using namespace chip;
using namespace chip::app::Clusters;
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
+void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
+ uint16_t size, uint8_t * value)
{
+ ClusterId clusterId = attributePath.mClusterId;
+ AttributeId attributeId = attributePath.mAttributeId;
ChipLogProgress(Zcl, "Cluster callback: " ChipLogFormatMEI, ChipLogValueMEI(clusterId));
- if (clusterId == OnOff::Id)
+ if (clusterId == OnOff::Id && attributeId == OnOff::Attributes::OnOff::Id)
{
- if (attributeId != OnOff::Attributes::OnOff::Id)
- {
- ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId));
- return;
- }
-
LightingMgr().InitiateAction(*value ? LightingManager::ON_ACTION : LightingManager::OFF_ACTION,
AppEvent::kEventType_Lighting, size, value);
}
- else if (clusterId == LevelControl::Id)
+ else if (clusterId == LevelControl::Id && attributeId == LevelControl::Attributes::CurrentLevel::Id)
{
- if (attributeId != LevelControl::Attributes::CurrentLevel::Id)
- {
- ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId));
- return;
- }
-
ChipLogProgress(Zcl, "Value: %u, length %u", *value, size);
if (size == 1)
{
@@ -64,11 +51,6 @@
ChipLogError(Zcl, "wrong length for level: %d", size);
}
}
- else
- {
- ChipLogProgress(Zcl, "Unknown cluster ID: " ChipLogFormatMEI, ChipLogValueMEI(clusterId));
- return;
- }
}
/** @brief OnOff Cluster Init
diff --git a/examples/lock-app/cc13x2x7_26x2x7/main/ZclCallbacks.cpp b/examples/lock-app/cc13x2x7_26x2x7/main/ZclCallbacks.cpp
index 81cfc69..b2eafab 100644
--- a/examples/lock-app/cc13x2x7_26x2x7/main/ZclCallbacks.cpp
+++ b/examples/lock-app/cc13x2x7_26x2x7/main/ZclCallbacks.cpp
@@ -15,43 +15,23 @@
* limitations under the License.
*/
-#include <lib/support/logging/CHIPLogging.h>
-
#include "AppConfig.h"
#include "BoltLockManager.h"
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
-#include <app/chip-zcl-zpro-codec.h>
-#include <app/util/af-types.h>
-#include <app/util/attribute-storage.h>
-#include <app/util/util.h>
+#include <app/ConcreteAttributePath.h>
+#include <lib/support/logging/CHIPLogging.h>
using namespace ::chip;
using namespace ::chip::app::Clusters;
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
+void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
+ uint16_t size, uint8_t * value)
{
- if (clusterId != OnOff::Id)
+ if (attributePath.mClusterId == OnOff::Id && attributePath.mAttributeId == OnOff::Attributes::OnOff::Id)
{
- ChipLogProgress(Zcl, "Unknown cluster ID: " ChipLogFormatMEI, ChipLogValueMEI(clusterId));
- return;
- }
-
- if (attributeId != OnOff::Attributes::OnOff::Id)
- {
- ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId));
- return;
- }
-
- if (*value)
- {
- BoltLockMgr().InitiateAction(0, BoltLockManager::LOCK_ACTION);
- }
- else
- {
- BoltLockMgr().InitiateAction(0, BoltLockManager::UNLOCK_ACTION);
+ BoltLockMgr().InitiateAction(0, *value ? BoltLockManager::LOCK_ACTION : BoltLockManager::UNLOCK_ACTION);
}
}
diff --git a/examples/lock-app/efr32/src/ZclCallbacks.cpp b/examples/lock-app/efr32/src/ZclCallbacks.cpp
index e1c6cb8..bdccc68 100644
--- a/examples/lock-app/efr32/src/ZclCallbacks.cpp
+++ b/examples/lock-app/efr32/src/ZclCallbacks.cpp
@@ -25,33 +25,19 @@
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
-#include <app/util/af-types.h>
+#include <app/ConcreteAttributePath.h>
+#include <lib/support/logging/CHIPLogging.h>
using namespace ::chip;
using namespace ::chip::app::Clusters;
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
+void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
+ uint16_t size, uint8_t * value)
{
- if (clusterId != OnOff::Id)
+ if (attributePath.mClusterId == OnOff::Id && attributePath.mAttributeId == OnOff::Attributes::OnOff::Id)
{
- EFR32_LOG("Unknown cluster ID: " ChipLogFormatMEI, ChipLogValueMEI(clusterId));
- return;
- }
-
- if (attributeId != OnOff::Attributes::OnOff::Id)
- {
- EFR32_LOG("Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId));
- return;
- }
-
- if (*value)
- {
- BoltLockMgr().InitiateAction(AppEvent::kEventType_Lock, BoltLockManager::LOCK_ACTION);
- }
- else
- {
- BoltLockMgr().InitiateAction(AppEvent::kEventType_Lock, BoltLockManager::UNLOCK_ACTION);
+ BoltLockMgr().InitiateAction(AppEvent::kEventType_Lock,
+ *value ? BoltLockManager::LOCK_ACTION : BoltLockManager::UNLOCK_ACTION);
}
}
diff --git a/examples/lock-app/esp32/main/CHIPDeviceManager.cpp b/examples/lock-app/esp32/main/CHIPDeviceManager.cpp
index 37a2fac..269ca06 100644
--- a/examples/lock-app/esp32/main/CHIPDeviceManager.cpp
+++ b/examples/lock-app/esp32/main/CHIPDeviceManager.cpp
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include "CHIPDeviceManager.h"
+#include <app/ConcreteAttributePath.h>
#include <app/util/basic-types.h>
#include <lib/support/CHIPMem.h>
#include <lib/support/CodeUtils.h>
@@ -92,13 +93,14 @@
} // namespace DeviceManager
} // namespace chip
-void emberAfPostAttributeChangeCallback(EndpointId endpointId, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
+void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
+ uint16_t size, uint8_t * value)
{
chip::DeviceManager::CHIPDeviceManagerCallbacks * cb =
chip::DeviceManager::CHIPDeviceManager::GetInstance().GetCHIPDeviceManagerCallbacks();
if (cb != nullptr)
{
- cb->PostAttributeChangeCallback(endpointId, clusterId, attributeId, mask, manufacturerCode, type, size, value);
+ cb->PostAttributeChangeCallback(attributePath.mEndpointId, attributePath.mClusterId, attributePath.mAttributeId, mask, 0x0,
+ type, size, value);
}
}
diff --git a/examples/lock-app/mbed/main/ZclCallbacks.cpp b/examples/lock-app/mbed/main/ZclCallbacks.cpp
index dc03ab3..9a3db78 100644
--- a/examples/lock-app/mbed/main/ZclCallbacks.cpp
+++ b/examples/lock-app/mbed/main/ZclCallbacks.cpp
@@ -16,35 +16,24 @@
* limitations under the License.
*/
-#include <lib/support/logging/CHIPLogging.h>
-
#include "AppTask.h"
#include "BoltLockManager.h"
-#include <app-common/zap-generated/attribute-id.h>
-#include <app-common/zap-generated/cluster-id.h>
-#include <app-common/zap-generated/command-id.h>
-#include <app/util/af-types.h>
-#include <app/util/af.h>
+#include <app-common/zap-generated/ids/Attributes.h>
+#include <app-common/zap-generated/ids/Clusters.h>
+#include <app/ConcreteAttributePath.h>
+#include <lib/support/logging/CHIPLogging.h>
using namespace ::chip;
+using namespace ::chip::app::Clusters;
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
+void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
+ uint16_t size, uint8_t * value)
{
- if (clusterId != ZCL_ON_OFF_CLUSTER_ID)
+ if (attributePath.mClusterId == OnOff::Id && attributePath.mAttributeId == OnOff::Attributes::OnOff::Id)
{
- ChipLogProgress(Zcl, "Unknown cluster ID: %d", clusterId);
- return;
+ BoltLockMgr().InitiateAction(0, *value ? BoltLockManager::LOCK_ACTION : BoltLockManager::UNLOCK_ACTION);
}
-
- if (attributeId != ZCL_ON_OFF_ATTRIBUTE_ID)
- {
- ChipLogProgress(Zcl, "Unknown attribute ID: %d", attributeId);
- return;
- }
-
- BoltLockMgr().InitiateAction(0, *value ? BoltLockManager::LOCK_ACTION : BoltLockManager::UNLOCK_ACTION);
}
/** @brief OnOff Cluster Init
diff --git a/examples/lock-app/nrfconnect/main/ZclCallbacks.cpp b/examples/lock-app/nrfconnect/main/ZclCallbacks.cpp
index 2bad68f..5ce622e 100644
--- a/examples/lock-app/nrfconnect/main/ZclCallbacks.cpp
+++ b/examples/lock-app/nrfconnect/main/ZclCallbacks.cpp
@@ -16,25 +16,22 @@
* limitations under the License.
*/
-#include <lib/support/logging/CHIPLogging.h>
-
#include "AppTask.h"
#include "BoltLockManager.h"
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
-#include <app/util/af-types.h>
-#include <app/util/af.h>
+#include <app/ConcreteAttributePath.h>
+#include <lib/support/logging/CHIPLogging.h>
using namespace ::chip;
using namespace ::chip::app::Clusters;
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
+void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
+ uint16_t size, uint8_t * value)
{
- if (clusterId == OnOff::Id && attributeId == OnOff::Attributes::OnOff::Id)
+ if (attributePath.mClusterId == OnOff::Id && attributePath.mAttributeId == OnOff::Attributes::OnOff::Id)
{
- ChipLogProgress(Zcl, "Cluster OnOff: attribute OnOff set to %" PRIu8, *value);
BoltLockMgr().InitiateAction(0, *value ? BoltLockManager::LOCK_ACTION : BoltLockManager::UNLOCK_ACTION);
}
}
diff --git a/examples/lock-app/p6/src/ZclCallbacks.cpp b/examples/lock-app/p6/src/ZclCallbacks.cpp
index e40c36f..777e788 100644
--- a/examples/lock-app/p6/src/ZclCallbacks.cpp
+++ b/examples/lock-app/p6/src/ZclCallbacks.cpp
@@ -24,37 +24,21 @@
#include "AppTask.h"
#include "BoltLockManager.h"
-#include <app-common/zap-generated/attribute-id.h>
-#include <app-common/zap-generated/cluster-id.h>
-#include <app/chip-zcl-zpro-codec.h>
-#include <app/util/af-types.h>
-#include <app/util/attribute-storage.h>
-#include <app/util/util.h>
+#include <app-common/zap-generated/ids/Attributes.h>
+#include <app-common/zap-generated/ids/Clusters.h>
+#include <app/ConcreteAttributePath.h>
+#include <lib/support/logging/CHIPLogging.h>
using namespace ::chip;
+using namespace ::chip::app::Clusters;
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
+void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
+ uint16_t size, uint8_t * value)
{
- if (clusterId != ZCL_ON_OFF_CLUSTER_ID)
+ if (attributePath.mClusterId == OnOff::Id && attributePath.mAttributeId == OnOff::Attributes::OnOff::Id)
{
- P6_LOG("Unknown cluster ID: %ld", clusterId);
- return;
- }
-
- if (attributeId != ZCL_ON_OFF_ATTRIBUTE_ID)
- {
- P6_LOG("Unknown attribute ID: %ld", attributeId);
- return;
- }
-
- if (*value)
- {
- BoltLockMgr().InitiateAction(AppEvent::kEventType_Lock, BoltLockManager::Action::kLock);
- }
- else
- {
- BoltLockMgr().InitiateAction(AppEvent::kEventType_Lock, BoltLockManager::Action::kUnlock);
+ BoltLockMgr().InitiateAction(AppEvent::kEventType_Lock,
+ *value ? BoltLockManager::Action::kLock : BoltLockManager::Action::kUnlock);
}
}
diff --git a/examples/lock-app/qpg/src/ZclCallbacks.cpp b/examples/lock-app/qpg/src/ZclCallbacks.cpp
index 1371b28..5ce622e 100644
--- a/examples/lock-app/qpg/src/ZclCallbacks.cpp
+++ b/examples/lock-app/qpg/src/ZclCallbacks.cpp
@@ -16,42 +16,23 @@
* limitations under the License.
*/
-#include <lib/support/logging/CHIPLogging.h>
-
#include "AppTask.h"
#include "BoltLockManager.h"
-#include <app-common/zap-generated/attribute-id.h>
-#include <app-common/zap-generated/cluster-id.h>
-#include <app/chip-zcl-zpro-codec.h>
-#include <app/util/af-types.h>
-#include <app/util/attribute-storage.h>
-#include <app/util/util.h>
+#include <app-common/zap-generated/ids/Attributes.h>
+#include <app-common/zap-generated/ids/Clusters.h>
+#include <app/ConcreteAttributePath.h>
+#include <lib/support/logging/CHIPLogging.h>
using namespace ::chip;
+using namespace ::chip::app::Clusters;
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
+void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
+ uint16_t size, uint8_t * value)
{
- if (clusterId != ZCL_ON_OFF_CLUSTER_ID)
+ if (attributePath.mClusterId == OnOff::Id && attributePath.mAttributeId == OnOff::Attributes::OnOff::Id)
{
- ChipLogProgress(Zcl, "Unknown cluster ID: %" PRIx32, clusterId);
- return;
- }
-
- if (attributeId != ZCL_ON_OFF_ATTRIBUTE_ID)
- {
- ChipLogProgress(Zcl, "Unknown attribute ID: %" PRIx32, attributeId);
- return;
- }
-
- if (*value)
- {
- BoltLockMgr().InitiateAction(0, BoltLockManager::LOCK_ACTION);
- }
- else
- {
- BoltLockMgr().InitiateAction(0, BoltLockManager::UNLOCK_ACTION);
+ BoltLockMgr().InitiateAction(0, *value ? BoltLockManager::LOCK_ACTION : BoltLockManager::UNLOCK_ACTION);
}
}
diff --git a/examples/pump-app/cc13x2x7_26x2x7/main/ZclCallbacks.cpp b/examples/pump-app/cc13x2x7_26x2x7/main/ZclCallbacks.cpp
index 496ce9d..8d4abc4 100644
--- a/examples/pump-app/cc13x2x7_26x2x7/main/ZclCallbacks.cpp
+++ b/examples/pump-app/cc13x2x7_26x2x7/main/ZclCallbacks.cpp
@@ -15,44 +15,23 @@
* limitations under the License.
*/
-#include <lib/support/logging/CHIPLogging.h>
-
#include "AppConfig.h"
#include "PumpManager.h"
-#include <app-common/zap-generated/enums.h>
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
-#include <app/chip-zcl-zpro-codec.h>
-#include <app/util/af-types.h>
-#include <app/util/attribute-storage.h>
-#include <app/util/util.h>
+#include <app/ConcreteAttributePath.h>
+#include <lib/support/logging/CHIPLogging.h>
using namespace ::chip;
using namespace ::chip::app::Clusters;
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
+void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
+ uint16_t size, uint8_t * value)
{
- if (clusterId != OnOff::Id)
+ if (attributePath.mClusterId == OnOff::Id && attributePath.mAttributeId == OnOff::Attributes::OnOff::Id)
{
- ChipLogProgress(Zcl, "Unknown cluster ID: " ChipLogFormatMEI, ChipLogValueMEI(clusterId));
- return;
- }
-
- if (attributeId != OnOff::Attributes::OnOff::Id)
- {
- ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId));
- return;
- }
-
- if (*value)
- {
- PumpMgr().InitiateAction(0, PumpManager::LOCK_ACTION);
- }
- else
- {
- PumpMgr().InitiateAction(0, PumpManager::UNLOCK_ACTION);
+ PumpMgr().InitiateAction(0, *value ? PumpManager::LOCK_ACTION : PumpManager::UNLOCK_ACTION);
}
}
diff --git a/examples/pump-app/nrfconnect/main/ZclCallbacks.cpp b/examples/pump-app/nrfconnect/main/ZclCallbacks.cpp
index dac901a..05271e5 100644
--- a/examples/pump-app/nrfconnect/main/ZclCallbacks.cpp
+++ b/examples/pump-app/nrfconnect/main/ZclCallbacks.cpp
@@ -15,41 +15,22 @@
* limitations under the License.
*/
-#include <lib/support/logging/CHIPLogging.h>
-
#include "AppTask.h"
#include "PumpManager.h"
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
-#include <app/util/af-types.h>
-#include <app/util/af.h>
+#include <app/ConcreteAttributePath.h>
using namespace ::chip;
using namespace ::chip::app::Clusters;
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
+void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
+ uint16_t size, uint8_t * value)
{
- if (clusterId != OnOff::Id)
+ if (attributePath.mClusterId == OnOff::Id && attributePath.mAttributeId == OnOff::Attributes::OnOff::Id)
{
- ChipLogProgress(Zcl, "Unknown cluster ID: %" PRIx32, clusterId);
- return;
- }
-
- if (attributeId != OnOff::Attributes::OnOff::Id)
- {
- ChipLogProgress(Zcl, "Unknown attribute ID: %" PRIx32, attributeId);
- return;
- }
-
- if (*value)
- {
- PumpMgr().InitiateAction(0, PumpManager::START_ACTION);
- }
- else
- {
- PumpMgr().InitiateAction(0, PumpManager::STOP_ACTION);
+ PumpMgr().InitiateAction(0, *value ? PumpManager::START_ACTION : PumpManager::STOP_ACTION);
}
}
diff --git a/examples/pump-controller-app/cc13x2x7_26x2x7/main/ZclCallbacks.cpp b/examples/pump-controller-app/cc13x2x7_26x2x7/main/ZclCallbacks.cpp
index 496ce9d..8d4abc4 100644
--- a/examples/pump-controller-app/cc13x2x7_26x2x7/main/ZclCallbacks.cpp
+++ b/examples/pump-controller-app/cc13x2x7_26x2x7/main/ZclCallbacks.cpp
@@ -15,44 +15,23 @@
* limitations under the License.
*/
-#include <lib/support/logging/CHIPLogging.h>
-
#include "AppConfig.h"
#include "PumpManager.h"
-#include <app-common/zap-generated/enums.h>
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
-#include <app/chip-zcl-zpro-codec.h>
-#include <app/util/af-types.h>
-#include <app/util/attribute-storage.h>
-#include <app/util/util.h>
+#include <app/ConcreteAttributePath.h>
+#include <lib/support/logging/CHIPLogging.h>
using namespace ::chip;
using namespace ::chip::app::Clusters;
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
+void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
+ uint16_t size, uint8_t * value)
{
- if (clusterId != OnOff::Id)
+ if (attributePath.mClusterId == OnOff::Id && attributePath.mAttributeId == OnOff::Attributes::OnOff::Id)
{
- ChipLogProgress(Zcl, "Unknown cluster ID: " ChipLogFormatMEI, ChipLogValueMEI(clusterId));
- return;
- }
-
- if (attributeId != OnOff::Attributes::OnOff::Id)
- {
- ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId));
- return;
- }
-
- if (*value)
- {
- PumpMgr().InitiateAction(0, PumpManager::LOCK_ACTION);
- }
- else
- {
- PumpMgr().InitiateAction(0, PumpManager::UNLOCK_ACTION);
+ PumpMgr().InitiateAction(0, *value ? PumpManager::LOCK_ACTION : PumpManager::UNLOCK_ACTION);
}
}
diff --git a/examples/pump-controller-app/nrfconnect/main/ZclCallbacks.cpp b/examples/pump-controller-app/nrfconnect/main/ZclCallbacks.cpp
index dac901a..05271e5 100644
--- a/examples/pump-controller-app/nrfconnect/main/ZclCallbacks.cpp
+++ b/examples/pump-controller-app/nrfconnect/main/ZclCallbacks.cpp
@@ -15,41 +15,22 @@
* limitations under the License.
*/
-#include <lib/support/logging/CHIPLogging.h>
-
#include "AppTask.h"
#include "PumpManager.h"
#include <app-common/zap-generated/ids/Attributes.h>
#include <app-common/zap-generated/ids/Clusters.h>
-#include <app/util/af-types.h>
-#include <app/util/af.h>
+#include <app/ConcreteAttributePath.h>
using namespace ::chip;
using namespace ::chip::app::Clusters;
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
+void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
+ uint16_t size, uint8_t * value)
{
- if (clusterId != OnOff::Id)
+ if (attributePath.mClusterId == OnOff::Id && attributePath.mAttributeId == OnOff::Attributes::OnOff::Id)
{
- ChipLogProgress(Zcl, "Unknown cluster ID: %" PRIx32, clusterId);
- return;
- }
-
- if (attributeId != OnOff::Attributes::OnOff::Id)
- {
- ChipLogProgress(Zcl, "Unknown attribute ID: %" PRIx32, attributeId);
- return;
- }
-
- if (*value)
- {
- PumpMgr().InitiateAction(0, PumpManager::START_ACTION);
- }
- else
- {
- PumpMgr().InitiateAction(0, PumpManager::STOP_ACTION);
+ PumpMgr().InitiateAction(0, *value ? PumpManager::START_ACTION : PumpManager::STOP_ACTION);
}
}
diff --git a/examples/thermostat/linux/main.cpp b/examples/thermostat/linux/main.cpp
index cabd201..bfeae1f 100644
--- a/examples/thermostat/linux/main.cpp
+++ b/examples/thermostat/linux/main.cpp
@@ -16,53 +16,34 @@
* limitations under the License.
*/
-#include <platform/CHIPDeviceLayer.h>
-#include <platform/PlatformManager.h>
-
-#include <app-common/zap-generated/attribute-id.h>
-#include <app-common/zap-generated/callback.h>
-#include <app-common/zap-generated/cluster-id.h>
-#include <app/Command.h>
-#include <app/chip-zcl-zpro-codec.h>
-#include <app/server/Mdns.h>
-#include <app/util/af-types.h>
-#include <app/util/af.h>
-#include <app/util/attribute-storage.h>
-#include <app/util/util.h>
-#include <lib/core/CHIPError.h>
-#include <lib/support/CHIPMem.h>
-#include <lib/support/RandUtils.h>
-
#include "AppMain.h"
-#include <cassert>
-#include <iostream>
+#include <app-common/zap-generated/callback.h>
+#include <app-common/zap-generated/ids/Clusters.h>
+#include <app/Command.h>
+#include <app/ConcreteAttributePath.h>
+#include <app/util/af.h>
using namespace chip;
-using namespace chip::Inet;
-using namespace chip::Transport;
-using namespace chip::DeviceLayer;
+using namespace chip::app;
+using namespace chip::app::Clusters;
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
-{}
-
-bool emberAfBasicClusterMfgSpecificPingCallback(chip::app::Command * commandObj)
+bool emberAfBasicClusterMfgSpecificPingCallback(Command * commandObj)
{
emberAfSendDefaultResponse(emberAfCurrentCommand(), EMBER_ZCL_STATUS_SUCCESS);
return true;
}
-// emberAfPreAttributeChangeCallback() is called for every cluster.
+// MatterPreAttributeChangeCallback() is called for every cluster.
// As of 8/17/21 cluster specific PreAttributeChangeCalbacks are not yet implemented.
-EmberAfStatus emberAfPreAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
+Protocols::InteractionModel::Status MatterPreAttributeChangeCallback(const ConcreteAttributePath & attributePath, uint8_t mask,
+ uint8_t type, uint16_t size, uint8_t * value)
{
- EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS;
- if (clusterId == ZCL_THERMOSTAT_CLUSTER_ID)
+ Protocols::InteractionModel::Status status = Protocols::InteractionModel::Status::Success;
+ if (attributePath.mClusterId == Thermostat::Id)
{
- status = emberAfThermostatClusterServerPreAttributeChangedCallback(endpoint, attributeId, type, size, value);
+ status = MatterThermostatClusterServerPreAttributeChangedCallback(attributePath, type, size, value);
}
return status;
}
diff --git a/examples/tv-app/linux/include/cluster-change-attribute.cpp b/examples/tv-app/linux/include/cluster-change-attribute.cpp
index dac5b9d..b82682e 100644
--- a/examples/tv-app/linux/include/cluster-change-attribute.cpp
+++ b/examples/tv-app/linux/include/cluster-change-attribute.cpp
@@ -16,11 +16,13 @@
* limitations under the License.
*/
-#include <app-common/zap-generated/attribute-id.h>
-#include <app-common/zap-generated/cluster-id.h>
-#include <app/util/af.h>
+#include <app-common/zap-generated/ids/Attributes.h>
+#include <app-common/zap-generated/ids/Clusters.h>
+#include <app/ConcreteAttributePath.h>
+#include <lib/support/logging/CHIPLogging.h>
using namespace chip;
+using namespace ::chip::app::Clusters;
enum TvCommand
{
@@ -44,19 +46,19 @@
}
}
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
+void MatterAfPostAttributeChangeCallback(const app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
+ uint16_t size, uint8_t * value)
{
- if (clusterId == ZCL_ON_OFF_CLUSTER_ID && attributeId == ZCL_ON_OFF_ATTRIBUTE_ID)
+ if (attributePath.mClusterId == OnOff::Id && attributePath.mAttributeId == OnOff::Attributes::OnOff::Id)
{
- ChipLogProgress(Zcl, "Received on/off command for cluster id: %d", clusterId);
+ ChipLogProgress(Zcl, "Received on/off command for cluster id: " ChipLogFormatMEI, ChipLogValueMEI(OnOff::Id));
- if (endpoint == 0)
+ if (attributePath.mEndpointId == 0)
{
ChipLogProgress(Zcl, "Execute POWER_TOGGLE");
runTvCommand(PowerToggle);
}
- else if (endpoint == 1)
+ else if (attributePath.mEndpointId == 1)
{
ChipLogProgress(Zcl, "Execute MUTE_TOGGLE");
runTvCommand(MuteToggle);
diff --git a/examples/tv-app/linux/main.cpp b/examples/tv-app/linux/main.cpp
index 9b8e46c..7997037 100644
--- a/examples/tv-app/linux/main.cpp
+++ b/examples/tv-app/linux/main.cpp
@@ -16,27 +16,14 @@
* limitations under the License.
*/
-#include <cassert>
-#include <iostream>
-#include <platform/CHIPDeviceLayer.h>
-#include <platform/PlatformManager.h>
-
-#include <app-common/zap-generated/attribute-id.h>
-#include <app-common/zap-generated/cluster-id.h>
-#include <app/Command.h>
-#include <app/chip-zcl-zpro-codec.h>
-#include <app/util/af-types.h>
-#include <app/util/af.h>
-#include <app/util/attribute-storage.h>
-#include <app/util/util.h>
-#include <lib/core/CHIPError.h>
-#include <lib/support/CHIPMem.h>
-#include <lib/support/RandUtils.h>
-
#include "AppMain.h"
+#include <app-common/zap-generated/ids/Attributes.h>
+#include <app-common/zap-generated/ids/Clusters.h>
+#include <app/Command.h>
+#include <app/util/af.h>
+
#include <iostream>
-#include <lib/support/ErrorStr.h>
#include "include/application-launcher/ApplicationLauncherManager.h"
#include "include/audio-output/AudioOutputManager.h"
@@ -51,10 +38,6 @@
using namespace chip::Transport;
using namespace chip::DeviceLayer;
-void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
- uint16_t manufacturerCode, uint8_t type, uint8_t size, uint8_t * value)
-{}
-
bool emberAfBasicClusterMfgSpecificPingCallback(chip::app::Command * commandObj)
{
emberAfSendDefaultResponse(emberAfCurrentCommand(), EMBER_ZCL_STATUS_SUCCESS);
diff --git a/examples/window-app/common/src/ZclCallbacks.cpp b/examples/window-app/common/src/ZclCallbacks.cpp
index f5578d5..7bd00e9 100644
--- a/examples/window-app/common/src/ZclCallbacks.cpp
+++ b/examples/window-app/common/src/ZclCallbacks.cpp
@@ -22,74 +22,75 @@
#include <AppConfig.h>
#include <WindowApp.h>
-#include <app-common/zap-generated/attribute-id.h>
+
#include <app-common/zap-generated/attributes/Accessors.h>
-#include <app-common/zap-generated/cluster-id.h>
#include <app-common/zap-generated/cluster-objects.h>
+#include <app-common/zap-generated/ids/Attributes.h>
+#include <app-common/zap-generated/ids/Clusters.h>
#include <app/CommandHandler.h>
+#include <app/ConcreteAttributePath.h>
#include <app/ConcreteCommandPath.h>
#include <app/clusters/window-covering-server/window-covering-server.h>
-#include <app/util/af-types.h>
#include <app/util/af.h>
-using namespace chip::app::Clusters::WindowCovering;
+using namespace ::chip;
+using namespace ::chip::app::Clusters::WindowCovering;
-void emberAfPostAttributeChangeCallback(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId,
- uint8_t mask, uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
+void MatterPostAttributeChangeCallback(const app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type, uint16_t size,
+ uint8_t * value)
{
- if (ZCL_WINDOW_COVERING_CLUSTER_ID == clusterId)
+ if (attributePath.mClusterId == Id)
{
- WindowApp & app = WindowApp::Instance();
- uint16_t current;
- uint16_t target;
-
- switch (attributeId)
- {
- case ZCL_WC_TYPE_ATTRIBUTE_ID:
- app.PostEvent(WindowApp::Event(WindowApp::EventId::CoverTypeChange, endpoint));
- break;
-
- case ZCL_WC_CURRENT_POSITION_LIFT_PERCENT100_THS_ATTRIBUTE_ID:
- app.PostEvent(WindowApp::Event(WindowApp::EventId::LiftChanged, endpoint));
- break;
-
- case ZCL_WC_CURRENT_POSITION_TILT_PERCENT100_THS_ATTRIBUTE_ID:
- app.PostEvent(WindowApp::Event(WindowApp::EventId::TiltChanged, endpoint));
- break;
-
- case ZCL_WC_TARGET_POSITION_LIFT_PERCENT100_THS_ATTRIBUTE_ID:
- Attributes::TargetPositionLiftPercent100ths::Get(endpoint, &target);
- Attributes::CurrentPositionLiftPercent100ths::Get(endpoint, ¤t);
- if (current > target)
- {
- app.PostEvent(WindowApp::Event(WindowApp::EventId::LiftDown, endpoint));
- }
- else if (current < target)
- {
- app.PostEvent(WindowApp::Event(WindowApp::EventId::LiftUp, endpoint));
- }
- break;
-
- case ZCL_WC_TARGET_POSITION_TILT_PERCENT100_THS_ATTRIBUTE_ID:
- Attributes::TargetPositionTiltPercent100ths::Get(endpoint, &target);
- Attributes::CurrentPositionTiltPercent100ths::Get(endpoint, ¤t);
- if (current > target)
- {
- app.PostEvent(WindowApp::Event(WindowApp::EventId::TiltDown, endpoint));
- }
- else if (current < target)
- {
- app.PostEvent(WindowApp::Event(WindowApp::EventId::TiltUp, endpoint));
- }
- break;
-
- default:
- break;
- }
+ ChipLogProgress(Zcl, "Unknown cluster ID: " ChipLogFormatMEI, ChipLogValueMEI(attributePath.mClusterId));
}
- else
+
+ WindowApp & app = WindowApp::Instance();
+ EndpointId endpoint = attributePath.mEndpointId;
+ uint16_t current;
+ uint16_t target;
+
+ switch (attributePath.mAttributeId)
{
- ChipLogProgress(Zcl, "Unknown cluster ID: %ld", clusterId);
+ case Attributes::Type::Id:
+ app.PostEvent(WindowApp::Event(WindowApp::EventId::CoverTypeChange, endpoint));
+ break;
+
+ case Attributes::CurrentPositionLiftPercent100ths::Id:
+ app.PostEvent(WindowApp::Event(WindowApp::EventId::LiftChanged, endpoint));
+ break;
+
+ case Attributes::CurrentPositionTiltPercent100ths::Id:
+ app.PostEvent(WindowApp::Event(WindowApp::EventId::TiltChanged, endpoint));
+ break;
+
+ case Attributes::TargetPositionLiftPercent100ths::Id:
+ Attributes::TargetPositionLiftPercent100ths::Get(endpoint, &target);
+ Attributes::CurrentPositionLiftPercent100ths::Get(endpoint, ¤t);
+ if (current > target)
+ {
+ app.PostEvent(WindowApp::Event(WindowApp::EventId::LiftDown, endpoint));
+ }
+ else if (current < target)
+ {
+ app.PostEvent(WindowApp::Event(WindowApp::EventId::LiftUp, endpoint));
+ }
+ break;
+
+ case Attributes::TargetPositionTiltPercent100ths::Id:
+ Attributes::TargetPositionTiltPercent100ths::Get(endpoint, &target);
+ Attributes::CurrentPositionTiltPercent100ths::Get(endpoint, ¤t);
+ if (current > target)
+ {
+ app.PostEvent(WindowApp::Event(WindowApp::EventId::TiltDown, endpoint));
+ }
+ else if (current < target)
+ {
+ app.PostEvent(WindowApp::Event(WindowApp::EventId::TiltUp, endpoint));
+ }
+ break;
+
+ default:
+ break;
}
}