Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup redundant helper function in localization configuration server #15744

Merged
merged 2 commits into from
Mar 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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