| #include <Weave/DeviceLayer/internal/LocaleSettingsTraitDataSink.h> |
| #include <weave/trait/locale/LocaleSettingsTrait.h> |
| |
| #include <lib/syslog/cpp/macros.h> |
| |
| using namespace nl::Weave::TLV; |
| using namespace ::nl::Weave::Profiles::DataManagement_Current; |
| using namespace Schema::Weave::Trait::Locale; |
| |
| LocaleSettingsTraitDataSink::LocaleSettingsTraitDataSink() : TraitDataSink(&LocaleSettingsTrait::TraitSchema) |
| { |
| memset(mLocale, 0, sizeof(mLocale)); |
| } |
| |
| WEAVE_ERROR |
| LocaleSettingsTraitDataSink::SetLeafData(PropertyPathHandle aLeafHandle, TLVReader & aReader) |
| { |
| WEAVE_ERROR err = WEAVE_NO_ERROR; |
| |
| switch (aLeafHandle) |
| { |
| case LocaleSettingsTrait::kPropertyHandle_ActiveLocale: |
| err = aReader.GetString(mLocale, sizeof(mLocale)); |
| nlREQUIRE_SUCCESS(err, exit); |
| |
| FX_LOGS(INFO) << "<< active_locale = \"%s\"\n" << mLocale; |
| break; |
| |
| default: |
| FX_LOGS(INFO) << "<< UNKNOWN Locale Settings Trait leaf handle : %d\n" << aLeafHandle; |
| } |
| |
| exit: |
| return err; |
| } |