Skip to content

Commit

Permalink
Add Color/Level control clusters to the lighting app
Browse files Browse the repository at this point in the history
Still WIP for changing the actual LED color/saturation.

Signed-off-by: Doru Gucea <doru-cristian.gucea@nxp.com>
  • Loading branch information
doru91 committed Oct 21, 2021
1 parent 94abffd commit 67e0400
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions examples/lighting-app/k32w/main/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,45 @@ using namespace ::chip::app::Clusters;
void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
{
if (clusterId != OnOff::Id)
if (clusterId == OnOff::Id)
{
ChipLogProgress(Zcl, "Unknown cluster ID: " ChipLogFormatMEI, ChipLogValueMEI(clusterId));
return;
if (attributeId != OnOff::Attributes::Ids::OnOff)
{
ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId));
return;
}

LightingMgr().InitiateAction(0, *value ? LightingManager::TURNON_ACTION : LightingManager::TURNOFF_ACTION);
}
else if (clusterId == LevelControl::Id)
{
ChipLogProgress(Zcl,
"Level Control attribute ID: " ChipLogFormatMEI " Type: %" PRIu8 " Value: %" PRIu16 ", length %" PRIu16,
ChipLogValueMEI(attributeId), type, *value, size);

if (attributeId != OnOff::Attributes::Ids::OnOff)
// WIP Apply attribute change to Light
}
else if (clusterId == ColorControl::Id)
{
ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId));
return;
ChipLogProgress(Zcl,
"Color Control attribute ID: " ChipLogFormatMEI " Type: %" PRIu8 " Value: %" PRIu16 ", length %" PRIu16,
ChipLogValueMEI(attributeId), type, *value, size);

// WIP Apply attribute change to Light
}
else if (clusterId == OnOffSwitchConfiguration::Id)
{
ChipLogProgress(Zcl,
"OnOff Switch Configuration attribute ID: " ChipLogFormatMEI " Type: %" PRIu8 " Value: %" PRIu16
", length %" PRIu16,
ChipLogValueMEI(attributeId), type, *value, size);

LightingMgr().InitiateAction(0, *value ? LightingManager::TURNON_ACTION : LightingManager::TURNOFF_ACTION);
// WIP Apply attribute change to Light
}
else
{
ChipLogProgress(Zcl, "Unknown cluster ID: " ChipLogFormatMEI, ChipLogValueMEI(clusterId));
}
}

/** @brief OnOff Cluster Init
Expand Down

0 comments on commit 67e0400

Please sign in to comment.