Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address review comments for src/platform/Darwin from #1497 #1620

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
66 changes: 1 addition & 65 deletions src/platform/Darwin/ConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ bool ConfigurationManagerImpl::_CanFactoryReset()

void ConfigurationManagerImpl::_InitiateFactoryReset()
{
PlatformMgr().ScheduleWork(DoFactoryReset);
ChipLogError(DeviceLayer, "InitiateFactoryReset not implemented");
}

CHIP_ERROR ConfigurationManagerImpl::_ReadPersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t & value)
Expand All @@ -89,69 +89,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