From 70369003d3f907259a103b493a7f0c8f84156afa Mon Sep 17 00:00:00 2001 From: Kamil Kasperczyk <66371704+kkasperczyk-no@users.noreply.github.com> Date: Mon, 13 Jun 2022 15:56:17 +0200 Subject: [PATCH] [nrfconnect] Added handling Identify TriggerEffect command (#19522) All-clusters-app for nrfconnect doesn't support handling TriggerEffect command, despite it is enabled in the .zap configuration. Added method that handles TriggerEffect callback. --- .../nrfconnect/main/AppTask.cpp | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp index 29391063b1eebb..106c3957f4c5af 100644 --- a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -63,6 +64,40 @@ k_timer sFunctionTimer; chip::DeviceLayer::DeviceInfoProviderImpl gExampleDeviceInfoProvider; +constexpr EndpointId kIdentifyEndpointId = 1; + +void OnIdentifyTriggerEffect(Identify * identify) +{ + ChipLogProgress(Zcl, "OnIdentifyTriggerEffect"); + switch (identify->mCurrentEffectIdentifier) + { + case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BLINK: + ChipLogProgress(Zcl, "Effect: EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BLINK"); + break; + case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BREATHE: + ChipLogProgress(Zcl, "Effect: EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BREATHE"); + break; + case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_OKAY: + ChipLogProgress(Zcl, "Effect: EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_OKAY"); + break; + case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_CHANNEL_CHANGE: + ChipLogProgress(Zcl, "Effect: EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_CHANNEL_CHANGE"); + break; + default: + ChipLogProgress(Zcl, "Effect: No identifier effect"); + break; + } + return; +} + +Identify sIdentify = { + chip::EndpointId{ kIdentifyEndpointId }, + [](Identify *) { ChipLogProgress(Zcl, "OnIdentifyStart"); }, + [](Identify *) { ChipLogProgress(Zcl, "OnIdentifyStop"); }, + EMBER_ZCL_IDENTIFY_IDENTIFY_TYPE_NONE, + OnIdentifyTriggerEffect, +}; + } // namespace constexpr EndpointId kNetworkCommissioningEndpointSecondary = 0xFFFE;