From 672ba2468546d7d43b754959f51ac82dd8ad7a05 Mon Sep 17 00:00:00 2001 From: weicheng Date: Tue, 18 Jul 2023 15:26:04 +0800 Subject: [PATCH] add Identify implementation example --- examples/platform/asr/CHIPDeviceManager.cpp | 38 +++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/examples/platform/asr/CHIPDeviceManager.cpp b/examples/platform/asr/CHIPDeviceManager.cpp index 8587b0b65abde2..1daf05a518aa63 100644 --- a/examples/platform/asr/CHIPDeviceManager.cpp +++ b/examples/platform/asr/CHIPDeviceManager.cpp @@ -26,6 +26,7 @@ #include "CHIPDeviceManager.h" #include +#include #include #include #include @@ -74,3 +75,40 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & cb->PostAttributeChangeCallback(path.mEndpointId, path.mClusterId, path.mAttributeId, type, size, value); } } + +void OnIdentifyStart(Identify *) +{ + ChipLogProgress(Zcl, "OnIdentifyStart"); +} + +void OnIdentifyStop(Identify *) +{ + ChipLogProgress(Zcl, "OnIdentifyStop"); +} + +void OnTriggerEffect(Identify * identify) +{ + switch (identify->mCurrentEffectIdentifier) + { + case Clusters::Identify::EffectIdentifierEnum::kBlink: + ChipLogProgress(Zcl, "Clusters::Identify::EffectIdentifierEnum::kBlink"); + break; + case Clusters::Identify::EffectIdentifierEnum::kBreathe: + ChipLogProgress(Zcl, "Clusters::Identify::EffectIdentifierEnum::kBreathe"); + break; + case Clusters::Identify::EffectIdentifierEnum::kOkay: + ChipLogProgress(Zcl, "Clusters::Identify::EffectIdentifierEnum::kOkay"); + break; + case Clusters::Identify::EffectIdentifierEnum::kChannelChange: + ChipLogProgress(Zcl, "Clusters::Identify::EffectIdentifierEnum::kChannelChange"); + break; + default: + ChipLogProgress(Zcl, "No identifier effect"); + return; + } +} + +static Identify gIdentify1 = { + chip::EndpointId{ 1 }, OnIdentifyStart, OnIdentifyStop, Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator, + OnTriggerEffect, +};