Skip to content

Commit 7bd3dad

Browse files
[SL-UP] : using dynamic initialization for Identify cluster on multiple endpoints (#780)
* silabs identify support * MATTER-3770 * Restyled by whitespace * use loop to verify initialize * fix brackets * fix pointer * mvoe init inside ifdef --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 3927bca commit 7bd3dad

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

examples/platform/silabs/BaseApplication.cpp

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@
8888
#include <performance_test_commands.h>
8989
#endif // PERFORMANCE_TEST_ENABLED
9090

91+
#ifdef MATTER_DM_PLUGIN_IDENTIFY_SERVER
92+
#include <app-common/zap-generated/callback.h>
93+
#endif
94+
9195
// SL-Only
9296
#include "sl_component_catalog.h"
9397
#ifdef SL_CATALOG_ZIGBEE_STACK_COMMON_PRESENT
@@ -179,13 +183,7 @@ SilabsLCD slLCD;
179183
#ifdef MATTER_DM_PLUGIN_IDENTIFY_SERVER
180184
Clusters::Identify::EffectIdentifierEnum sIdentifyEffect = Clusters::Identify::EffectIdentifierEnum::kStopEffect;
181185

182-
Identify gIdentify = {
183-
chip::EndpointId{ 1 },
184-
BaseApplication::OnIdentifyStart,
185-
BaseApplication::OnIdentifyStop,
186-
Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator,
187-
BaseApplication::OnTriggerIdentifyEffect,
188-
};
186+
ObjectPool<Identify, MATTER_DM_IDENTIFY_CLUSTER_SERVER_ENDPOINT_COUNT + CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT> IdentifyPool;
189187

190188
#endif // MATTER_DM_PLUGIN_IDENTIFY_SERVER
191189

@@ -453,7 +451,16 @@ bool BaseApplication::ActivateStatusLedPatterns()
453451
bool isPatternSet = false;
454452
#if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT)))
455453
#ifdef MATTER_DM_PLUGIN_IDENTIFY_SERVER
456-
if (gIdentify.mActive)
454+
bool isIdentifyActive = false;
455+
for (const auto & obj : IdentifyPool)
456+
{
457+
if (obj->mActive)
458+
{
459+
isIdentifyActive = true;
460+
break;
461+
}
462+
}
463+
if (isIdentifyActive)
457464
{
458465
// Identify in progress
459466
// Do a steady blink on the status led
@@ -806,6 +813,12 @@ void BaseApplication::OnTriggerIdentifyEffect(Identify * identify)
806813
ChipLogProgress(Zcl, "No identifier effect");
807814
}
808815
}
816+
817+
void emberAfIdentifyClusterInitCallback(chip::EndpointId endpoint)
818+
{
819+
IdentifyPool.CreateObject(endpoint, BaseApplication::OnIdentifyStart, BaseApplication::OnIdentifyStop,
820+
Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator, BaseApplication::OnTriggerIdentifyEffect);
821+
}
809822
#endif // MATTER_DM_PLUGIN_IDENTIFY_SERVER
810823

811824
void BaseApplication::LightTimerEventHandler(void * timerCbArg)

0 commit comments

Comments
 (0)