Skip to content

Commit

Permalink
Fix reading attribute activeLocale failure (#14255)
Browse files Browse the repository at this point in the history
* Fix reading attribute activeLocale failure

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

Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>

Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
  • Loading branch information
2 people authored and pull[bot] committed Nov 1, 2023
1 parent 7043cec commit 2227476
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ using namespace chip::app::Clusters::LocalizationConfiguration::Attributes;

namespace {

constexpr size_t kMaxActiveLocaleLength = 35;

class LocalizationConfigurationAttrAccess : public AttributeAccessInterface
{
public:
Expand Down Expand Up @@ -150,7 +152,9 @@ void emberAfLocalizationConfigurationClusterServerInitCallback(EndpointId endpoi
{
DeviceLayer::AttributeList<CharSpan, DeviceLayer::kMaxLanguageTags> supportedLocales;
CharSpan validLocale;
MutableCharSpan activeLocale;

char outBuffer[kMaxActiveLocaleLength];
MutableCharSpan activeLocale(outBuffer);
EmberAfStatus status = ActiveLocale::Get(endpoint, activeLocale);

VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError(Zcl, "Failed to read ActiveLocale with error: 0x%02x", status));
Expand Down

0 comments on commit 2227476

Please sign in to comment.