Skip to content

Commit

Permalink
link attribute reads to Content Apps
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdecenzo committed Jan 16, 2022
1 parent fd218ae commit 1426586
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions src/app/util/ContentApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,43 @@ namespace AppPlatform {
EmberAfStatus ContentApp::HandleReadAttribute(ClusterId clusterId, chip::AttributeId attributeId, uint8_t * buffer,
uint16_t maxReadLength)
{
ChipLogProgress(DeviceLayer, "Read Attribute for device %s cluster %d attribute=%d)",
ChipLogProgress(DeviceLayer, "Read Attribute for device %s cluster %d attribute=%d",
GetApplicationBasic()->GetApplicationName(), static_cast<uint16_t>(clusterId),
static_cast<uint16_t>(attributeId));

EmberAfStatus ret = EMBER_ZCL_STATUS_FAILURE;
if (clusterId == ZCL_APPLICATION_BASIC_CLUSTER_ID)
{
ret = GetApplicationBasic()->HandleReadAttribute(attributeId, buffer, maxReadLength);
return GetApplicationBasic()->HandleReadAttribute(attributeId, buffer, maxReadLength);
}
if (clusterId == ZCL_ACCOUNT_LOGIN_CLUSTER_ID)
{
return GetAccountLogin()->HandleReadAttribute(attributeId, buffer, maxReadLength);
}
if (clusterId == ZCL_ACCOUNT_LOGIN_CLUSTER_ID)
{
return GetAccountLogin()->HandleReadAttribute(attributeId, buffer, maxReadLength);
}
if (clusterId == ZCL_ACCOUNT_LOGIN_CLUSTER_ID)
{
return GetAccountLogin()->HandleReadAttribute(attributeId, buffer, maxReadLength);
}
if (clusterId == ZCL_ACCOUNT_LOGIN_CLUSTER_ID)
{
return GetAccountLogin()->HandleReadAttribute(attributeId, buffer, maxReadLength);
}
if (clusterId == ZCL_ACCOUNT_LOGIN_CLUSTER_ID)
{
return GetAccountLogin()->HandleReadAttribute(attributeId, buffer, maxReadLength);
}
if (clusterId == ZCL_ACCOUNT_LOGIN_CLUSTER_ID)
{
ret = GetAccountLogin()->HandleReadAttribute(attributeId, buffer, maxReadLength);
return GetAccountLogin()->HandleReadAttribute(attributeId, buffer, maxReadLength);
}
return ret;
if (clusterId == ZCL_ACCOUNT_LOGIN_CLUSTER_ID)
{
return GetAccountLogin()->HandleReadAttribute(attributeId, buffer, maxReadLength);
}
return EMBER_ZCL_STATUS_FAILURE;
}

EmberAfStatus ContentApp::HandleWriteAttribute(ClusterId clusterId, chip::AttributeId attributeId, uint8_t * buffer)
Expand All @@ -68,17 +91,15 @@ EmberAfStatus ContentApp::HandleWriteAttribute(ClusterId clusterId, chip::Attrib
GetApplicationBasic()->GetApplicationName(), static_cast<uint16_t>(clusterId),
static_cast<uint16_t>(attributeId));

EmberAfStatus ret = EMBER_ZCL_STATUS_FAILURE;

if (clusterId == ZCL_APPLICATION_BASIC_CLUSTER_ID)
{
ret = GetApplicationBasic()->HandleWriteAttribute(attributeId, buffer);
return GetApplicationBasic()->HandleWriteAttribute(attributeId, buffer);
}
if (clusterId == ZCL_ACCOUNT_LOGIN_CLUSTER_ID)
{
ret = GetAccountLogin()->HandleWriteAttribute(attributeId, buffer);
return GetAccountLogin()->HandleWriteAttribute(attributeId, buffer);
}
return ret;
return EMBER_ZCL_STATUS_FAILURE;
}

EmberAfStatus ApplicationBasic::HandleReadAttribute(chip::AttributeId attributeId, uint8_t * buffer, uint16_t maxReadLength)
Expand Down

0 comments on commit 1426586

Please sign in to comment.