Skip to content

Commit

Permalink
Add identify support ot linux/all-cluster-app and fix initialization (#…
Browse files Browse the repository at this point in the history
…10907)

* add identify support to linux/all-cluster-app

* fix identify init
  • Loading branch information
eve-cxrp authored and pull[bot] committed Jan 10, 2022
1 parent 91c911b commit 1646511
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
15 changes: 15 additions & 0 deletions examples/all-clusters-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

#include <app/Command.h>
#include <app/clusters/identify-server/identify-server.h>
#include <app/util/af.h>

#include "AppMain.h"
Expand All @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/app/clusters/identify-server/identify-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ static inline void reg(Identify * inst)
if (nullptr == instances[i])
{
instances[i] = inst;
break;
}
}
}
Expand All @@ -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)
Expand Down Expand Up @@ -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<uint8_t>(effectVariant))
{
(void) Clusters::Identify::Attributes::IdentifyType::Set(endpoint, identifyType);
reg(this);
};

Expand Down
1 change: 1 addition & 0 deletions src/app/clusters/identify-server/identify-server.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct Identify
chip::EndpointId mEndpoint;
onIdentifyStartCb mOnIdentifyStart = nullptr;
onIdentifyStopCb mOnIdentifyStop = nullptr;
EmberAfIdentifyIdentifyType mIdentifyType;
onEffectIdentifierCb mOnEffectIdentifier;
EmberAfIdentifyEffectIdentifier mCurrentEffectIdentifier;
EmberAfIdentifyEffectIdentifier mTargetEffectIdentifier;
Expand Down

0 comments on commit 1646511

Please sign in to comment.