Skip to content

Commit f2b4dbd

Browse files
Clean up configuration manager (#10528)
* Remove unused ConfigurationManager methods. Part one: * Firmware build time. * The device certificate chain and private key. * The provisioning hash. * Configuring the CHIP stack. * Remove unused ConfigurationManager methods. Part two: * Service ID, configuration, and provisioning data. * Paired account ID. * Remove unused ConfigurationManager methods. Part three: * Fabric ID. * The flags member variable since the methods that used it have also been removed. * Remove the fabric ID from the shell commands since that was the only place that used it. * Remove unused ConfigurationManager methods. Part four: * Device ID. * Remove the device ID from the shell commands since that was the only place that used it. * Remove unused ConfigurationManager methods. Part five: * QR Code. * Wifi AP SSID. * _GetPollPeriod (GenericConfigurationManagerImpl-specific) * Remove string parsing methods that the ConfigurationManager no longer uses.
1 parent a56c83e commit f2b4dbd

8 files changed

+0
-1231
lines changed

src/include/platform/ConfigurationManager.h

-184
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ class ConfigurationManager
5858

5959
enum
6060
{
61-
kMaxPairingCodeLength = 16,
6261
kMaxSerialNumberLength = 32,
6362
kMaxFirmwareRevisionLength = 32,
6463
#if CHIP_DEVICE_CONFIG_ENABLE_THREAD
@@ -82,22 +81,8 @@ class ConfigurationManager
8281
CHIP_ERROR GetManufacturingDate(uint16_t & year, uint8_t & month, uint8_t & dayOfMonth);
8382
CHIP_ERROR GetFirmwareRevisionString(char * buf, size_t bufSize);
8483
CHIP_ERROR GetFirmwareRevision(uint32_t & firmwareRev);
85-
CHIP_ERROR GetFirmwareBuildTime(uint16_t & year, uint8_t & month, uint8_t & dayOfMonth, uint8_t & hour, uint8_t & minute,
86-
uint8_t & second);
87-
CHIP_ERROR GetDeviceId(uint64_t & deviceId);
88-
CHIP_ERROR GetDeviceCertificate(uint8_t * buf, size_t bufSize, size_t & certLen);
89-
CHIP_ERROR GetDeviceIntermediateCACerts(uint8_t * buf, size_t bufSize, size_t & certsLen);
90-
CHIP_ERROR GetDevicePrivateKey(uint8_t * buf, size_t bufSize, size_t & keyLen);
91-
CHIP_ERROR GetManufacturerDeviceId(uint64_t & deviceId);
92-
CHIP_ERROR GetManufacturerDeviceCertificate(uint8_t * buf, size_t bufSize, size_t & certLen);
93-
CHIP_ERROR GetManufacturerDeviceIntermediateCACerts(uint8_t * buf, size_t bufSize, size_t & certsLen);
94-
CHIP_ERROR GetManufacturerDevicePrivateKey(uint8_t * buf, size_t bufSize, size_t & keyLen);
9584
CHIP_ERROR GetSetupPinCode(uint32_t & setupPinCode);
9685
CHIP_ERROR GetSetupDiscriminator(uint16_t & setupDiscriminator);
97-
CHIP_ERROR GetServiceId(uint64_t & serviceId);
98-
CHIP_ERROR GetFabricId(uint64_t & fabricId);
99-
CHIP_ERROR GetServiceConfig(uint8_t * buf, size_t bufSize, size_t & serviceConfigLen);
100-
CHIP_ERROR GetPairedAccountId(char * buf, size_t bufSize, size_t & accountIdLen);
10186
#if CHIP_ENABLE_ROTATING_DEVICE_ID
10287
// Lifetime counter is monotonic counter that is incremented only in the case of a factory reset
10388
CHIP_ERROR GetLifetimeCounter(uint16_t & lifetimeCounter);
@@ -110,40 +95,21 @@ class ConfigurationManager
11095
CHIP_ERROR StorePrimary802154MACAddress(const uint8_t * buf);
11196
CHIP_ERROR StoreManufacturingDate(const char * mfgDate, size_t mfgDateLen);
11297
CHIP_ERROR StoreProductRevision(uint16_t productRev);
113-
CHIP_ERROR StoreFabricId(uint64_t fabricId);
114-
CHIP_ERROR StoreManufacturerDeviceId(uint64_t deviceId);
115-
CHIP_ERROR StoreManufacturerDeviceCertificate(const uint8_t * cert, size_t certLen);
116-
CHIP_ERROR StoreManufacturerDeviceIntermediateCACerts(const uint8_t * certs, size_t certsLen);
117-
CHIP_ERROR StoreManufacturerDevicePrivateKey(const uint8_t * key, size_t keyLen);
11898
CHIP_ERROR StoreSetupPinCode(uint32_t setupPinCode);
11999
CHIP_ERROR StoreSetupDiscriminator(uint16_t setupDiscriminator);
120-
CHIP_ERROR StoreServiceProvisioningData(uint64_t serviceId, const uint8_t * serviceConfig, size_t serviceConfigLen,
121-
const char * accountId, size_t accountIdLen);
122-
CHIP_ERROR ClearServiceProvisioningData();
123-
CHIP_ERROR StoreServiceConfig(const uint8_t * serviceConfig, size_t serviceConfigLen);
124-
CHIP_ERROR StorePairedAccountId(const char * accountId, size_t accountIdLen);
125100
CHIP_ERROR StoreRegulatoryLocation(uint32_t location);
126101
CHIP_ERROR StoreCountryCode(const char * code, size_t codeLen);
127102
CHIP_ERROR StoreBreadcrumb(uint64_t breadcrumb);
128103

129-
CHIP_ERROR GetQRCodeString(char * buf, size_t bufSize);
130-
131-
CHIP_ERROR GetWiFiAPSSID(char * buf, size_t bufSize);
132-
133104
CHIP_ERROR GetBLEDeviceIdentificationInfo(Ble::ChipBLEDeviceIdentificationInfo & deviceIdInfo);
134105

135106
#if !defined(NDEBUG)
136107
CHIP_ERROR RunUnitTests();
137108
#endif
138109

139-
bool IsServiceProvisioned();
140-
bool IsPairedToAccount();
141-
bool IsMemberOfFabric();
142110
bool IsFullyProvisioned();
143111
void InitiateFactoryReset();
144112

145-
CHIP_ERROR ComputeProvisioningHash(uint8_t * hashBuf, size_t hashBufSize);
146-
147113
void LogDeviceConfig();
148114

149115
bool IsCommissionableDeviceTypeEnabled();
@@ -170,7 +136,6 @@ class ConfigurationManager
170136
using ImplClass = ::chip::DeviceLayer::ConfigurationManagerImpl;
171137

172138
CHIP_ERROR Init();
173-
CHIP_ERROR ConfigureChipStack();
174139
bool CanFactoryReset();
175140
CHIP_ERROR GetFailSafeArmed(bool & val);
176141
CHIP_ERROR SetFailSafeArmed(bool val);
@@ -303,52 +268,6 @@ inline CHIP_ERROR ConfigurationManager::GetFirmwareRevision(uint32_t & firmwareR
303268
return static_cast<ImplClass *>(this)->_GetFirmwareRevision(firmwareRev);
304269
}
305270

306-
inline CHIP_ERROR ConfigurationManager::GetFirmwareBuildTime(uint16_t & year, uint8_t & month, uint8_t & dayOfMonth, uint8_t & hour,
307-
uint8_t & minute, uint8_t & second)
308-
{
309-
return static_cast<ImplClass *>(this)->_GetFirmwareBuildTime(year, month, dayOfMonth, hour, minute, second);
310-
}
311-
312-
inline CHIP_ERROR ConfigurationManager::GetDeviceId(uint64_t & deviceId)
313-
{
314-
return static_cast<ImplClass *>(this)->_GetDeviceId(deviceId);
315-
}
316-
317-
inline CHIP_ERROR ConfigurationManager::GetDeviceCertificate(uint8_t * buf, size_t bufSize, size_t & certLen)
318-
{
319-
return static_cast<ImplClass *>(this)->_GetDeviceCertificate(buf, bufSize, certLen);
320-
}
321-
322-
inline CHIP_ERROR ConfigurationManager::GetDeviceIntermediateCACerts(uint8_t * buf, size_t bufSize, size_t & certsLen)
323-
{
324-
return static_cast<ImplClass *>(this)->_GetDeviceIntermediateCACerts(buf, bufSize, certsLen);
325-
}
326-
327-
inline CHIP_ERROR ConfigurationManager::GetDevicePrivateKey(uint8_t * buf, size_t bufSize, size_t & keyLen)
328-
{
329-
return static_cast<ImplClass *>(this)->_GetDevicePrivateKey(buf, bufSize, keyLen);
330-
}
331-
332-
inline CHIP_ERROR ConfigurationManager::GetManufacturerDeviceId(uint64_t & deviceId)
333-
{
334-
return static_cast<ImplClass *>(this)->_GetManufacturerDeviceId(deviceId);
335-
}
336-
337-
inline CHIP_ERROR ConfigurationManager::GetManufacturerDeviceCertificate(uint8_t * buf, size_t bufSize, size_t & certLen)
338-
{
339-
return static_cast<ImplClass *>(this)->_GetManufacturerDeviceCertificate(buf, bufSize, certLen);
340-
}
341-
342-
inline CHIP_ERROR ConfigurationManager::GetManufacturerDeviceIntermediateCACerts(uint8_t * buf, size_t bufSize, size_t & certsLen)
343-
{
344-
return static_cast<ImplClass *>(this)->_GetManufacturerDeviceIntermediateCACerts(buf, bufSize, certsLen);
345-
}
346-
347-
inline CHIP_ERROR ConfigurationManager::GetManufacturerDevicePrivateKey(uint8_t * buf, size_t bufSize, size_t & keyLen)
348-
{
349-
return static_cast<ImplClass *>(this)->_GetManufacturerDevicePrivateKey(buf, bufSize, keyLen);
350-
}
351-
352271
inline CHIP_ERROR ConfigurationManager::GetSetupPinCode(uint32_t & setupPinCode)
353272
{
354273
return static_cast<ImplClass *>(this)->_GetSetupPinCode(setupPinCode);
@@ -359,26 +278,6 @@ inline CHIP_ERROR ConfigurationManager::GetSetupDiscriminator(uint16_t & setupDi
359278
return static_cast<ImplClass *>(this)->_GetSetupDiscriminator(setupDiscriminator);
360279
}
361280

362-
inline CHIP_ERROR ConfigurationManager::GetServiceId(uint64_t & serviceId)
363-
{
364-
return static_cast<ImplClass *>(this)->_GetServiceId(serviceId);
365-
}
366-
367-
inline CHIP_ERROR ConfigurationManager::GetFabricId(uint64_t & fabricId)
368-
{
369-
return static_cast<ImplClass *>(this)->_GetFabricId(fabricId);
370-
}
371-
372-
inline CHIP_ERROR ConfigurationManager::GetServiceConfig(uint8_t * buf, size_t bufSize, size_t & serviceConfigLen)
373-
{
374-
return static_cast<ImplClass *>(this)->_GetServiceConfig(buf, bufSize, serviceConfigLen);
375-
}
376-
377-
inline CHIP_ERROR ConfigurationManager::GetPairedAccountId(char * buf, size_t bufSize, size_t & accountIdLen)
378-
{
379-
return static_cast<ImplClass *>(this)->_GetPairedAccountId(buf, bufSize, accountIdLen);
380-
}
381-
382281
#if CHIP_ENABLE_ROTATING_DEVICE_ID
383282
inline CHIP_ERROR ConfigurationManager::GetLifetimeCounter(uint16_t & lifetimeCounter)
384283
{
@@ -426,31 +325,6 @@ inline CHIP_ERROR ConfigurationManager::StoreProductRevision(uint16_t productRev
426325
return static_cast<ImplClass *>(this)->_StoreProductRevision(productRev);
427326
}
428327

429-
inline CHIP_ERROR ConfigurationManager::StoreFabricId(uint64_t fabricId)
430-
{
431-
return static_cast<ImplClass *>(this)->_StoreFabricId(fabricId);
432-
}
433-
434-
inline CHIP_ERROR ConfigurationManager::StoreManufacturerDeviceId(uint64_t deviceId)
435-
{
436-
return static_cast<ImplClass *>(this)->_StoreManufacturerDeviceId(deviceId);
437-
}
438-
439-
inline CHIP_ERROR ConfigurationManager::StoreManufacturerDeviceCertificate(const uint8_t * cert, size_t certLen)
440-
{
441-
return static_cast<ImplClass *>(this)->_StoreManufacturerDeviceCertificate(cert, certLen);
442-
}
443-
444-
inline CHIP_ERROR ConfigurationManager::StoreManufacturerDeviceIntermediateCACerts(const uint8_t * certs, size_t certsLen)
445-
{
446-
return static_cast<ImplClass *>(this)->_StoreManufacturerDeviceIntermediateCACerts(certs, certsLen);
447-
}
448-
449-
inline CHIP_ERROR ConfigurationManager::StoreManufacturerDevicePrivateKey(const uint8_t * key, size_t keyLen)
450-
{
451-
return static_cast<ImplClass *>(this)->_StoreManufacturerDevicePrivateKey(key, keyLen);
452-
}
453-
454328
inline CHIP_ERROR ConfigurationManager::StoreSetupPinCode(uint32_t setupPinCode)
455329
{
456330
return static_cast<ImplClass *>(this)->_StoreSetupPinCode(setupPinCode);
@@ -461,14 +335,6 @@ inline CHIP_ERROR ConfigurationManager::StoreSetupDiscriminator(uint16_t setupDi
461335
return static_cast<ImplClass *>(this)->_StoreSetupDiscriminator(setupDiscriminator);
462336
}
463337

464-
inline CHIP_ERROR ConfigurationManager::StoreServiceProvisioningData(uint64_t serviceId, const uint8_t * serviceConfig,
465-
size_t serviceConfigLen, const char * accountId,
466-
size_t accountIdLen)
467-
{
468-
return static_cast<ImplClass *>(this)->_StoreServiceProvisioningData(serviceId, serviceConfig, serviceConfigLen, accountId,
469-
accountIdLen);
470-
}
471-
472338
inline CHIP_ERROR ConfigurationManager::StoreRegulatoryLocation(uint32_t location)
473339
{
474340
return static_cast<ImplClass *>(this)->_StoreRegulatoryLocation(location);
@@ -484,21 +350,6 @@ inline CHIP_ERROR ConfigurationManager::StoreBreadcrumb(uint64_t breadcrumb)
484350
return static_cast<ImplClass *>(this)->_StoreBreadcrumb(breadcrumb);
485351
}
486352

487-
inline CHIP_ERROR ConfigurationManager::ClearServiceProvisioningData()
488-
{
489-
return static_cast<ImplClass *>(this)->_ClearServiceProvisioningData();
490-
}
491-
492-
inline CHIP_ERROR ConfigurationManager::StoreServiceConfig(const uint8_t * serviceConfig, size_t serviceConfigLen)
493-
{
494-
return static_cast<ImplClass *>(this)->_StoreServiceConfig(serviceConfig, serviceConfigLen);
495-
}
496-
497-
inline CHIP_ERROR ConfigurationManager::StorePairedAccountId(const char * accountId, size_t accountIdLen)
498-
{
499-
return static_cast<ImplClass *>(this)->_StorePairedAccountId(accountId, accountIdLen);
500-
}
501-
502353
inline CHIP_ERROR ConfigurationManager::ReadPersistedStorageValue(::chip::Platform::PersistedStorage::Key key, uint32_t & value)
503354
{
504355
return static_cast<ImplClass *>(this)->_ReadPersistedStorageValue(key, value);
@@ -509,36 +360,11 @@ inline CHIP_ERROR ConfigurationManager::WritePersistedStorageValue(::chip::Platf
509360
return static_cast<ImplClass *>(this)->_WritePersistedStorageValue(key, value);
510361
}
511362

512-
inline CHIP_ERROR ConfigurationManager::GetQRCodeString(char * buf, size_t bufSize)
513-
{
514-
return static_cast<ImplClass *>(this)->_GetQRCodeString(buf, bufSize);
515-
}
516-
517-
inline CHIP_ERROR ConfigurationManager::GetWiFiAPSSID(char * buf, size_t bufSize)
518-
{
519-
return static_cast<ImplClass *>(this)->_GetWiFiAPSSID(buf, bufSize);
520-
}
521-
522363
inline CHIP_ERROR ConfigurationManager::GetBLEDeviceIdentificationInfo(Ble::ChipBLEDeviceIdentificationInfo & deviceIdInfo)
523364
{
524365
return static_cast<ImplClass *>(this)->_GetBLEDeviceIdentificationInfo(deviceIdInfo);
525366
}
526367

527-
inline bool ConfigurationManager::IsServiceProvisioned()
528-
{
529-
return static_cast<ImplClass *>(this)->_IsServiceProvisioned();
530-
}
531-
532-
inline bool ConfigurationManager::IsPairedToAccount()
533-
{
534-
return static_cast<ImplClass *>(this)->_IsPairedToAccount();
535-
}
536-
537-
inline bool ConfigurationManager::IsMemberOfFabric()
538-
{
539-
return static_cast<ImplClass *>(this)->_IsMemberOfFabric();
540-
}
541-
542368
inline bool ConfigurationManager::IsFullyProvisioned()
543369
{
544370
return static_cast<ImplClass *>(this)->_IsFullyProvisioned();
@@ -559,21 +385,11 @@ inline CHIP_ERROR ConfigurationManager::RunUnitTests()
559385
}
560386
#endif
561387

562-
inline CHIP_ERROR ConfigurationManager::ComputeProvisioningHash(uint8_t * hashBuf, size_t hashBufSize)
563-
{
564-
return static_cast<ImplClass *>(this)->_ComputeProvisioningHash(hashBuf, hashBufSize);
565-
}
566-
567388
inline CHIP_ERROR ConfigurationManager::Init()
568389
{
569390
return static_cast<ImplClass *>(this)->_Init();
570391
}
571392

572-
inline CHIP_ERROR ConfigurationManager::ConfigureChipStack()
573-
{
574-
return static_cast<ImplClass *>(this)->_ConfigureChipStack();
575-
}
576-
577393
inline bool ConfigurationManager::CanFactoryReset()
578394
{
579395
return static_cast<ImplClass *>(this)->_CanFactoryReset();

src/include/platform/GeneralUtils.h

-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
namespace chip {
2929
namespace DeviceLayer {
3030

31-
extern CHIP_ERROR ParseCompilerDateStr(const char * dateStr, uint16_t & year, uint8_t & month, uint8_t & dayOfMonth);
32-
extern CHIP_ERROR Parse24HourTimeStr(const char * timeStr, uint8_t & hour, uint8_t & minute, uint8_t & second);
3331
extern const char * CharacterizeIPv6Address(const chip::Inet::IPAddress & ipAddr);
3432
extern const char * CharacterizeIPv6Prefix(const chip::Inet::IPPrefix & inPrefix);
3533
extern void RegisterDeviceLayerErrorFormatter();

0 commit comments

Comments
 (0)