diff --git a/examples/all-clusters-app/linux/main.cpp b/examples/all-clusters-app/linux/main.cpp index 8884a9bddc0341..d2a4cf2a27dd95 100644 --- a/examples/all-clusters-app/linux/main.cpp +++ b/examples/all-clusters-app/linux/main.cpp @@ -17,6 +17,7 @@ */ #include +#include #include #include "AppMain.h" @@ -27,6 +28,20 @@ bool emberAfBasicClusterMfgSpecificPingCallback(chip::app::Command * commandObj) return true; } +Identify gIdentify0 = { + chip::EndpointId{ 0 }, + [](Identify *) { ChipLogProgress(Zcl, "onIdentifyStart"); }, + [](Identify *) { ChipLogProgress(Zcl, "onIdentifyStop"); }, + EMBER_ZCL_IDENTIFY_IDENTIFY_TYPE_VISIBLE_LED, +}; + +Identify gIdentify1 = { + chip::EndpointId{ 1 }, + [](Identify *) { ChipLogProgress(Zcl, "onIdentifyStart"); }, + [](Identify *) { ChipLogProgress(Zcl, "onIdentifyStop"); }, + EMBER_ZCL_IDENTIFY_IDENTIFY_TYPE_VISIBLE_LED, +}; + int main(int argc, char * argv[]) { VerifyOrDie(ChipLinuxAppInit(argc, argv) == 0); diff --git a/src/app/clusters/identify-server/identify-server.cpp b/src/app/clusters/identify-server/identify-server.cpp index 81e457bff1842b..9a326844e7638b 100644 --- a/src/app/clusters/identify-server/identify-server.cpp +++ b/src/app/clusters/identify-server/identify-server.cpp @@ -88,6 +88,7 @@ static inline void reg(Identify * inst) if (nullptr == instances[i]) { instances[i] = inst; + break; } } } @@ -105,7 +106,7 @@ static inline void unreg(Identify * inst) void emberAfIdentifyClusterServerInitCallback(EndpointId endpoint) { - (void) endpoint; + (void) Clusters::Identify::Attributes::IdentifyType::Set(endpoint, inst(endpoint)->mIdentifyType); } static void onIdentifyClusterTick(chip::System::Layer * systemLayer, void * appState) @@ -315,11 +316,10 @@ Identify::Identify(chip::EndpointId endpoint, onIdentifyStartCb onIdentifyStart, EmberAfIdentifyIdentifyType identifyType, onEffectIdentifierCb onEffectIdentifier, EmberAfIdentifyEffectIdentifier effectIdentifier, EmberAfIdentifyEffectVariant effectVariant) : mEndpoint(endpoint), - mOnIdentifyStart(onIdentifyStart), mOnIdentifyStop(onIdentifyStop), mOnEffectIdentifier(onEffectIdentifier), - mCurrentEffectIdentifier(effectIdentifier), mTargetEffectIdentifier(effectIdentifier), + mOnIdentifyStart(onIdentifyStart), mOnIdentifyStop(onIdentifyStop), mIdentifyType(identifyType), + mOnEffectIdentifier(onEffectIdentifier), mCurrentEffectIdentifier(effectIdentifier), mTargetEffectIdentifier(effectIdentifier), mEffectVariant(static_cast(effectVariant)) { - (void) Clusters::Identify::Attributes::IdentifyType::Set(endpoint, identifyType); reg(this); }; diff --git a/src/app/clusters/identify-server/identify-server.h b/src/app/clusters/identify-server/identify-server.h index 8a0d43abec2c20..38f53afedc045a 100644 --- a/src/app/clusters/identify-server/identify-server.h +++ b/src/app/clusters/identify-server/identify-server.h @@ -53,6 +53,7 @@ struct Identify chip::EndpointId mEndpoint; onIdentifyStartCb mOnIdentifyStart = nullptr; onIdentifyStopCb mOnIdentifyStop = nullptr; + EmberAfIdentifyIdentifyType mIdentifyType; onEffectIdentifierCb mOnEffectIdentifier; EmberAfIdentifyEffectIdentifier mCurrentEffectIdentifier; EmberAfIdentifyEffectIdentifier mTargetEffectIdentifier;