Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yufengwangca committed Apr 12, 2022
1 parent 40082e3 commit 8a27abd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/include/platform/DeviceInfoProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class DeviceInfoProvider

/**
* @brief Set the storage implementation used for non-volatile storage of device information data.
* This method MUST be called before Init().
*
* @param storage Pointer to storage instance to set. Cannot be nullptr, will assert.
*/
Expand Down
28 changes: 20 additions & 8 deletions src/platform/Darwin/DeviceInfoProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ size_t DeviceInfoProviderImpl::FixedLabelIteratorImpl::Count()

bool DeviceInfoProviderImpl::FixedLabelIteratorImpl::Next(FixedLabelType & output)
{
bool retval = true;

// In Darwin Simulation, use the following hardcoded labelList on all endpoints.
CHIP_ERROR err = CHIP_NO_ERROR;

Expand Down Expand Up @@ -104,12 +106,14 @@ bool DeviceInfoProviderImpl::FixedLabelIteratorImpl::Next(FixedLabelType & outpu

mIndex++;

return true;
retval = true;
}
else
{
return false;
retval = false;
}

return retval;
}

CHIP_ERROR DeviceInfoProviderImpl::SetUserLabelLength(EndpointId endpoint, size_t val)
Expand Down Expand Up @@ -218,6 +222,8 @@ size_t DeviceInfoProviderImpl::SupportedLocalesIteratorImpl::Count()

bool DeviceInfoProviderImpl::SupportedLocalesIteratorImpl::Next(CharSpan & output)
{
bool retval = true;

// In Darwin simulation, return following hardcoded list of Strings that are valid values for the ActiveLocale.
CHIP_ERROR err = CHIP_NO_ERROR;

Expand Down Expand Up @@ -266,12 +272,14 @@ bool DeviceInfoProviderImpl::SupportedLocalesIteratorImpl::Next(CharSpan & outpu

mIndex++;

return true;
retval = true;
}
else
{
return false;
retval = false;
}

return retval;
}

DeviceInfoProvider::SupportedCalendarTypesIterator * DeviceInfoProviderImpl::IterateSupportedCalendarTypes()
Expand All @@ -281,7 +289,7 @@ DeviceInfoProvider::SupportedCalendarTypesIterator * DeviceInfoProviderImpl::Ite

size_t DeviceInfoProviderImpl::SupportedCalendarTypesIteratorImpl::Count()
{
// In Linux Simulation, return the size of the hardcoded list of Strings that are valid values for the Calendar Types.
// In Darwin Simulation, return the size of the hardcoded list of Strings that are valid values for the Calendar Types.
// {("kBuddhist"), ("kChinese"), ("kCoptic"), ("kEthiopian"), ("kGregorian"), ("kHebrew"), ("kIndian"), ("kJapanese"),
// ("kKorean"), ("kPersian"), ("kTaiwanese"), ("kIslamic")}

Expand All @@ -290,7 +298,9 @@ size_t DeviceInfoProviderImpl::SupportedCalendarTypesIteratorImpl::Count()

bool DeviceInfoProviderImpl::SupportedCalendarTypesIteratorImpl::Next(CalendarType & output)
{
// In Linux Simulation, return following hardcoded list of Strings that are valid values for the Calendar Types.
bool retval = true;

// In Darwin Simulation, return following hardcoded list of Strings that are valid values for the Calendar Types.
CHIP_ERROR err = CHIP_NO_ERROR;

VerifyOrReturnError(mIndex < 12, false);
Expand Down Expand Up @@ -341,12 +351,14 @@ bool DeviceInfoProviderImpl::SupportedCalendarTypesIteratorImpl::Next(CalendarTy
if (err == CHIP_NO_ERROR)
{
mIndex++;
return true;
retval = true;
}
else
{
return false;
retval = false;
}

return retval;
}

} // namespace DeviceLayer
Expand Down

0 comments on commit 8a27abd

Please sign in to comment.