Skip to content

Commit

Permalink
Cleanup redundant helper function in localization configuration server (
Browse files Browse the repository at this point in the history
#15744)

* Cleanup redundant helper function

* Update src/app/clusters/localization-configuration-server/localization-configuration-server.cpp

Co-authored-by: Boris Zbarsky <[email protected]>

Co-authored-by: Boris Zbarsky <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Feb 20, 2024
1 parent 3622326 commit 1361072
Showing 1 changed file with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ CHIP_ERROR LocalizationConfigurationAttrAccess::Read(const ConcreteReadAttribute
// Pre-change callbacks for cluster attributes
// =============================================================================

using Status = Protocols::InteractionModel::Status;

static Protocols::InteractionModel::Status emberAfPluginLocalizationConfigurationOnActiveLocaleChange(EndpointId EndpointId,
CharSpan newLangtag)
{
Expand All @@ -108,19 +110,12 @@ static Protocols::InteractionModel::Status emberAfPluginLocalizationConfiguratio
{
if (locale.data_equal(newLangtag))
{
return Protocols::InteractionModel::Status::Success;
return Status::Success;
}
}
}

return Protocols::InteractionModel::Status::InvalidValue;
}

static Protocols::InteractionModel::Status
emberAfPluginLocalizationConfigurationOnUnhandledAttributeChange(EndpointId EndpointId, EmberAfAttributeType attrType,
uint16_t attrSize, uint8_t * attrValue)
{
return Protocols::InteractionModel::Status::Success;
return Status::InvalidValue;
}

Protocols::InteractionModel::Status MatterLocalizationConfigurationClusterServerPreAttributeChangedCallback(
Expand All @@ -134,12 +129,10 @@ Protocols::InteractionModel::Status MatterLocalizationConfigurationClusterServer
// TODO:: allow fromZclString for CharSpan as well and use that here
auto langtag = CharSpan(Uint8::to_char(&value[1]), static_cast<size_t>(value[0]));
res = emberAfPluginLocalizationConfigurationOnActiveLocaleChange(attributePath.mEndpointId, langtag);
break;
}
break;

default:
res =
emberAfPluginLocalizationConfigurationOnUnhandledAttributeChange(attributePath.mEndpointId, attributeType, size, value);
res = Status::Success;
break;
}

Expand Down

0 comments on commit 1361072

Please sign in to comment.