Skip to content

Commit

Permalink
Address review comments for src/platform/Darwin from project-chip#1497
Browse files Browse the repository at this point in the history
  • Loading branch information
vivien-apple committed Jul 16, 2020
1 parent bca8b6e commit 6c1f843
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 70 deletions.
2 changes: 1 addition & 1 deletion src/platform/Darwin/CHIPDevicePlatformEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ enum InternalPlatformSpecificEventTypes
} // namespace DeviceEventType

/**
* Represents platform-specific event information for Linux platforms.
* Represents platform-specific event information for Darwin platforms.
*/
struct ChipDevicePlatformEvent final
{
Expand Down
65 changes: 0 additions & 65 deletions src/platform/Darwin/ConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ bool ConfigurationManagerImpl::_CanFactoryReset()

void ConfigurationManagerImpl::_InitiateFactoryReset()
{
PlatformMgr().ScheduleWork(DoFactoryReset);
}

CHIP_ERROR ConfigurationManagerImpl::_ReadPersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t & value)
Expand All @@ -89,69 +88,5 @@ CHIP_ERROR ConfigurationManagerImpl::_WritePersistedStorageValue(::chip::Platfor
return WriteConfigValue(configKey, value);
}

#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION
CHIP_ERROR ConfigurationManagerImpl::GetWiFiStationSecurityType(Profiles::NetworkProvisioning::WiFiSecurityType & secType)
{
CHIP_ERROR err;
uint32_t secTypeInt;

err = ReadConfigValue(kConfigKey_WiFiStationSecType, secTypeInt);
if (err == CHIP_NO_ERROR)
{
secType = (Profiles::NetworkProvisioning::WiFiSecurityType) secTypeInt;
}
return err;
}

CHIP_ERROR ConfigurationManagerImpl::UpdateWiFiStationSecurityType(Profiles::NetworkProvisioning::WiFiSecurityType secType)
{
CHIP_ERROR err;
Profiles::NetworkProvisioning::WiFiSecurityType curSecType;

if (secType != Profiles::NetworkProvisioning::kWiFiSecurityType_NotSpecified)
{
err = GetWiFiStationSecurityType(curSecType);
if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND || (err == CHIP_NO_ERROR && secType != curSecType))
{
uint32_t secTypeInt = secType;
err = WriteConfigValue(kConfigKey_WiFiStationSecType, secTypeInt);
}
SuccessOrExit(err);
}
else
{
err = ClearConfigValue(kConfigKey_WiFiStationSecType);
SuccessOrExit(err);
}

exit:
return err;
}
#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION

void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg)
{
CHIP_ERROR err;

ChipLogProgress(DeviceLayer, "Performing factory reset");

err = FactoryResetConfig();
if (err != CHIP_NO_ERROR)
{
ChipLogError(DeviceLayer, "FactoryResetConfig() failed: %s", ErrorStr(err));
}

#if CHIP_DEVICE_CONFIG_ENABLE_THREAD

ChipLogProgress(DeviceLayer, "Clearing Thread provision");
ThreadStackMgr().ErasePersistentInfo();

#endif // CHIP_DEVICE_CONFIG_ENABLE_THREAD

// Restart the system.
ChipLogProgress(DeviceLayer, "System restarting (not implemented)");
// TODO(#742): restart CHIP exe
}

} // namespace DeviceLayer
} // namespace chip
4 changes: 0 additions & 4 deletions src/platform/Darwin/ConfigurationManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ class ConfigurationManagerImpl final : public ConfigurationManager,
friend ConfigurationManagerImpl & ConfigurationMgrImpl(void);

static ConfigurationManagerImpl sInstance;

// ===== Private members reserved for use by this class only.

static void DoFactoryReset(intptr_t arg);
};

/**
Expand Down

0 comments on commit 6c1f843

Please sign in to comment.