Skip to content

Commit

Permalink
Reduce Impl() use in GenericConfigurationManagerImpl.
Browse files Browse the repository at this point in the history
The next step to making ConfigurationManager virtual is to remove
the use of Impl() in GenericConfigurationManagerImpl, since the
virtual methods already handle delegating to the inheritor.

Impl() can't be completely removed yet because it's also used for
other functions not part of the ConfigurationManager interface.
  • Loading branch information
harimau-qirex committed Oct 18, 2021
1 parent 54990b2 commit 8f84225
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/include/platform/internal/GenericConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ template <class ImplClass>
void GenericConfigurationManagerImpl<ImplClass>::InitiateFactoryReset()
{
#if CHIP_ENABLE_ROTATING_DEVICE_ID
Impl()->_IncrementLifetimeCounter();
_IncrementLifetimeCounter();
#endif
Impl()->InitiateFactoryReset();
// Inheriting classes should call this method so the lifetime counter is updated if necessary.
}

template <class ImplClass>
Expand Down Expand Up @@ -375,15 +375,15 @@ GenericConfigurationManagerImpl<ImplClass>::GetBLEDeviceIdentificationInfo(Ble::

deviceIdInfo.Init();

err = Impl()->GetVendorId(id);
err = GetVendorId(id);
SuccessOrExit(err);
deviceIdInfo.SetVendorId(id);

err = Impl()->GetProductId(id);
err = GetProductId(id);
SuccessOrExit(err);
deviceIdInfo.SetProductId(id);

err = Impl()->GetSetupDiscriminator(discriminator);
err = GetSetupDiscriminator(discriminator);
SuccessOrExit(err);
deviceIdInfo.SetDeviceDiscriminator(discriminator);

Expand Down Expand Up @@ -466,13 +466,13 @@ void GenericConfigurationManagerImpl<ImplClass>::LogDeviceConfig()
{
char serialNum[ConfigurationManager::kMaxSerialNumberLength + 1];
size_t serialNumLen;
err = Impl()->GetSerialNumber(serialNum, sizeof(serialNum), serialNumLen);
err = GetSerialNumber(serialNum, sizeof(serialNum), serialNumLen);
ChipLogProgress(DeviceLayer, " Serial Number: %s", (err == CHIP_NO_ERROR) ? serialNum : "(not set)");
}

{
uint16_t vendorId;
if (Impl()->GetVendorId(vendorId) != CHIP_NO_ERROR)
if (GetVendorId(vendorId) != CHIP_NO_ERROR)
{
vendorId = 0;
}
Expand All @@ -481,7 +481,7 @@ void GenericConfigurationManagerImpl<ImplClass>::LogDeviceConfig()

{
uint16_t productId;
if (Impl()->GetProductId(productId) != CHIP_NO_ERROR)
if (GetProductId(productId) != CHIP_NO_ERROR)
{
productId = 0;
}
Expand All @@ -490,7 +490,7 @@ void GenericConfigurationManagerImpl<ImplClass>::LogDeviceConfig()

{
uint16_t productRev;
if (Impl()->GetProductRevision(productRev) != CHIP_NO_ERROR)
if (GetProductRevision(productRev) != CHIP_NO_ERROR)
{
productRev = 0;
}
Expand All @@ -499,7 +499,7 @@ void GenericConfigurationManagerImpl<ImplClass>::LogDeviceConfig()

{
uint32_t setupPINCode;
if (Impl()->GetSetupPinCode(setupPINCode) != CHIP_NO_ERROR)
if (GetSetupPinCode(setupPINCode) != CHIP_NO_ERROR)
{
setupPINCode = 0;
}
Expand All @@ -508,7 +508,7 @@ void GenericConfigurationManagerImpl<ImplClass>::LogDeviceConfig()

{
uint16_t setupDiscriminator;
if (Impl()->GetSetupDiscriminator(setupDiscriminator) != CHIP_NO_ERROR)
if (GetSetupDiscriminator(setupDiscriminator) != CHIP_NO_ERROR)
{
setupDiscriminator = 0;
}
Expand All @@ -518,7 +518,7 @@ void GenericConfigurationManagerImpl<ImplClass>::LogDeviceConfig()
{
uint16_t year;
uint8_t month, dayOfMonth;
err = Impl()->GetManufacturingDate(year, month, dayOfMonth);
err = GetManufacturingDate(year, month, dayOfMonth);
if (err == CHIP_NO_ERROR)
{
ChipLogProgress(DeviceLayer, " Manufacturing Date: %04" PRIu16 "/%02" PRIu8 "/%02" PRIu8, year, month, dayOfMonth);
Expand All @@ -531,7 +531,7 @@ void GenericConfigurationManagerImpl<ImplClass>::LogDeviceConfig()

{
uint16_t deviceType;
if (Impl()->GetDeviceType(deviceType) != CHIP_NO_ERROR)
if (GetDeviceType(deviceType) != CHIP_NO_ERROR)
{
deviceType = 0;
}
Expand Down

0 comments on commit 8f84225

Please sign in to comment.