Skip to content

Commit

Permalink
Resolve identify all clusters 19060 (#19247)
Browse files Browse the repository at this point in the history
* Resolve Shell, all clusters application crash

* Add stub Identify actions

* Resolve shell application lockup

* Apply formatting
  • Loading branch information
adabreuti authored Jun 7, 2022
1 parent dd636ad commit 55ab764
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 20 deletions.
1 change: 1 addition & 0 deletions examples/all-clusters-app/cc13x2x7_26x2x7/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ti_sysconfig("sysconfig") {
sources = [ "${project_dir}/chip.syscfg" ]

outputs = [
"ti_devices_config.c",
"ti_radio_config.c",
"ti_radio_config.h",
"ti_drivers_config.c",
Expand Down
3 changes: 1 addition & 2 deletions examples/all-clusters-app/cc13x2x7_26x2x7/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ ti_simplelink_board = "LP_CC2652R7"
optimize_debug_level = "s"
lwip_debug = false

#optimize_for_size=true
chip_enable_ota_requestor = false

# Disable FTD Build for all-clusters app to save Flash
chip_openthread_ftd = false

# Disable CHIP Logging
chip_progress_logging = false
#chip_progress_logging = false
chip_detail_logging = false
chip_automation_logging = false

Expand Down
3 changes: 1 addition & 2 deletions examples/all-clusters-app/cc13x2x7_26x2x7/chip.syscfg
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ for(var setting in ccfgSettings)
CCFG[setting] = ccfgSettings[setting];
}

// Disable CCFG generation, this is added by the BIM project
CCFG.enableCodeGeneration = false;
CCFG.enableCodeGeneration = true;

/* NVS */
NVS1.$name = "CONFIG_NVSINTERNAL";
Expand Down
46 changes: 42 additions & 4 deletions examples/all-clusters-app/cc13x2x7_26x2x7/main/ClusterManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ using namespace ::chip;
using namespace ::chip::Inet;
using namespace ::chip::System;
using namespace ::chip::DeviceLayer;
using namespace ::chip::app::Clusters;

constexpr uint32_t kIdentifyTimerDelayMS = 250;
constexpr uint32_t kIdentifyTimerDelayPerSec = 4;
Expand All @@ -44,6 +43,45 @@ ClusterManager ClusterManager::sCluster;
#define ENDPOINT_ID_1 (1)
#define ENDPOINT_ID_2 (2)

void OnIdentifyTriggerEffect(Identify * identify)
{
switch (identify->mCurrentEffectIdentifier)
{
case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BLINK:
PLAT_LOG("EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BLINK");
break;
case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BREATHE:
PLAT_LOG("EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BREATHE");
break;
case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_OKAY:
PLAT_LOG("EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_OKAY");
break;
case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_CHANNEL_CHANGE:
PLAT_LOG("EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_CHANNEL_CHANGE");
break;
default:
PLAT_LOG("No identifier effect");
break;
}
return;
}

Identify gIdentify0 = {
chip::EndpointId{ 0 },
[](Identify *) { PLAT_LOG("onIdentifyStart"); },
[](Identify *) { PLAT_LOG("onIdentifyStop"); },
EMBER_ZCL_IDENTIFY_IDENTIFY_TYPE_VISIBLE_LED,
OnIdentifyTriggerEffect,
};

Identify gIdentify1 = {
chip::EndpointId{ 1 },
[](Identify *) { PLAT_LOG("onIdentifyStart"); },
[](Identify *) { PLAT_LOG("onIdentifyStop"); },
EMBER_ZCL_IDENTIFY_IDENTIFY_TYPE_VISIBLE_LED,
OnIdentifyTriggerEffect,
};

void ClusterManager::OnOnOffPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value)
{
VerifyOrExit(attributeId == ZCL_ON_OFF_ATTRIBUTE_ID, PLAT_LOG("Unhandled Attribute ID: '0x%04x", attributeId));
Expand Down Expand Up @@ -94,13 +132,13 @@ void ClusterManager::OnColorControlAttributeChangeCallback(EndpointId endpointId
{
hue = *value;
/* Read Current Saturation value when Attribute change callback for HUE Attribute */
ColorControl::Attributes::CurrentSaturation::Get(endpointId, &saturation);
app::Clusters::ColorControl::Attributes::CurrentSaturation::Get(endpointId, &saturation);
}
else
{
saturation = *value;
/* Read Current Hue value when Attribute change callback for SATURATION Attribute */
ColorControl::Attributes::CurrentHue::Get(endpointId, &hue);
app::Clusters::ColorControl::Attributes::CurrentHue::Get(endpointId, &hue);
}
PLAT_LOG("Color Control triggered: Hue: %d Saturation: %d", hue, saturation);
}
Expand All @@ -111,7 +149,7 @@ void ClusterManager::OnColorControlAttributeChangeCallback(EndpointId endpointId
void ClusterManager::OnIdentifyPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint16_t size,
uint8_t * value)
{
if (attributeId == Identify::Attributes::IdentifyTime::Id && size == 2)
if (attributeId == app::Clusters::Identify::Attributes::IdentifyTime::Id && size == 2)
{
uint16_t identifyTime;
memcpy(&identifyTime, value, size);
Expand Down
1 change: 1 addition & 0 deletions examples/all-clusters-minimal-app/cc13x2x7_26x2x7/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ti_sysconfig("sysconfig") {
sources = [ "${project_dir}/chip.syscfg" ]

outputs = [
"ti_devices_config.c",
"ti_radio_config.c",
"ti_radio_config.h",
"ti_drivers_config.c",
Expand Down
3 changes: 1 addition & 2 deletions examples/all-clusters-minimal-app/cc13x2x7_26x2x7/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ ti_simplelink_board = "LP_CC2652R7"
optimize_debug_level = "s"
lwip_debug = false

#optimize_for_size=true
chip_enable_ota_requestor = false

# Disable FTD Build for all-clusters app to save Flash
chip_openthread_ftd = false

# Disable CHIP Logging
chip_progress_logging = false
#chip_progress_logging = false
chip_detail_logging = false
chip_automation_logging = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ for(var setting in ccfgSettings)
CCFG[setting] = ccfgSettings[setting];
}

// Disable CCFG generation, this is added by the BIM project
CCFG.enableCodeGeneration = false;
CCFG.enableCodeGeneration = true;

/* NVS */
NVS1.$name = "CONFIG_NVSINTERNAL";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ using namespace ::chip;
using namespace ::chip::Inet;
using namespace ::chip::System;
using namespace ::chip::DeviceLayer;
using namespace ::chip::app::Clusters;

constexpr uint32_t kIdentifyTimerDelayMS = 250;
constexpr uint32_t kIdentifyTimerDelayPerSec = 4;
Expand All @@ -44,6 +43,45 @@ ClusterManager ClusterManager::sCluster;
#define ENDPOINT_ID_1 (1)
#define ENDPOINT_ID_2 (2)

void OnIdentifyTriggerEffect(Identify * identify)
{
switch (identify->mCurrentEffectIdentifier)
{
case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BLINK:
PLAT_LOG("EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BLINK");
break;
case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BREATHE:
PLAT_LOG("EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_BREATHE");
break;
case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_OKAY:
PLAT_LOG("EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_OKAY");
break;
case EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_CHANNEL_CHANGE:
PLAT_LOG("EMBER_ZCL_IDENTIFY_EFFECT_IDENTIFIER_CHANNEL_CHANGE");
break;
default:
PLAT_LOG("No identifier effect");
break;
}
return;
}

Identify gIdentify0 = {
chip::EndpointId{ 0 },
[](Identify *) { PLAT_LOG("onIdentifyStart"); },
[](Identify *) { PLAT_LOG("onIdentifyStop"); },
EMBER_ZCL_IDENTIFY_IDENTIFY_TYPE_VISIBLE_LED,
OnIdentifyTriggerEffect,
};

Identify gIdentify1 = {
chip::EndpointId{ 1 },
[](Identify *) { PLAT_LOG("onIdentifyStart"); },
[](Identify *) { PLAT_LOG("onIdentifyStop"); },
EMBER_ZCL_IDENTIFY_IDENTIFY_TYPE_VISIBLE_LED,
OnIdentifyTriggerEffect,
};

void ClusterManager::OnOnOffPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint8_t * value)
{
VerifyOrExit(attributeId == ZCL_ON_OFF_ATTRIBUTE_ID, PLAT_LOG("Unhandled Attribute ID: '0x%04x", attributeId));
Expand Down Expand Up @@ -94,13 +132,13 @@ void ClusterManager::OnColorControlAttributeChangeCallback(EndpointId endpointId
{
hue = *value;
/* Read Current Saturation value when Attribute change callback for HUE Attribute */
ColorControl::Attributes::CurrentSaturation::Get(endpointId, &saturation);
app::Clusters::ColorControl::Attributes::CurrentSaturation::Get(endpointId, &saturation);
}
else
{
saturation = *value;
/* Read Current Hue value when Attribute change callback for SATURATION Attribute */
ColorControl::Attributes::CurrentHue::Get(endpointId, &hue);
app::Clusters::ColorControl::Attributes::CurrentHue::Get(endpointId, &hue);
}
PLAT_LOG("Color Control triggered: Hue: %d Saturation: %d", hue, saturation);
}
Expand All @@ -111,7 +149,7 @@ void ClusterManager::OnColorControlAttributeChangeCallback(EndpointId endpointId
void ClusterManager::OnIdentifyPostAttributeChangeCallback(EndpointId endpointId, AttributeId attributeId, uint16_t size,
uint8_t * value)
{
if (attributeId == Identify::Attributes::IdentifyTime::Id && size == 2)
if (attributeId == app::Clusters::Identify::Attributes::IdentifyTime::Id && size == 2)
{
uint16_t identifyTime;
memcpy(&identifyTime, value, size);
Expand Down
1 change: 1 addition & 0 deletions examples/shell/cc13x2x7_26x2x7/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ ti_sysconfig("sysconfig") {
sources = [ "chip.syscfg" ]

outputs = [
"ti_devices_config.c",
"ti_radio_config.c",
"ti_radio_config.h",
"ti_drivers_config.c",
Expand Down
2 changes: 1 addition & 1 deletion examples/shell/cc13x2x7_26x2x7/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ chip_enable_ota_requestor = false
chip_openthread_ftd = false

# Disable CHIP Logging
chip_progress_logging = false
#chip_progress_logging = false
chip_detail_logging = false
chip_automation_logging = false

Expand Down
3 changes: 1 addition & 2 deletions examples/shell/cc13x2x7_26x2x7/chip.syscfg
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ for(var setting in ccfgSettings)
CCFG[setting] = ccfgSettings[setting];
}

// Disable CCFG generation, this is added by the BIM project
CCFG.enableCodeGeneration = false;
CCFG.enableCodeGeneration = true;

/* NVS */
NVS1.$name = "CONFIG_NVSINTERNAL";
Expand Down
2 changes: 1 addition & 1 deletion examples/shell/cc13x2x7_26x2x7/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ CHIP_ERROR AppTask::Init()
;
}

ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
if (ret != CHIP_NO_ERROR)
{
while (1)
Expand Down

0 comments on commit 55ab764

Please sign in to comment.